PGlite ships Postgres compiled to WebAssembly in a TypeScript client. It runs in the browser, Node.js, Bun, and Deno without a separate database install.
Overview
PGlite is a compact WebAssembly build of PostgreSQL packaged as a TypeScript library. It lets applications run a real Postgres engine locally for prototyping, tests, or local-first data without standing up a full server process.
It can operate in memory or persist data to the filesystem on Node, Bun, and Deno, or to IndexedDB in the browser. The design uses Postgres single-user mode adapted for WASM rather than embedding a full Linux VM. Many extensions are supported, including pgvector and PostGIS, via dynamic loading.
Developers install it through npm or load it from a CDN. APIs cover in-memory and persistent setups. From recent releases it can expose a connection compatible with node-postgres clients. Documentation and interactive browser demos are published separately.
PGlite is single-connection only, which matters when planning concurrency. It targets reactive and real-time app patterns with built-in primitives for synchronization and live queries described in project materials.
Key features
- Postgres in WebAssembly under 3MB gzipped
- Browser, Node, Bun, Deno support
- In-memory or persistent storage
- pgvector and PostGIS extensions
- IndexedDB persistence in browsers
- node-postgres compatible connection
- Reactive query and sync primitives
- No separate Postgres daemon required
Use cases
- Local-first web apps with SQL
- Unit tests needing real Postgres
- Embedded analytics in the browser
- Prototyping without cloud databases