Every app that remembers anything needs a database. You do not need to pay for one yet. Neon gives you real Postgres for free, provisioned through the Vercel Marketplace in one command. This session gets you a working database in about twenty five minutes.
Neon is Postgres built around branches. A branch is a copy on write clone of your data, created instantly, and creating one never slows down or touches the original. The free tier gives you one branch, which is enough to build your first real project.
Provision it two ways. From the dashboard, open Storage, browse the Marketplace, and install Neon on the free plan. Or from a terminal, run vercel install neon, which provisions the database, connects it to your project, and pulls the credentials down for you automatically.
You get two connection strings. The pooled one, with pooler in its hostname, routes through a connection pooler and handles far more concurrent connections, use it for your app's normal queries. The unpooled, direct string is for anything that needs one long, native connection instead.
Pull those credentials into your project with one command. Vercel env pull downloads every environment variable the integration added, including your database URL, straight into a local file you can use for development. Confirm it is already in your git ignore.
Wire the database into your code so a missing connection never crashes your build. Check whether a database is configured before you use it, create the connection lazily on first use, and let routes that need it answer clearly instead of throwing an unhandled error.
Test the connection once before you build anything on top of it. Run psql against your database URL and ask for the server version; a real answer back means you are connected. No psql installed, use Neon's own dashboard SQL editor instead.
Know the free tier's edges before you rely on it. History for instant restore is six hours free, one day on paid plans, that is not a backup. Compute also sleeps when idle, so the first query after a quiet stretch takes a moment longer.
That is a real database, live, for free. You know how to provision it, which connection string to use and when, and where its free tier edges are. Session two turns this into migrations you can trust, instead of schema changes nobody remembers making.
Every app that remembers anything, a contact, a signup, a donation, needs a database. The instinct is to reach for a managed database add-on that bills monthly starting around fifteen dollars (DigitalOcean's basic managed Postgres tier lists at $15.15 a month; check current pricing before you assume that number holds), because that is what most tutorials show first. You do not need that yet. Neon is a real, production-grade Postgres database with a free tier generous enough for a small business or nonprofit's first year, and Vercel provisions it through its Marketplace in one command without you ever leaving your project. This lesson gets you a working Postgres database, wired into your app, in about twenty five minutes.
npm i -g vercelNeon is Postgres built around branching: a branch is a copy-on-write clone of your data that you can create instantly, work in isolation, and throw away, without touching the original. Neon's own documentation puts it plainly: creating a branch "does not increase load on the parent branch or affect it in any way." That branching model is what later sessions in this course lean on, for testing a migration safely and for keeping a preview deployment away from real data.
Neon is one of several databases available through the Vercel Marketplace, alongside Upstash Redis and Supabase, all provisioned the same way: one command, credentials injected into your project automatically.
Pick whichever fits how you already work.
The dashboard path. From your Vercel project, open the Storage tab, browse the Marketplace storage integrations, choose Neon, and install it. Pick the free plan, then connect it to your project.
The CLI path.
npm i -g vercel
vercel link
vercel install neon
vercel install neon installs the integration, provisions a Neon database, connects it to your linked project, and pulls the resulting credentials into .env.local for you. For a scripted setup with no interactive prompts:
vercel install neon --name my-database --plan free -e production
Session 3 of this course covers exactly which environments a database variable like this one should reach; for now, Production is enough to get moving.
Neon's connection details give you two strings. The default one has a -pooler suffix in its hostname: it routes through Neon's PgBouncer connection pooler, which supports far more concurrent connections than a direct connection, and it is what your app's normal runtime queries should use, especially from serverless functions that open and close connections constantly. Disable the "Connection pooling" toggle in the connection modal and you get the direct, unpooled connection string instead: standard port 5432, no pooler in front of it. Tools that need a native, long-lived connection (a migration runner holding a transaction open for a whole file, or pg_dump in session 5 of this course) should use the unpooled string, never the pooled one.
vercel env pull .env.local
This downloads the environment variables the integration added (DATABASE_URL and, depending on the integration, an unpooled variant alongside it) into a local file for development. Confirm .env.local is already in your .gitignore; never commit it.
A database call, and everything downstream of it, should fail gracefully when DATABASE_URL is not set, not crash your whole build. A teammate without a local database configured, or a deployment that intentionally has no database (more on that in session 3), should still be able to build and serve the pages that do not need one.
import { Pool } from 'pg'
let pool
export function hasDatabase() {
return Boolean(process.env.DATABASE_URL)
}
export function getPool() {
if (!pool) {
const connectionString = process.env.DATABASE_URL
if (!connectionString) {
throw new Error('DATABASE_URL is not set.')
}
pool = new Pool({ connectionString })
}
return pool
}
Check hasDatabase() before any route that needs the database, and answer something sensible (a 503, a friendly message) instead of letting an unhandled error reach a visitor.
psql "$DATABASE_URL" -c "select version();"
You should get back a real Postgres version string. No psql installed? Neon's dashboard has a built in SQL editor that runs the same query with nothing to install.
Neon's free plan gives you a six hour history window for instant restore and time travel queries, compared to one day on paid plans; that is a short-term undo button, not a backup (session 5 builds the real one). Compute also auto-suspends after a period of inactivity, so the first query after a quiet stretch takes a beat longer while it wakes back up; that delay is normal, not a bug. Exact numbers on storage and compute change, so check Neon's current plan page rather than trusting a figure printed here.
vercel install neon (or use the dashboard), then confirm it worked with vercel env ls.vercel env pull .env.local and confirm the file has a DATABASE_URL line in it.psql "$DATABASE_URL" -c "select version();" (or the Neon dashboard's SQL editor) and see a real Postgres version come back.vercel env ls shows a DATABASE_URL, .env.local has real credentials in it, and you have run one real query against your new database and seen a real answer, not an error.
Sources: https://neon.com/docs/introduction/branching, https://neon.com/docs/connect/connect-from-any-app, https://vercel.com/docs/storage, https://vercel.com/docs/marketplace-storage, https://vercel.com/docs/cli/install, https://www.digitalocean.com/pricing/managed-databases
Template included: Members get the provisioning checklist (dashboard and CLI), a pooled-versus-unpooled connection string cheat sheet, and the free tier edges to remember before you build on top of this. Find it in your member dashboard under "Templates."
Short on time? Agentic Quarks will implement this end to end, wired into your stack, and hand you the keys.
A free database, migrations you can trust, and a restore you have actually run
5 sessions, 145 minutes, 1 free.
One payment, no subscription, and a 14-day money back you trigger yourself from your account page. This course on its own is $99.