DevOps
    August 5, 2026•4 min read

    Separate dev and production databases with Neon branches

    One database for everything works until your local experiments show up on the live site. How Neon branches give each environment its own copy for almost no effort.

    Anonymous
    Separate dev and production databases with Neon branches

    A Neon branch is a copy-on-write clone of your database with its own connection string. Creating one takes seconds, which makes a dedicated dev database an easy win.

    Create a branch

    SHELL
    1neonctl branches create --name dev
    2neonctl connection-string dev --pooled

    Put the dev connection string in .env.local. Next.js loads it ahead of .env, and so does the Payload CLI, so migrations and seeds target dev automatically:

    SHELL
    1# .env.local
    2DB_STORAGE_POSTGRES_URL=postgres://user:password@ep-dev-branch-pooler.neon.tech/neondb
    3BLOB_STORAGE_READ_WRITE_TOKEN=vercel_blob_rw_dev_token

    Don’t forget file storage

    A separate database is only half the job. If dev shares the production Blob store, deleting an image locally deletes it from the live site too.

    • Create a second Blob store for dev, with public access if your storage adapter requires it.
    • Keep production values in your host’s environment settings, not in a local file.
    • Gitignore every .env.* file except .env.example.
    #Neon
    #PostgreSQL
    #Next.js
    Share: