$ -weight: 500;">npm -weight: 500;">install @neondatabase/serverless
-weight: 500;">npm -weight: 500;">install @neondatabase/serverless
-weight: 500;">npm -weight: 500;">install @neondatabase/serverless
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"}, ${"[email protected]"})`; // Query
const users = await sql`SELECT * FROM users WHERE name = ${"Alex"}`;
console.log(users);
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"}, ${"[email protected]"})`; // Query
const users = await sql`SELECT * FROM users WHERE name = ${"Alex"}`;
console.log(users);
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"}, ${"[email protected]"})`; // Query
const users = await sql`SELECT * FROM users WHERE name = ${"Alex"}`;
console.log(users);
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", ("[email protected]",))
users = cur.fetchall() conn.close()
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", ("[email protected]",))
users = cur.fetchall() conn.close()
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", ("[email protected]",))
users = cur.fetchall() conn.close()
// schema.prisma
datasource db { provider = "postgresql" url = env("DATABASE_URL")
} model User { id Int @id @default(autoincrement()) name String email String @unique
}
// schema.prisma
datasource db { provider = "postgresql" url = env("DATABASE_URL")
} model User { id Int @id @default(autoincrement()) name String email String @unique
}
// schema.prisma
datasource db { provider = "postgresql" url = env("DATABASE_URL")
} model User { id Int @id @default(autoincrement()) name String email String @unique
}
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient(); const user = await prisma.user.create({ data: { name: "Alex", email: "[email protected]" },
});
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient(); const user = await prisma.user.create({ data: { name: "Alex", email: "[email protected]" },
});
import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient(); const user = await prisma.user.create({ data: { name: "Alex", email: "[email protected]" },
});
# Install CLI
-weight: 500;">brew -weight: 500;">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 -weight: 500;">git for your database
# Install CLI
-weight: 500;">brew -weight: 500;">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 -weight: 500;">git for your database
# Install CLI
-weight: 500;">brew -weight: 500;">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 -weight: 500;">git for your database - 512 MB storage — enough for hundreds of thousands of rows
- Serverless — scales to zero, no idle charges
- Branching — -weight: 500;">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 - 30+ Free APIs Every Developer Should Bookmark
- Upstash Has a Free Redis
- Resend Has a Free API
- PlanetScale — Serverless MySQL
- Algolia Has a Free Tier
- MongoDB Atlas Has a Free Tier
- Auth0 Has a Free Tier
- Cloudinary Has a Free API
- Firebase Has a Free Tier
- Supabase Has a Free Tier
- Stripe Has a Free API