Kysely dialect for PGlite (Postgres WASM) that enables type-safe SQL queries in Node.js and the browser. Current stable version is 0.6.1. It wraps PGlite's embedded PostgreSQL via WebAssembly, allowing zero-config, in-memory or persisted databases. Unlike raw PGlite, it provides Kysely's query builder interface, integrates with live queries via KyselyLive, and includes a CLI for TypeScript type generation by running migrations or scanning a PGlite data directory.
npm install kysely-pgliteNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create an in-memory PGlite instance, define a table, insert data, and query using Kysely.
Always await KyselyPGlite.create() or ensure the constructor is only used after explicit setup.
Replace new KyselyPGlite() with await KyselyPGlite.create().
Generate types with npx kysely-pglite <path> --outFile ./types.ts, then import { DB } from './types'.Pass { extensions: { live: true } } to KyselyPGlite.create() options.Change to import { KyselyPGlite } from 'kysely-pglite'Install @electric-sql/pglite alongside kysely-pglite
Run schema.createTable('user', ...).execute() before inserting