DEV Community

Alex Spinov
Alex Spinov

Posted on

Neon Has a Free API That Gives You Serverless PostgreSQL With Branching

Neon is serverless PostgreSQL. Scales to zero, branches like git, generous free tier. Your database sleeps when inactive and wakes in <500ms.

Quick Start

import { neon } from '@neondatabase/serverless'

const sql = neon(process.env.DATABASE_URL!)

const users = await sql\`SELECT * FROM users WHERE active = true\`
const user = await sql\`INSERT INTO users (name, email) VALUES (${'John'}, ${'john@example.com'}) RETURNING *\`
Enter fullscreen mode Exit fullscreen mode

Database Branching

# Create a branch (instant copy of your database)
neon branches create --name feature/new-auth

# Each branch has its own connection string
# Test migrations without touching production
npx prisma migrate dev  # runs against branch

# Merge back (apply migrations to main)
neon branches merge feature/new-auth
Enter fullscreen mode Exit fullscreen mode

Free Tier

  • 0.5 GB storage
  • 191 compute hours/month (auto-suspend saves hours)
  • Branching included
  • Autoscaling included

Neon vs Supabase vs PlanetScale

Feature Neon Supabase PlanetScale
Database PostgreSQL PostgreSQL MySQL
Serverless Yes (scale to 0) No No (deprecated)
Branching Yes No Was yes
Free storage 0.5GB 500MB Discontinued
Edge Yes No Was yes

The Bottom Line

Neon is PostgreSQL for serverless. Scale to zero, branch like git, works at the edge. Best free tier for PostgreSQL in the serverless space.


Need to automate data collection or build custom scrapers? Check out my Apify actors for ready-made tools, or email spinov001@gmail.com for custom solutions.

Top comments (0)