Skip to main content

Overview

This guide covers deploying Pipeline to production using Vercel for the Next.js application and Supabase for the database.
Recommended Stack: Vercel (frontend) + Supabase Pro (database)

Pre-Deployment Checklist

Code Quality

1

All tests passing

npm test
Expected: 345/345 tests passing
2

No TypeScript errors

npm run typecheck
3

No ESLint warnings

npm run lint
4

Clean git state

git status
Should show “working tree clean”

Database

  • ✅ All migrations applied (supabase db push)
  • ✅ Rollback migrations tested
  • ✅ Database types generated and committed
  • ✅ RLS enabled on all tables

Security

  • ✅ No secrets in code (check .env is in .gitignore)
  • ✅ Environment variables configured
  • ✅ Service role key secured (server-only)
  • ✅ Rate limiting enabled

Step 1: Deploy Supabase Database

1.1 Create Supabase Project

1

Sign up for Supabase

Go to supabase.com and create an account
2

Create new project

  • Name: pipeline-production
  • Database Password: Generate strong password (save securely)
  • Region: Choose closest to your users (e.g., us-east-1)
  • Plan: Pro (recommended for production)
3

Wait for provisioning

Takes 2-3 minutes to provision the database

1.2 Get Project Credentials

Go to Settings → API:
  • Project URL: https://xxxxx.supabase.co
  • anon/public key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
  • service_role key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... ⚠️ Keep secret!
Go to Settings → Database:
  • Connection string: For direct access (optional)
  • Project Ref: 20-character ID (e.g., abcdefghijklmnopqrst)
# Install Supabase CLI
curl -fsSL https://supabase.com/install.sh | bash

# Login
supabase login

# Link to production project
supabase link --project-ref <your-project-ref>

# Verify link
supabase status

1.4 Apply Migrations

# Review migrations first
supabase migration list

# Push all migrations to production
supabase db push
Expected output:
Applying migration 001_tables.sql...
Applying migration 002_indexes.sql...
...
Applying migration 013_fulltext_search_weighting.sql...
Database pushed successfully.

1.5 Verify Database

# Generate types from production schema
supabase gen types typescript --project-ref <project-ref> > src/lib/types/database.types.ts

# Check for type drift
npm run typecheck
-- Connect to production database
psql -h db.<project-ref>.supabase.co -U postgres -d postgres

-- Check RLS status
SELECT tablename, rowsecurity 
FROM pg_tables 
WHERE schemaname = 'public';

-- All tables should show 't' (true)

Step 2: Deploy to Vercel

2.1 Prepare Repository

1

Push to GitHub

git add .
git commit -m "chore: prepare for production deployment"
git push origin main
2

Ensure .gitignore includes

.env
.env.local
.env.production
.env.*.local
.next/
node_modules/

2.2 Create Vercel Project

1

Sign up for Vercel

Go to vercel.com and sign up with GitHub
2

Import repository

  • Click “New Project”
  • Select your GitHub repository
  • Vercel auto-detects Next.js configuration
3

Configure build settings

  • Framework Preset: Next.js
  • Build Command: npm run build
  • Output Directory: .next (auto-detected)
  • Install Command: npm ci

2.3 Configure Environment Variables

Go to Settings → Environment Variables:
# Supabase Configuration (required)
NEXT_PUBLIC_SUPABASE_URL=https://<project-ref>.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

# App Configuration (required)
NEXT_PUBLIC_APP_URL=https://your-app.vercel.app

# Optional: AI Service
OPENAI_API_KEY=sk-...

# Optional: Discord Notifications
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
Set environment scope to Production, Preview, and Development as needed.

2.4 Deploy

1

Trigger deployment

Click “Deploy” in Vercel dashboard
2

Monitor build logs

Watch for any errors in the build process
3

Wait for deployment

Takes 2-5 minutes for initial deployment

Step 3: Post-Deployment Verification

3.1 Health Checks

curl https://your-app.vercel.app/

3.2 Database Connection

1

Test RLS enforcement

  • Create a test user account
  • Login and create a job
  • Verify job appears in dashboard
  • Logout and login as different user
  • Verify first user’s job is NOT visible
2

Test full-text search

  • Create jobs with various titles/descriptions
  • Use search functionality
  • Verify results are ranked correctly

3.3 Performance Metrics

Monitor these metrics in Vercel Analytics:

Core Web Vitals

  • LCP: < 2.5s
  • FID: < 100ms
  • CLS: < 0.1

API Latency

  • p95: < 500ms
  • p99: < 1000ms

Step 4: Configure Supabase Production Settings

4.1 Authentication Settings

Go to Authentication → Email Templates in Supabase:
  • Customize confirmation email
  • Customize password reset email
  • Add your branding/logo
Go to Authentication → URL Configuration:
Site URL: https://your-app.vercel.app

Redirect URLs:
- https://your-app.vercel.app/auth/callback
- https://your-app.vercel.app/**

