What is PGlite?
PGlite is PostgreSQL compiled to WebAssembly and wrapped in a TypeScript library, made by Electric, the company behind ElectricSQL sync. new PGlite() gives you an in-memory Postgres in a browser tab, Node, Bun or Deno with nothing else to install; pass a path and it persists to disk, or an idb:// name and it persists to the browser's IndexedDB. It does not boot a Linux virtual machine, as earlier browser Postgres projects did. It runs Postgres in its single-user mode, the one meant for bootstrapping and recovery, behind a JavaScript input and output layer, and the main package is about 3MB gzipped.
The extensions page lists 43 extensions: 33 Postgres contrib modules bundled in the main package, nine external ones installed as separate npm packages (pgvector at 42.9KB, pgmq, pgTAP, Apache AGE and PostGIS at 18.8MB among them) and a live-query plugin that re-runs a query when its data changes. Companion packages add React and Vue hooks, a multi-tab worker that lets several browser tabs share one database, a REPL component and pglite-socket, which lets psql or any Postgres driver connect over TCP.
Version 0.6.0, released on 23 November 2026, moved to PostgreSQL 19.0, four days after 0.5.17 had brought PostgreSQL 18.7. The code is Apache-2.0 (the docs also offer the PostgreSQL Licence), the repository has about 16,400 stars, and npm counted 39.6 million downloads of the main package in the week to 29 November 2026. The README still labels the project alpha.
Is PGlite worth it?
The single-connection design explains PGlite's strengths and its limits. Postgres normally forks a process per client, and WebAssembly cannot fork, so PGlite runs one Postgres backend inside your JavaScript process. You get the real planner, types, JSONB, full-text search and extensions such as pgvector, at a size that loads in a browser tab and starts without Docker. You also get one session at a time. Electric's Sam Willis called that the key limitation when PGlite reached the top of Hacker News in December 2025 with 605 points, and said the team plans to lift it.
For tests and development the trade is usually a good one. An in-memory database per test file means no shared container, no port clashes and no cleanup, and blog write-ups put the footprint as low as 8MB of memory against 256MB or more for a Postgres container. Code that opens a transaction and then queries on a second connection before committing will deadlock, though, and Hacker News commenters in that thread hit exactly that. Expect to fix some code as well as swap the connection string.
PGlite also sits under some AI tools. Supabase built database.build, its in-browser Postgres with an AI assistant, on PGlite, so every database it creates lives in the user's browser. With pgvector available as a 42.9KB extension package, PGlite can also hold embeddings for a small local retrieval index in a desktop or browser app, with no server involved. Supabase's own experience marks the ceiling: in December 2024 it shelved a serverless PGlite option because memory use in multi-tenant hosting was higher than expected and storage on s3fs proved unreliable.
pglite-socket, which lets ordinary clients connect, multiplexes them over the one connection, and its docs say not every use case is guaranteed to work. An open issue from October 2026 describes concurrent batches from two connections interleaving and a single internal error deadlocking the query queue for good. It also has no SSL, so binding it to 0.0.0.0 puts the database on the network unencrypted. The issue tracker has about 170 open issues and pull requests, with themes such as React Native support, OPFS storage, Jest and bundler errors, and out-of-bounds memory crashes.
Our take: at 39.6 million npm downloads a week, PGlite is now the usual way to give tests, prototypes and browser apps a real Postgres without running a server. Production use is reasonable where a single process owns the database, as in a desktop app, a CLI or a per-user browser store. For anything with concurrent writers, deploy actual Postgres and keep PGlite for the test suite.
Where it earns its place
A backend team of eight with a Node API on Postgres and a slow CI pipeline
Run integration tests against real Postgres without spinning up a database container for every job
Each test file creates new PGlite() in memory and applies migrations with .exec, or pglite-server --run "npm test" --include-database-url hands the suite a DATABASE_URL. Expect to rewrite tests that open a second connection inside a transaction, since those deadlock on one connection.
A developer building a local-first note app for the browser
Keep a user's data in the browser with SQL, live updates and optional sync
new PGlite('idb://notes') stores the database in IndexedDB, the live plugin re-renders React components when rows change, and the multi-tab worker stops two open tabs from fighting over the database. Sync through Electric is a separate product and a separate decision.
A small team shipping a desktop assistant that searches the user's own documents
Store embeddings and run similarity search on the user's machine without a database server
Load the pgvector extension into a file-backed PGlite in an Electron or Node process, write chunks and embeddings as rows and query with ORDER BY embedding <-> $1. It suits thousands of documents for one user; a large shared corpus belongs in a server database.
Before you commit
- Setup
- npm install @electric-sql/pglite (or bun, deno, or a jsDelivr import in the browser) and three lines of code give a working database in under a minute. External extensions are separate npm packages. Building the WASM module yourself needs Docker, Node 20+ and pnpm.
- Integrations
- node-postgres connection objects since v0.5.13; React and Vue hooks; live queries; multi-tab worker; pglite-socket for psql and standard drivers; Prisma, Drizzle, Kysely, Knex.js, TypeORM and Orange ORM per the docs; Nitro and Nuxt support documented in v0.5.16; sync through Electric.
- Data and privacy
- Runs entirely in your process; data stays in memory, on the filesystem or in the browser's IndexedDB, and nothing is sent anywhere unless you add sync. pglite-socket listens on 127.0.0.1 by default and has no SSL, so --host=0.0.0.0 exposes the database to the network unencrypted. Apache-2.0 or PostgreSQL Licence, both fine for commercial use.
- Cost at scale
- Free. The cost is memory and the single connection: one process per database, browser memory limits of a few gigabytes, and Supabase found multi-tenant hosting too memory-hungry to offer as a serverless product.
- Limits
- Single user and connection; transaction patterns that need a second connection deadlock; pglite-socket multiplexing is not guaranteed for every workload; README status is alpha; open issues include React Native support, OPFS storage, Jest compatibility and out-of-bounds memory errors.
What’s good
- Real Postgres with 43 extensions, including pgvector and PostGIS
- About 3MB gzipped; runs in browsers, Node, Bun and Deno
- In-memory, filesystem or IndexedDB storage from one constructor
- Tracks new Postgres releases closely; 19.0 arrived in November 2026
What’s not
- One connection at a time; some ordinary transaction patterns deadlock
- pglite-socket multiplexing has open deadlock bugs and no SSL
- Still labelled alpha after nearly three years
- Memory use made multi-tenant serverless hosting impractical for Supabase
Best for
JavaScript and TypeScript teams who want real Postgres in unit tests, browser demos, desktop apps or local-first web apps where one process owns the data.
PGlite alternatives
Where it fits in the AI stack
PGlite: common questions
- Is PGlite worth it?
- PGlite puts genuine Postgres, extensions included, anywhere JavaScript runs, which makes it excellent for tests, demos and local-first apps and the wrong choice for a server with many users. We rate it 4.3 out of 5.
- How much does PGlite cost?
- Free under Apache-2.0 or the PostgreSQL Licence; Electric's sync service is a separate product.
- What are the downsides of PGlite?
- One connection at a time; some ordinary transaction patterns deadlock; pglite-socket multiplexing has open deadlock bugs and no SSL; still labelled alpha after nearly three years; memory use made multi-tenant serverless hosting impractical for Supabase.
- Who is PGlite best for?
- JavaScript and TypeScript teams who want real Postgres in unit tests, browser demos, desktop apps or local-first web apps where one process owns the data.
- How much does PGlite cost for a team or in production?
- Free. The cost is memory and the single connection: one process per database, browser memory limits of a few gigabytes, and Supabase found multi-tenant hosting too memory-hungry to offer as a serverless product.
- Is PGlite safe for company data?
- Runs entirely in your process; data stays in memory, on the filesystem or in the browser's IndexedDB, and nothing is sent anywhere unless you add sync. pglite-socket listens on 127.0.0.1 by default and has no SSL, so --host=0.0.0.0 exposes the database to the network unencrypted. Apache-2.0 or PostgreSQL Licence, both fine for commercial use.
- What are the best PGlite alternatives?
- The closest alternatives we have reviewed are pgvector, LanceDB and Chroma.
Answers checked Nov 30, 2026.