talira

Embeddable Postgres: run a full Postgres database locally in WASM with reactivity and live sync

open sourceApache-2.0 OR PostgreSQLfree

PGlite is PostgreSQL compiled to WebAssembly and packaged as a TypeScript and JavaScript library, so a full Postgres runs inside a browser, Node.js or Bun with nothing else to install and no Linux virtual machine. It's under 3 MB gzipped, runs in memory or persists to the file system or IndexedDB, and loads extensions dynamically, including pgvector and PostGIS. Live queries, React and Vue hooks, a multi-tab worker and sync from a server Postgres make it an embedded app database, and its quick start-up suits unit tests with a fresh database each, local development and on-device RAG. Electric develops it.

Problems it solves

  • give each unit test its own fresh Postgres database without Docker
  • run Postgres inside my web app in the browser
  • a local-first app database with SQL that syncs with my server's Postgres
  • use Postgres for local development without installing it
  • vector search in the browser with pgvector

Features

  • full Postgres in WASM, under 3 MB gzipped
  • runs in browsers, Node.js and Bun
  • in-memory, file system or IndexedDB persistence
  • dynamic extensions including pgvector and PostGIS
  • live queries
  • React and Vue hooks
  • multi-tab worker
  • sync from a server Postgres
  • PGlite Socket for Postgres wire protocol clients
  • pg_dump tool

Alternatives

The same job

These do what PGlite does.

  1. SQLite Small. Fast. Reliable. Choose any three.
  2. RxDB A fast, local-first, reactive database for JavaScript applications

Compare PGlite with the top 3