4.2 Database Settings

Go to Settings → Database:
  • Enable Connection Pooling: ✅
  • Mode: Transaction (recommended)
  • Pool Size: Based on your plan (Pro: 100)
Supabase Pro includes automated daily backups:
  • Retention: 7 days
  • Point-in-time Recovery: Available
Manual backup (optional):
pg_dump -h db.<project-ref>.supabase.co -U postgres postgres > backup-$(date +%Y%m%d).sql

4.3 API Settings

Go to Settings → API:
  • CORS Origins: Add your production domain
  • Rate Limiting: Configure based on your plan
  • JWT Expiry: Default (1 hour) or custom

Monitoring & Observability

Vercel Analytics

Web Analytics

Real-time visitor analytics and Core Web Vitals

Runtime Logs

Function logs, errors, and performance metrics

Supabase Dashboard

Database Health

Monitor connection pool, query performance, table sizes

API Usage

Track API requests, bandwidth, and storage

Set Up Alerts

Go to Integrations in Vercel:
  • Slack: Deploy notifications
  • Discord: Error alerts
  • Sentry: Error tracking (optional)

Rollback Procedures

Quick Rollback (Vercel)

1

Open Vercel Dashboard

Go to Deployments tab
2

Find previous deployment

Locate the last known good deployment
3

Promote to production

Click “Promote to Production” on that deployment
Vercel keeps all previous deployments. Rollback is instant (no rebuild required).

Database Rollback

# Revert migration status
supabase migration repair <version> --status reverted

# Apply rollback migration
psql $DATABASE_URL < supabase/migrations/<version>.down.sql
# Restore from Supabase backup (via dashboard)
# Or restore from manual backup:
psql $DATABASE_URL < backup-20260225.sql

Environment Variables Reference

NEXT_PUBLIC_SUPABASE_URL
string
required
Your Supabase project URL (e.g., https://xxxxx.supabase.co)
NEXT_PUBLIC_SUPABASE_ANON_KEY
string
required
Supabase anonymous/public key (safe to expose to client)
SUPABASE_SERVICE_ROLE_KEY
string
required
Supabase service role key (bypasses RLS - keep secret!)
NEXT_PUBLIC_APP_URL
string
required
Your production app URL (e.g., https://your-app.vercel.app)
OPENAI_API_KEY
string
OpenAI API key for AI job matching (optional)
DISCORD_WEBHOOK_URL
string
Discord webhook for notifications (optional)

Deployment Checklist

Code & Tests

  • ✅ All tests passing (345/345)
  • ✅ No TypeScript errors
  • ✅ No ESLint warnings
  • ✅ Code committed and pushed

Database

  • ✅ Supabase project created
  • ✅ All migrations applied
  • ✅ RLS enabled on all tables
  • ✅ Database types generated
  • ✅ Backups enabled

Vercel

  • ✅ Project created and linked to GitHub
  • ✅ Environment variables configured
  • ✅ Build successful
  • ✅ Domain configured (if custom)

Post-Deploy

  • ✅ Health checks passing
  • ✅ Authentication working
  • ✅ RLS enforced (tested)
  • ✅ Monitoring configured
  • ✅ Alerts set up

Troubleshooting

Common causes:
  • Missing environment variables
  • TypeScript errors not caught locally
  • Node version mismatch
Solution:
# Run build locally
npm run build

# Check Node version matches Vercel
node --version  # Should be 18.x or 20.x
Symptoms:
  • 500 errors on API calls
  • “connection refused” in logs
Solution:
  • Verify NEXT_PUBLIC_SUPABASE_URL is correct
  • Check SUPABASE_SERVICE_ROLE_KEY is set
  • Test connection from Vercel function logs
Symptoms:
  • Users can’t see their own data
  • Empty results for all queries
Solution:
-- Check RLS is enabled
SELECT tablename, rowsecurity FROM pg_tables WHERE schemaname = 'public';

-- Check policies exist
SELECT policyname, cmd FROM pg_policies WHERE schemaname = 'public';

-- Test auth.uid() is set
SELECT auth.uid();
Solution:
# Regenerate types from production
supabase gen types typescript --project-ref <project-ref> > src/lib/types/database.types.ts

# Commit and redeploy
git add src/lib/types/database.types.ts
git commit -m "chore: sync database types"
git push

Next Steps After Deployment

Monitor Performance

Watch Vercel Analytics for Core Web Vitals and API latency

Set Up Monitoring

Configure error tracking (Sentry) and uptime monitoring

Enable Analytics

Integrate analytics (Plausible, PostHog) for user insights

Plan Scaling

Review database query performance and optimize indexes

Additional Resources

Vercel Docs

Official Vercel documentation

Supabase Docs

Official Supabase documentation

Next.js Deployment

Next.js deployment guide

Production Checklist

Comprehensive production checklist

Build docs developers (and LLMs) love