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:
Serverless functions: no persistent connections, best served by HTTP-based queries
Server mode: persistent connections via node-postgres
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/databasenpm i -D drizzle-kit
bun add drizzle-orm @netlify/databasebun add -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 platformconst db = drizzle();const result = await db.execute('select 1');
import { drizzle } from 'drizzle-orm/netlify-db';const db = drizzle(process.env.DATABASE_URL);const result = await db.execute('select 1');
import { drizzle } from 'drizzle-orm/netlify-db';// Explicit client — consumer controls the driverconst db = drizzle({ client: netlifyDbClient });const result = await db.execute('select 1');