Drizzle <> Prisma Postgres

This guide assumes familiarity with:
  • Database connection basics with Drizzle
  • Prisma Postgres serverless database - website
  • Prisma Postgres direct connections - docs
  • Drizzle PostgreSQL drivers - docs

Prisma Postgres is a serverless database built on unikernels. It has a large free tier, operation-based pricing and no cold starts.

You can connect to it using either the node-postgres or postgres.js drivers for PostgreSQL.

Prisma Postgres also has a serverless driver that will be supported with Drizzle ORM in the future.

Step 1 - Install packages

node-postgres (pg)
postgres.js
npm
yarn
pnpm
bun
npm i drizzle-orm pg npm i -D drizzle-kit

Step 2 - Initialize the driver and make a query

node-postgres (pg)
postgres.js
// Make sure to install the 'pg' package  import { drizzle } from "drizzle-orm/node-postgres"; import { Pool } from "pg";  const pool = new Pool({  connectionString: process.env.DATABASE_URL, }); const db = drizzle({ client: pool });   const result = await db.execute('select 1');

What’s next?