Neon — Serverless Postgres with Database Branching
Serverless PostgreSQL with instant database branching, autoscaling, and a generous free tier. Branch your database like git branches — test schema changes without touching production. 16,000+ stars.
What it is
Neon is a serverless PostgreSQL platform that separates compute from storage, enabling instant database branching, autoscaling to zero, and a generous free tier. You can branch your database like git branches: create an isolated copy of production data to test schema changes without touching the real database.
This tool targets developers and teams who need PostgreSQL with modern cloud-native features. It is especially useful for CI/CD pipelines where each test run needs its own database copy, and for preview environments where each PR gets a dedicated database.
How it saves time or tokens
Database branching eliminates the need to maintain separate staging databases or restore backups for testing. A branch is created in milliseconds via copy-on-write, regardless of database size. Autoscaling to zero means you pay nothing when the database is idle. The estimated token cost for the MCP configuration is around 2,600 tokens.
How to use
- Create a Neon account and project.
- Get your connection string from the Neon dashboard.
- Connect with any PostgreSQL client or ORM.
- Create branches for testing and development.
# Connect with psql
psql 'postgresql://user:pass@ep-xxx.us-east-1.aws.neon.tech/dbname'
# Create a branch via Neon CLI
neonctl branches create --name feature-auth
# Get connection string for the branch
neonctl connection-string feature-auth
# Delete branch when done
neonctl branches delete feature-auth
Example
Using Neon branches in a CI pipeline:
# GitHub Actions: create a branch per PR
steps:
- name: Create Neon branch
id: neon
uses: neondatabase/create-branch-action@v5
with:
project_id: ${{ secrets.NEON_PROJECT_ID }}
branch_name: pr-${{ github.event.number }}
api_key: ${{ secrets.NEON_API_KEY }}
- name: Run migrations
run: npx prisma migrate deploy
env:
DATABASE_URL: ${{ steps.neon.outputs.db_url }}
- name: Run tests
run: npm test
env:
DATABASE_URL: ${{ steps.neon.outputs.db_url }}
Each PR gets an isolated database branch with production data.
Related on TokRepo
- Database tools — More database management tools
- MCP integrations — PostgreSQL MCP server
Common pitfalls
- Neon is PostgreSQL-compatible but not all extensions are supported. Check extension availability before migrating from self-hosted Postgres.
- Branch creation is instant, but branches share the same compute endpoint by default. Simultaneous access to many branches may need endpoint configuration.
- The free tier has compute hour limits. Development branches left running consume hours even when idle. Use autoscaling to zero.
- Connection pooling behavior differs from traditional Postgres. Use Neon's built-in connection pooler for serverless workloads.
- Data in branches is a point-in-time snapshot. Changes to the parent branch after branching are not reflected in child branches.
Frequently Asked Questions
Database branching creates an isolated copy of your database using copy-on-write technology. The branch starts with all the data from the parent. Changes to the branch do not affect the parent. It works like git branches but for databases.
Yes. Neon is wire-compatible with PostgreSQL. Any PostgreSQL client, ORM, or tool works with Neon. It supports PostgreSQL 14, 15, and 16 with most popular extensions.
Neon offers a free tier with sufficient resources for development and small projects. Paid plans start at low monthly rates and scale with compute hours and storage. Autoscaling to zero means you only pay for active usage.
Yes. Neon is designed for production with high availability, point-in-time recovery, and autoscaling. Many companies run production databases on Neon. The platform handles failover and storage replication.
Branch creation takes milliseconds regardless of database size because it uses copy-on-write at the storage level. No data is physically copied until changes are made to the branch.
Citations (3)
- Neon GitHub— Neon serverless Postgres with database branching
- Neon Docs— Neon database branching documentation
- PostgreSQL Documentation— PostgreSQL wire protocol compatibility