DEV Community

Alex Spinov
Alex Spinov

Posted on

Neon Has a Free Postgres — Serverless Database With Branching, Auto-Scaling, and 512MB Storage

PostgreSQL is the best database for most applications. But hosting it yourself means managing backups, replication, connection pooling, and paying for an always-on server even when nobody is using your app.

Neon gives you serverless Postgres — it scales to zero when idle and wakes up in milliseconds. The free tier includes 512MB storage, branching, and their serverless driver.

What You Get for Free

  • 512 MB storage — enough for hundreds of thousands of rows
  • Serverless — scales to zero, no idle charges
  • Branching — git-like branches for your database
  • Connection pooling — built-in, no PgBouncer needed
  • Serverless driver — HTTP-based, works from edge functions
  • Point-in-time restore — 7-day history
  • Autoscaling — 0.25 to 2 CU on free tier
  • One project with 10 branches

Quick Start

1. Create a Database

Sign up at neon.tech, create a project, grab your connection string.

2. Node.js with Serverless Driver

npm install @neondatabase/serverless
Enter fullscreen mode Exit fullscreen mode
import { neon } from "@neondatabase/serverless";

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

// Create table
await sql`CREATE TABLE IF NOT EXISTS users (
  id SERIAL PRIMARY KEY,
  name TEXT NOT NULL,
  email TEXT UNIQUE NOT NULL,
  created_at TIMESTAMP DEFAULT NOW()
)`;

// Insert
await sql`INSERT INTO users (name, email) VALUES (${"Alex"}, ${"alex@example.com"})`;

// Query
const users = await sql`SELECT * FROM users WHERE name = ${"Alex"}`;
console.log(users);
Enter fullscreen mode Exit fullscreen mode

No connection pooling setup. Works in Vercel Edge, Cloudflare Workers, Deno Deploy.

3. Python

import psycopg2

conn = psycopg2.connect("postgresql://user:pass@ep-xyz.us-east-2.aws.neon.tech/mydb?sslmode=require")
cur = conn.cursor()

cur.execute("SELECT * FROM users WHERE email = %s", ("alex@example.com",))
users = cur.fetchall()

conn.close()
Enter fullscreen mode Exit fullscreen mode

4. Prisma ORM

// schema.prisma
datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model User {
  id    Int    @id @default(autoincrement())
  name  String
  email String @unique
}
Enter fullscreen mode Exit fullscreen mode
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();

const user = await prisma.user.create({
  data: { name: "Alex", email: "alex@example.com" },
});
Enter fullscreen mode Exit fullscreen mode

5. Database Branching (Killer Feature)

# Install CLI
brew install neonctl

# Create a branch from production
neonctl branches create --name staging --project-id YOUR_PROJECT

# Each branch gets its own connection string
# Test migrations on staging without touching production
# Merge when ready — like git for your database
Enter fullscreen mode Exit fullscreen mode

Branches are copy-on-write — creating a branch from a 100GB database takes milliseconds and costs nothing until you write new data.

Real-World Use Case

A developer running a SaaS on Vercel told me: "My RDS instance was costing $30/month just to sit there at night when nobody used the app. Switched to Neon free tier — it scales to zero at night, wakes up in 200ms on the first request. My database bill went from $30 to $0."

Free Plan Limits

Feature Free Tier
Storage 512 MB
Compute 0.25-2 CU
Branches 10
Projects 1
Point-in-time restore 7 days
Autosuspend After 5 min idle
Serverless driver Yes
Connection pooling Built-in

The Bottom Line

Neon is Postgres without the operations overhead. Scale to zero, branch like git, connect from edge functions. For side projects and early startups, the free tier is generous enough to get to production without spending a dollar.


Need to scrape data into your Postgres database? Check out my web scraping tools on Apify — extract data from any website and export as CSV for easy COPY INTO.

Building something custom? Email me at spinov001@gmail.com


More Free APIs You Should Know About

Top comments (0)