PostgreSQL
Drizby supports multiple PostgreSQL providers. Select the one that matches your setup.
Providers
Section titled “Providers”postgres.js (Recommended)
Section titled “postgres.js (Recommended)”Best for long-running Node.js servers.
Connection string:
postgresql://user:password@host:5432/database| Field | Example |
|---|---|
| User | admin |
| Password | secret |
| Host | localhost |
| Port | 5432 |
| Database | mydb |
node-postgres (pg)
Section titled “node-postgres (pg)”The classic pg driver.
Connection string:
postgresql://user:password@host:5432/databaseNeon Serverless
Section titled “Neon Serverless”For Neon serverless PostgreSQL.
Connection string:
postgresql://user:password@ep-cool-name-123456.us-east-2.aws.neon.tech/dbname?sslmode=requireGet your connection string from the Neon dashboard.
Supabase
Section titled “Supabase”For Supabase hosted PostgreSQL. Uses the postgres.js driver.
Connection string:
postgresql://postgres.[project-ref]:[password]@aws-0-[region].pooler.supabase.com:6543/postgresGet your connection string from Supabase → Settings → Database.
PGlite (Embedded)
Section titled “PGlite (Embedded)”An embedded PostgreSQL that runs in-process — no server required.
Connection string:
file:data/my-pg-dataData is stored on the local filesystem. Useful for development and testing.
AWS Data API
Section titled “AWS Data API”For Amazon RDS clusters accessed via the Data API. Uses structured connection fields.
| Field | Required | Description |
|---|---|---|
| Resource ARN | Yes | ARN of the RDS cluster |
| Secret ARN | Yes | ARN of the Secrets Manager secret |
| Database | Yes | Database name |
Amazon Aurora DSQL
Section titled “Amazon Aurora DSQL”For Amazon Aurora DSQL clusters. Uses token-based authentication with AWS credentials.
| Field | Required | Description |
|---|---|---|
| Host | Yes | Cluster endpoint |
| User | Yes | Username (typically admin) |
Requires AWS credentials configured in your environment.
Schema Definition
Section titled “Schema Definition”PostgreSQL schemas use pgTable and column types from drizzle-orm/pg-core:
import { pgTable, serial, text, integer, timestamp, real } from 'drizzle-orm/pg-core'
export const orders = pgTable('orders', { id: serial('id').primaryKey(), customerName: text('customer_name').notNull(), amount: real('amount'), quantity: integer('quantity'), createdAt: timestamp('created_at').defaultNow()})