PostgreSQL Setup in Drizzle ORM
From the Drizzle ORM cheat sheet · Database Setup · verified Jul 2026
PostgreSQL Setup
Connect to PostgreSQL using node-postgres or postgres.js drivers.
typescript
import { drizzle } from 'drizzle-orm/node-postgres';
import * as schema from './schema';
// Connection string — recommended
const db = drizzle(process.env.DATABASE_URL!, { schema });💡 Pass schema to drizzle() to enable relational queries
⚡ Use connection pooling (Pool) in production
📌 Install: npm i drizzle-orm pg @types/pg
🟢 postgres.js is recommended for serverless
setuppostgresqlconnection