DEV Community

niuniu
niuniu

Posted on

Quick Tip: Run Postgres for Free in 60 Seconds with Neon (Serverless, Scales to Zero)

Quick Tip

Still paying $15/month for a tiny RDS or Heroku Postgres instance that sits idle 90% of the time? Stop.

Neon gives you a serverless Postgres with a free tier that scales to zero — you pay nothing when nobody queries it. And it takes about 60 seconds:

# 1. Sign up at neon.tech (free, no credit card)
# 2. Create a project → copy the connection string
# 3. Done. Use it like any Postgres:
Enter fullscreen mode Exit fullscreen mode
import psycopg2

conn = psycopg2.connect(
    "postgresql://user:pass@ep-cool-name-123456.us-east-2.aws.neon.tech/mydb?sslmode=require"
)
cur = conn.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS hits (id serial PRIMARY KEY, ts timestamptz DEFAULT now())")
cur.execute("INSERT INTO hits DEFAULT VALUES RETURNING id")
print("Inserted row:", cur.fetchone())
conn.commit()
Enter fullscreen mode Exit fullscreen mode

Free Tier Numbers (vs. the "Cheap" Paid Options)

Neon free Heroku mini RDS db.t3.micro
Cost $0 $5/mo ~$15/mo
Storage 0.5 GB 1 GB 20 GB
Compute scales to 0 always on always on
Idle cost $0 full price full price
Branching (like git!)

The killer feature nobody expects: database branching. You can fork your entire production DB, test a migration on the branch, and delete it — in seconds, for free:

neonctl branches create --name test-migration
# run your migration against the branch, verify, delete
neonctl branches delete test-migration
Enter fullscreen mode Exit fullscreen mode

For side projects and MVPs this stack is hard to beat: Neon (DB) + Vercel/Cloudflare (hosting) + an AI coding assistant like MonkeyCode to glue it together — total monthly cost: $0.

What does your side-project stack cost per month? Genuinely curious who's found something cheaper than free.

Top comments (0)