Drizzle <> Netlify Database

This guide assumes familiarity with:
IMPORTANT

The Netlify Database driver is developed and maintained by the Netlify team.

Drizzle has native support for Netlify Database connections, that intelligently selects the optimal underlying Postgres driver based on the runtime environment.

Netlify Database is a managed Postgres database. On Netlify’s platform, the same application code runs in two very different contexts:

This adapter abstracts that decision away so consumers can write drizzle() once and get the right driver automatically.

Step 1 - Install packages

npm
yarn
pnpm
bun
npm i drizzle-orm@rc @netlify/database
npm i -D drizzle-kit@rc

Step 2 - Initialize the driver and make a query

Zero config
Connection string
Explicit client
import { drizzle } from 'drizzle-orm/netlify-db';

// Connection string is set automatically by the platform
const db = drizzle();

const result = await db.execute('select 1');

What’s next?