{"_id":"@byronwade/adapter-pglite","name":"@byronwade/adapter-pglite","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@byronwade/adapter-pglite","version":"0.1.0","description":"PGlite (Postgres-in-WASM) adapter for Fakebase — highest-fidelity local Postgres, no native build","license":"MIT","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"dependencies":{"@electric-sql/pglite":"^0.4.6","@byronwade/auth":"0.1.0","@byronwade/core":"0.1.0","@byronwade/storage":"0.1.0"},"devDependencies":{"@types/node":"^22.0.0","typescript":"^5.5.0","vitest":"^2.0.0"},"author":{"name":"Byron Wade"},"homepage":"https://github.com/byronwade/fakebase#readme","bugs":{"url":"https://github.com/byronwade/fakebase/issues"},"repository":{"type":"git","url":"git+https://github.com/byronwade/fakebase.git","directory":"packages/adapter-pglite"},"engines":{"node":">=20.0.0"},"sideEffects":false,"publishConfig":{"access":"public"},"keywords":["supabase","postgres","pglite","wasm","local","dev","nextjs","prototype","fakebase"],"scripts":{"build":"tsc -p tsconfig.json","test":"vitest run","typecheck":"tsc --noEmit","clean":"rm -rf dist","lint":"eslint src"},"_id":"@byronwade/adapter-pglite@0.1.0","_integrity":"sha512-TYhiW+gWWx1N96hljMaRuXX/QMGw2VAMGO8DaUuc7xpP//4kLSO0SyZplHUAbGdGNtKaTDgSvydyhD+mltSS3w==","_resolved":"/private/tmp/claude-501/fb0f736e5b4bdfa51d1c3a9bb3fb92bb/byronwade-adapter-pglite-0.1.0.tgz","_from":"file:byronwade-adapter-pglite-0.1.0.tgz","_nodeVersion":"22.20.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-TYhiW+gWWx1N96hljMaRuXX/QMGw2VAMGO8DaUuc7xpP//4kLSO0SyZplHUAbGdGNtKaTDgSvydyhD+mltSS3w==","shasum":"2c08028dc061736156f41c2de22c771c551494cb","tarball":"https://registry.npmjs.org/@byronwade/adapter-pglite/-/adapter-pglite-0.1.0.tgz","fileCount":19,"unpackedSize":67946,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDViDD/gJgpBD6CxI33jHHHmShgdGhqX9BDtkc4ynBYswIgI12pW75s1pD4/S+pnEL2cNhgZrIjkXHnkd/xjW6bM40="}]},"_npmUser":{"name":"byronwade","email":"bcw1995@gmail.com"},"directories":{},"maintainers":[{"name":"byronwade","email":"bcw1995@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/adapter-pglite_0.1.0_1780452919598_0.09488786797301763"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-03T02:15:19.438Z","0.1.0":"2026-06-03T02:15:19.732Z","modified":"2026-06-03T02:15:19.970Z"},"maintainers":[{"name":"byronwade","email":"bcw1995@gmail.com"}],"description":"PGlite (Postgres-in-WASM) adapter for Fakebase — highest-fidelity local Postgres, no native build","homepage":"https://github.com/byronwade/fakebase#readme","keywords":["supabase","postgres","pglite","wasm","local","dev","nextjs","prototype","fakebase"],"repository":{"type":"git","url":"git+https://github.com/byronwade/fakebase.git","directory":"packages/adapter-pglite"},"author":{"name":"Byron Wade"},"bugs":{"url":"https://github.com/byronwade/fakebase/issues"},"license":"MIT","readme":"# @byronwade/adapter-pglite\n\nPGlite (Postgres-in-WASM) adapter for [Fakebase](https://github.com/byronwade/fakebase) — the **highest-fidelity** local backend.\n\n[PGlite](https://pglite.dev) embeds a real Postgres engine compiled to WebAssembly, so you get true Postgres semantics (the real parser, planner, `jsonb`, `ilike`, window functions, ordering with `NULLS FIRST/LAST`, …) with **no native build step**. Unlike `better-sqlite3`, it runs identically on macOS, Linux, and Windows, and in CI, without `node-gyp`.\n\n> ⚠️ Fakebase is a **local / dev-only** tool for prototypes. It is not production infrastructure. See the [security notes](https://github.com/byronwade/fakebase/blob/main/docs/security.md).\n\n## Install\n\n```bash\npnpm add @byronwade/adapter-pglite @byronwade/client\n```\n\n`@electric-sql/pglite` is bundled as a direct dependency — there's nothing else to install.\n\n## Usage\n\n```ts\nimport { createPGliteKernel } from \"@byronwade/adapter-pglite\";\nimport { createClient } from \"@byronwade/client\";\nimport { schema } from \"./fakebase/schema\";\n\n// In-memory (great for tests): omit `dataDir`, or pass \"memory://\".\n// Durable: pass a filesystem directory.\nconst kernel = createPGliteKernel({ schema, dataDir: \".fakebase/pg\" });\nconst supabase = createClient(kernel);\n\nconst { data } = await supabase.from(\"notes\").select(\"*\");\n```\n\n`createPGliteKernel` is synchronous and mirrors `createMemoryKernel` /\n`createSqliteKernel`. The WASM Postgres boots lazily; the **first query awaits\nreadiness** automatically, so you never need to `await` construction.\n\n## When to choose this adapter\n\n| Adapter                        | Backing store       | Native build     | Best for                                      |\n| ------------------------------ | ------------------- | ---------------- | --------------------------------------------- |\n| `@byronwade/adapter-memory`     | JS objects          | none             | unit tests, throwaway demos                   |\n| `@byronwade/adapter-json`       | JSON files          | none             | small durable prototypes, git-diffable data   |\n| `@byronwade/adapter-sqlite`     | SQLite (WAL)        | `better-sqlite3` | durable single-file persistence               |\n| **`@byronwade/adapter-pglite`** | **Postgres (WASM)** | **none**         | **maximum SQL fidelity before real Supabase** |\n\n## Behaviour & parity notes\n\nTo keep behaviour **identical across all adapters** (verified by the shared\ncontract suite in `@byronwade/test-utils`):\n\n- **RLS** is evaluated in JS via the shared `PolicyEngine` (not Postgres roles),\n  matching the other adapters. It is an approximation — verify against real\n  Postgres before relying on it.\n- **`uuid` and temporal columns are stored as `text`**, so the adapter accepts\n  the same lenient values as the others (e.g. non-UUID string ids, verbatim ISO\n  timestamps).\n- **Column defaults** (`gen_random_uuid()`, `now()`, literals) are applied in JS\n  at insert time; foreign-key constraints are omitted.\n- `jsonb`/`json` and `boolean` use their **native Postgres types** and round-trip\n  losslessly.\n- `rpc()` on the adapter throws a `CapabilityError`; database functions are\n  served by the kernel's local function registry.\n\n## API\n\n- `class PGliteAdapter implements FakebaseAdapter` — constructor takes\n  `{ dataDir?: string }` (filesystem path, `\"memory://\"`, or omit for in-memory).\n- `createPGliteKernel({ dataDir?, schema?, storageDir? })` — a fully wired kernel\n  (data + auth + storage + realtime + functions).\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-41342c90eb97f83e90967acb9291828c"}