Neon
Serverless Postgres with branching
Serverless Postgres that separates storage and compute. Branch your database instantly, autoscale to zero, and only pay for what you use.
Neon is Postgres reimagined for the serverless era. It separates storage from compute, enabling instant database branches, autoscaling, and scale-to-zero. You get all the power of Postgres with modern cloud-native features.
Why Use Neon
Instant Database Branches: Create a full copy of your database in under a second, not minutes. Each git branch can have its own database branch. Test schema changes safely without cloning gigabytes of data.
Serverless Architecture: Compute and storage are separate. Your database can scale down to zero when not in use, and you only pay for storage. Perfect for side projects that sit idle most of the time.
True Postgres: It's real PostgreSQL, not a fork or wrapper. All your favorite Postgres features work - extensions, full-text search, JSON queries, everything.
Blazing Fast: Neon's architecture makes it faster than traditional Postgres for many workloads. Cold starts are measured in milliseconds, not seconds.
Key Features
- Database Branching - Create branches in under 1 second
- Autoscaling - Scale compute up/down automatically
- Scale to Zero - Pay nothing for idle compute
- Point-in-Time Restore - Restore to any point in last 7 days
- Connection Pooling - Built-in pooler for serverless functions
- Read Replicas - Add read replicas for high-traffic apps
- Postgres Extensions - pgvector, PostGIS, and more
- SOC 2 Compliant - Enterprise-grade security
- Instant Backups - Snapshots without copying data
Pricing for Solo Builders
Free Tier:
- 0.5 GB storage
- Unlimited compute hours (with limits)
- 1 project
- Autoscaling and scale-to-zero included
- Great for side projects and MVPs
Pro ($19/month):
- 10 GB storage included
- Unlimited projects
- Higher compute limits
- Point-in-time restore
- Advanced metrics
The free tier's scale-to-zero means your idle database costs $0 in compute. You only pay for storage. Perfect for solo builders.
Perfect For
- Serverless applications (Next.js, Vercel)
- Apps with variable traffic
- Development and staging environments
- Side projects that sit idle
- Testing schema changes safely
- Apps that need Postgres features
- Projects using Prisma or Drizzle
How Branching Works
# Install Neon CLI npm i -g neonctl # Create a branch from main neonctl branches create --name dev-feature # Each branch gets its own connection string # Use it in your .env file # Make schema changes, test your app # When ready, merge changes to main # Delete the branch when done neonctl branches delete dev-feature
Branches are copy-on-write, so they're created instantly and share storage until data diverges.
Code Example
// .env
DATABASE_URL="postgresql://user:pass@ep-xyz.us-east-2.aws.neon.tech/neondb"
// With Prisma
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
// Standard Postgres queries
const users = await prisma.user.findMany({
where: {
email: {
contains: '@gmail.com'
}
},
include: {
posts: true
}
})
// Or raw SQL
const result = await prisma.$queryRaw`
SELECT * FROM users
WHERE created_at > NOW() - INTERVAL '7 days'
`
Neon vs Supabase
Choose Neon if you:
- Only need a database (not auth/storage)
- Want instant branching for development
- Need scale-to-zero for cost savings
- Have variable or spiky traffic
- Want pure Postgres without extras
Choose Supabase if you:
- Need auth, storage, realtime in one platform
- Want row-level security built-in
- Prefer an all-in-one solution
- Need edge functions
- Want a visual database editor
Neon is focused purely on being the best Postgres. Supabase is a full backend platform. Both use Postgres, but Neon's branching and scale-to-zero are unique advantages.
Neon vs PlanetScale
Neon (Postgres) vs PlanetScale (MySQL):
Choose Neon if you:
- Prefer Postgres over MySQL
- Need Postgres-specific features (JSON, arrays, full-text search)
- Want scale-to-zero pricing
- Need instant branches
Choose PlanetScale if you:
- Need MySQL specifically
- Already use MySQL ecosystem
- Need massive horizontal scaling (millions of rows)
- Want zero-downtime schema migrations
Both have branching, but Neon's is faster (instant vs minutes). PlanetScale scales bigger. Choose based on SQL dialect preference.
Integration With Other Tools
Works perfectly with:
- Prisma - Excellent Postgres support
- Drizzle - Type-safe SQL builder
- Vercel - Automatic connection pooling
- Next.js - Perfect for API routes and server components
- PostGraphile - Auto-generate GraphQL API
Scale-to-Zero in Action
Traditional databases run 24/7. If your compute costs $0.10/hour, that's $72/month even when idle.
With Neon:
- Database used 2 hours/day = $6/month compute
- Database idle 22 hours/day = $0 compute
- Only pay for storage (~$0.15/GB/month)
Example: Side project with 1 GB database:
- Traditional Postgres: $72+ per month
- Neon Free Tier: $0 per month
- Neon Pro (if you exceed free tier): ~$19-25/month
Common Patterns
Development Branches:
# Create branch per feature neonctl branches create --name feature-auth # Use in your .env.local DATABASE_URL="..." # branch connection string # Test changes, then merge schema to main # Delete branch when done
Prisma Migrations:
# Run migrations on a branch first npx prisma migrate dev --name add_user_roles # Test thoroughly # Then run on production npx prisma migrate deploy
Connection Pooling for Serverless:
// Use the pooled connection string for serverless functions // DATABASE_POOLER_URL instead of DATABASE_URL // Handles many concurrent connections efficiently
Postgres Extensions
Neon supports popular extensions:
- pgvector - Vector similarity search (AI/embeddings)
- PostGIS - Geographic data
- pg_trgm - Fuzzy text search
- uuid-ossp - UUID generation
- hstore - Key-value store
Tips for Solo Builders
- Use pooled connection strings for serverless functions
- Create a branch for each feature/migration
- Enable autoscaling in project settings
- Use scale-to-zero for dev/staging databases
- Check the metrics dashboard to optimize queries
- Use connection strings from dashboard, don't construct manually
- Enable point-in-time restore for production
The Copy-on-Write Magic
Neon uses copy-on-write for branches. When you create a branch:
- New compute is provisioned (takes 1 second)
- Storage is shared with parent branch
- Only changed data is copied
- Branch has full database in under 1 second
This is why you can have 10+ branches without 10x storage costs.
Cold Starts
When your database scales to zero and someone makes a query:
- Neon: ~100-300ms to wake up
- Traditional RDS: Database is always running (or takes minutes to start)
Cold starts are fast enough for most applications. If you need instant responses 24/7, disable scale-to-zero.
When to Choose Something Else
Consider alternatives if you:
- Need MySQL (use PlanetScale)
- Need auth/storage/realtime (use Supabase)
- Need billions of rows (use PlanetScale + sharding)
- Want fully managed with zero config (use Supabase)
The Verdict
Neon brings git-like workflows to Postgres and makes serverless databases actually work. The branching is the fastest in the industry, and scale-to-zero saves real money for side projects.
If you need Postgres and value modern developer experience, Neon is a top choice. It's pure database focus means you'll need to add auth/storage elsewhere, but you get best-in-class Postgres with incredible DX.
The free tier is perfect for solo builders, and Pro pricing is reasonable when you outgrow it. For Postgres users, Neon is hard to beat.