Neon Postgres
Last updated December 18, 2025

Overview

Neon is a serverless PostgreSQL database that works seamlessly with Drizzle ORM. It's the default database provider in the scaffold, offering automatic scaling, branching, and zero-downtime migrations.

Create Project

  1. Go to neon.tech and sign up for an account
  2. Click "Create Project"
  3. Choose a project name and region (select closest to your users)
  4. Select PostgreSQL version (15 or 16 recommended)
  5. Click "Create Project"
  6. Wait for the database to be provisioned (usually takes ~30 seconds)

Get Connection String

  1. In your Neon project dashboard, you'll see a connection string displayed
  2. Click "Copy" next to the connection string
  3. The connection string looks like: postgresql://user:password@ep-xxx-xxx.region.aws.neon.tech/dbname?sslmode=require
  4. Important: This is your database password - store it securely. You can also reset it in "Settings" → "Password" if needed

Connection Pooling (Optional but Recommended): Neon also provides a pooled connection string for better performance with serverless functions. Look for the "Pooled connection" option in the dashboard.

Environment Variables

Add this variable to your .env.local file:

# Neon Postgres
DATABASE_URL="postgresql://user:password@ep-xxx-xxx.region.aws.neon.tech/dbname?sslmode=require"

Important:

  • Replace the connection string with your actual Neon connection string
  • For production, use environment variables in your hosting platform (Vercel, etc.)
  • Never commit .env.local to git (it's already in .gitignore)

Run Migrations

After setting DATABASE_URL, run the database migrations:

# Generate migrations from your schema
npx drizzle-kit generate

# Push migrations to your database
npx drizzle-kit push

This will create all the required tables (users, sessions, accounts, subscriptions, etc.) in your Neon database.

Alternative: Use Drizzle Studio (Optional) View and manage your database with Drizzle Studio:

npx drizzle-kit studio

This opens a local web interface to browse your database tables and data.

Testing

  1. Restart your dev server: npm run dev
  2. Navigate to http://localhost:3000/sign-up
  3. Create a test account
  4. Verify the user was created in your database (use Drizzle Studio or Neon dashboard)
  5. Sign in and verify sessions work correctly

Using Neon Dashboard:

  1. Go to your Neon project dashboard
  2. Click "SQL Editor"
  3. Run: SELECT * FROM user; to see created users

Troubleshooting:

  • If connection fails, verify the connection string is correct
  • Check that SSL mode is set to require in the connection string
  • Ensure your IP isn't blocked (Neon allows all IPs by default)
  • For serverless environments (Vercel), connection pooling is recommended