Skip to content

ORM Support

Drizzle

Drizzle is a TypeScript ORM with support for many databases, including PGlite. Features include:

  • A declarative relational query API
  • An SQL-like query builder API
  • Migrations

To use PGlite with Drizzle, wrap you PGlite instance with a drizzle() call:

sh
npm i drizzle-orm @electric-sql/pglite
npm i -D drizzle-kit
ts
import { PGlite } from '@electric-sql/pglite';
import { drizzle } from 'drizzle-orm/pglite';

const client = new PGlite();
const db = drizzle(client);

await db.select().from(...);

See the Drizzle documentation for more details.