Prisma driver adapter for PGlite, the embedded PostgreSQL database for JavaScript. Version 0.7.2 is the latest stable release. This package allows using Prisma ORM with PGlite, enabling in-process PostgreSQL databases without a database server. It supports transactions, migrations, and is compatible with Node.js 18+, Bun, Deno, and edge runtimes. Ships TypeScript types. Peer dependencies include @electric-sql/pglite >=0.2.0 and @prisma/client >=7.1.0. A key differentiator is the ability to run Prisma with an embedded Postgres, ideal for testing, development, and serverless environments.
npm install pglite-prisma-adapterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows full setup: init PGlite, create adapter, instantiate PrismaClient, run basic create/findMany queries.
Update @prisma/client to version 7.1.0 or later.
Convert your project to ESM or use dynamic import().
Set datasource url to any valid PostgreSQL URL (e.g., postgresql://localhost:5432/mydb).
Ensure DATABASE_DIR points to a directory that exists or use a path that can be created.
Add previewFeatures = ['driverAdapters'] to generator client in schema.prisma.
Change const { PrismaPGlite } = require(...) to import { PrismaPGlite } from 'pglite-prisma-adapter'Update schema.prisma: generator client { provider = "prisma-client-js" previewFeatures = ["driverAdapters"] }Use prisma.$transaction(async (tx) => { ... }) instead of array form.Create the directory or set DATABASE_DIR to an existing writable path.