Drizzle <> Netlify Database

This guide assumes familiarity with:
IMPORTANT

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

The Netlify Database driver is available in both drizzle-orm@latest and drizzle-orm@beta. We strongly recommend using the beta tag, as it has better support for Netlify’s platform-managed migrations

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 @netlify/database
npm i -D drizzle-kit

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?