← Back to Docs
Recipe

Vercel Postgres

Serverless Postgres provisioned inside your Vercel dashboard — zero cold starts, built-in connection pooling, and per-branch databases for preview deployments.

Provision

From your Vercel project, navigate to the Storage tab and click Create Database. Select Postgres, pick your region, and Vercel injects the following environment variables automatically:

  • POSTGRES_URL — full connection string
  • POSTGRES_PRISMA_URL — pooled variant for Prisma
  • POSTGRES_URL_NON_POOLING — direct, for migrations

Connect with @vercel/postgres

npm install @vercel/postgres
import { sql } from '@vercel/postgres'

const { rows } = await sql`SELECT * FROM users`

The SDK reads POSTGRES_URL automatically. No manual pool configuration required — Vercel handles keep-alive and connection reuse across serverless invocations.

Migrations

Use the non-pooling URL for schema changes. With Prisma:

DATABASE_URL="${POSTGRES_URL_NON_POOLING}" npx prisma migrate deploy