Neon integrates with Vercel to create a fresh Postgres branch for every preview deployment. The branch is a copy-on-write fork of your production data, so previews see realistic data without touching production. The connection string is injected as an environment variable at build time.

How it works

When you connect a Neon project to Vercel through the Vercel-Managed or Neon-Managed integration, Vercel sends a webhook to Neon on each preview deployment. Neon creates a branch named after the Git branch (for example, preview/feature-auth) and exposes its connection string as DATABASE_URL in the preview environment.

Because Lakebase Postgres uses copy-on-write storage, the new branch starts with zero added storage. You're billed only for the delta as the branch diverges from its parent. Extra branches beyond your plan's allowance (10 on the Free and Launch plans, 25 on the Scale plan) cost $1.50/branch-month on paid plans, prorated hourly at about $0.002/hour. See pricing details.

If you use Managed Better Auth, the integration also provisions an isolated auth instance per preview branch, so each preview has its own users and sessions.

Preview branches are deleted when their Vercel deployments are removed. Vercel's default deployment retention keeps previews for 6 months, so branches can linger unless you shorten retention or clean them up sooner. See Managing Vercel preview branch cleanup.

Running outside Vercel

For other platforms or custom CI, you can create branches with the Neon CLI inside your pipeline:

neon branches create --name preview/$GITHUB_HEAD_REF --parent main
neon connection-string preview/$GITHUB_HEAD_REF

See the GitHub Actions guide for a working example.

Clean up old branches

Set a time to live on preview branches so they delete automatically. This keeps your branch count and storage costs in check, especially when Vercel retention is long.

How other Postgres services compare

ServicePreview-branch mechanismStarts with production data?
NeonCopy-on-write branch per Git branch, created in seconds via the Vercel integration. See branching.Yes, by default
SupabasePreview branches spin up a full Supabase environment per PR through the GitHub or Vercel integration. Branches are not started with production data; you populate them from a seed.sql.No, seed-driven
AWS RDS for PostgresNo native per-PR database concept. Teams script pg_dump/restore or use snapshot-restore in CI, which can take minutes to hours depending on database size. See RDS backups.Yes, but provisioning is slow

Branching for previews on Neon is available on all plans (subject to branch limits). Supabase Branching adds Compute Hours per preview branch (starting at $0.01344/hr on Micro), with no production data copied unless you seed it (Supabase branching billing).

Try preview branching

Connect a Neon project to Vercel and get a database per preview deployment.