On Vercel: connect an integration (recommended)
Both Supabase and Neon are one-click integrations in the Vercel marketplace. Either works — both have a free tier, both give you the pooled and direct connections the app needs.- Go to Vercel → your project → Integrations → Browse Marketplace.
- Add Supabase or Neon and create a database.
- Connect it to your project.
- Supabase / Vercel Postgres inject
POSTGRES_URL,POSTGRES_PRISMA_URL, andPOSTGRES_URL_NON_POOLING. - Neon injects
DATABASE_URLandDATABASE_URL_UNPOOLED.
- pooled URL →
DATABASE_URL(for route handlers) - direct URL →
DATABASE_URL_UNPOOLED(for migrations)
Self-managed Postgres (advanced)
If you’re hosting outside Vercel, or bringing your own database, set the two URLs yourself. You need one pooled connection and one direct (non-pooled) connection:Running migrations
Migrations use Drizzle Kit.vercel.json:
Connection URL resolution order
The app resolves database URLs in this order: Pooled (DATABASE_URL):
DATABASE_URLPOSTGRES_PRISMA_URLPOSTGRES_URL
DATABASE_URL_UNPOOLED):
DATABASE_URL_UNPOOLEDPOSTGRES_URL_NON_POOLING
Troubleshooting
DATABASE_URL_UNPOOLED is required during build
The migration runner needs a direct (non-pooled) connection. Set DATABASE_URL_UNPOOLED or attach Vercel Postgres storage which provides POSTGRES_URL_NON_POOLING.
Too many connections
Use the non-pooled URL only for migrations. Route handlers should use the pooled URL.