PGlite packages a WebAssembly build of PostgreSQL into a lightweight TypeScript client that runs Postgres directly in the browser or on Node, Bun and Deno without extra dependencies. The core binary is about 3 MB gzipped and supports many Postgres extensions such as pgvector and PostGIS. It can run purely in memory or persist to IndexedDB in browsers and to the filesystem in server environments. Typical usage is to import the PGlite client, instantiate a database instance, and execute SQL queries just as with a normal Postgres session. PGlite emphasizes local-first, reactive and real-time workflows by embedding the full SQL engine inside application runtimes rather than relying on an external server.
Under the hood PGlite compiles PostgreSQL to WASM and leverages Postgres’s single-user mode because Emscripten-compiled programs cannot fork processes, so it operates as a single user/connection engine. Building requires Docker plus Node.js and pnpm; the build pipeline produces a WASM module and TypeScript packages, though prebuilt artifacts are published with CI for convenience. Contributors are asked to use the provided build and changeset workflows. The project is in alpha, dual-licensed under Apache 2.0 and the PostgreSQL license, and credits prior work by Stas Kelvich.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.