Day 05 Day 5

Day 5

Day 5

~1 hour Intermediate Hands-on Precision AI Academy

Today's Objective

A live Next.js app deployed to Vercel with a production PostgreSQL database, environment variables configured, automatic deploys on push, and preview deployments for every PR.

A live Next.js app deployed to Vercel with a production PostgreSQL database, environment variables configured, automatic deploys on push, and preview deployments for every PR.

Prepare for Production

Before deploying, make sure your app is ready. Run the build locally to catch type errors, check that all env vars have examples, and make sure the database URL points to production.

terminal
BASH
# Run the production build locally
npm run build
# This catches TypeScript errors and missing imports

# Check that you have .env.example
cat .env.example
.env.example
TEXT
# Database
DATABASE_URL="postgresql://..."

# NextAuth
NEXTAUTH_URL="https://your-domain.com"
NEXTAUTH_SECRET="generate-with-openssl-rand-base64-32"

# GitHub OAuth
GITHUB_ID="your-github-client-id"
GITHUB_SECRET="your-github-client-secret"

Set Up a Production Database

SQLite doesn't work on Vercel (no persistent filesystem). Use Vercel Postgres (powered by Neon) for a free serverless PostgreSQL database.

vercel CLI
BASH
# Install Vercel CLI
npm install -g vercel
vercel login

# Create a Vercel Postgres database
vercel postgres create my-db
# This creates a PostgreSQL database and gives you the connection string

# Pull env vars from Vercel to your local .env
vercel env pull .env.local
prisma/schema.prisma (update datasource)
TEXT
datasource db {
  provider          = "postgresql"
  url               = env("POSTGRES_URL")
  directUrl         = env("POSTGRES_URL_NON_POOLING")
}
terminal
BASH
# Push schema to production database
npx prisma db push

Deploy to Vercel

Vercel detects Next.js automatically and configures the build settings. Connect your GitHub repo once and every push triggers a new deployment.

terminal
BASH
# Deploy from CLI
vercel --prod
# Your project is now at https://your-project.vercel.app

# Or connect via GitHub at vercel.com:
# 1. Import repository
# 2. Add environment variables
# 3. Deploy

# Set NEXTAUTH_SECRET
openssl rand -base64 32
# Copy output → Vercel Environment Variables → NEXTAUTH_SECRET

Preview deployments: Every pull request gets its own unique preview URL (like your-project-git-feature-username.vercel.app). Share it with teammates for review before merging.

Custom Domain and Performance

Add a custom domain and review Vercel's built-in analytics to understand your app's performance in production.

terminal
BASH
# Add custom domain via Vercel CLI
vercel domains add yourdomain.com

# Check deployment logs
vercel logs

# Inspect specific deployment
vercel inspect [deployment-url]

In your Vercel dashboard, enable Web Analytics (free) to see page views, Core Web Vitals scores, and geography. For production apps, check that all pages have a First Contentful Paint under 1.8 seconds.

Run Prisma migrations in production: Add "postinstall": "prisma generate" to your package.json scripts. For migrations (not just pushes), run npx prisma migrate deploy as part of your build step in Vercel's Build Command.

Go Further on Your Own

Course Complete!

You finished all 5 days. Ready to go deeper?

Course Progress
100%

Want live instruction and hands-on projects? Join the AI bootcamp — 3 days, 5 cities.

Course Complete

Completing all five days means having a solid working knowledge of Nextjs. The skills here translate directly to real projects. The next step is practice — pick a project and build something with what was learned.

Supporting Videos & Reading

Go deeper with these external references.

Day 5 Checkpoint

Before moving on, verify you can answer these without looking:

Live Bootcamp

Learn this in person — 2 days, 5 cities

Thu–Fri sessions in Denver, Los Angeles, New York, Chicago, and Dallas. $1,490 per seat. June–October 2026.

Reserve Your Seat →
Back to Course
Nextjs — Full Course Overview