Ever wished you could git branch your database? Neon makes it real — create instant copy-on-write branches of your Postgres database for development, testing, and previews.
What Is Neon Branching?
Neon is serverless Postgres with a killer feature: database branching. Just like Git branches for code, you can create isolated database copies instantly — without duplicating data.
Free Tier
- 0.5 GiB storage included
- Unlimited branches (up to 10 active)
- 191.9 compute hours per month
- Autoscaling — scales to zero when idle
How Branching Works
# Create a branch from production
neonctl branches create --name dev/feature-auth
# Branch is instant — uses copy-on-write, no data duplication
# Your 50GB production database branches in < 1 second
The magic: Neon uses copy-on-write storage. A branch of a 50GB database takes zero additional storage until you modify data.
Real-World Workflows
1. Preview Environments
# In your CI/CD pipeline
- name: Create preview branch
run: |
BRANCH=$(neonctl branches create \
--name preview/${{ github.event.number }} \
--output json | jq -r '.connection_uri')
echo "DATABASE_URL=$BRANCH" >> $GITHUB_ENV
- name: Run migrations
run: npx prisma migrate deploy
- name: Deploy preview
run: vercel deploy --env DATABASE_URL=$DATABASE_URL
Every PR gets its own database with production data. Reviewers test against real data. Merge or delete — branches are free.
2. Safe Migrations
# Test migration on a branch first
neonctl branches create --name test/migration-v42
psql $BRANCH_URL -f migration-v42.sql
# Verify data integrity
psql $BRANCH_URL -c "SELECT count(*) FROM users"
# If good — apply to production
# If bad — delete branch, fix migration, try again
3. Development Isolation
Each developer gets their own branch. No more "who broke the dev database?" conversations.
Why Developers Love It
| Without Neon | With Neon |
|---|---|
| Seed scripts (30 min) | Branch from prod (1 sec) |
| Shared dev database | Isolated per developer |
| Test against fake data | Test against real data |
| Manual DB cleanup | Delete branch |
| Migration anxiety | Test on branch first |
Key Features Beyond Branching
- Autoscaling — scales compute up/down automatically
- Scale to zero — no charge when idle
- Point-in-time restore — recover from any moment
- Logical replication — sync with other Postgres instances
- pg_embedding — vector search built-in
Get Started
- Documentation
- Branching guide
- GitHub — 15K+ stars
Need to scrape data into your Neon database? My Apify actors extract structured data from any website — pipe it straight to Postgres. Questions? spinov001@gmail.com
Top comments (0)