Production
Deployment Guide
Deploy LearnHub to production using Vercel and Neon PostgreSQL for a fully serverless, scalable architecture.
Deploy to Vercel
Vercel provides the best deployment experience for Next.js applications.
Step 1: Connect Repository
- Go to vercel.com and sign in
- Click "Add New Project"
- Import your GitHub repository
- Select the
ai-lmsrepository
Step 2: Configure Build Settings
Vercel auto-detects Next.js. The build command is configured in vercel.json:
{
"framework": "nextjs",
"buildCommand": "prisma generate && next build",
"installCommand": "npm install"
}Step 3: Add Environment Variables
Add these environment variables in Vercel Dashboard → Settings → Environment Variables:
DATABASE_URLRequired
AUTH_SECRETRequired
AUTH_GOOGLE_IDOptional
AUTH_GOOGLE_SECRETOptional
AUTH_GITHUB_IDOptional
AUTH_GITHUB_SECRETOptional
OPENAI_API_KEYOptional
Step 4: Deploy
# Via CLI
vercel deploy --prod
# Or push to main branch for auto-deployDatabase Setup (Neon)
Neon provides serverless PostgreSQL that scales automatically.
Step 1: Create Neon Project
- Go to neon.tech and sign up
- Click "New Project"
- Enter project name (e.g.,
ai-lms) - Select a region close to your Vercel deployment
- Click "Create Project"
Step 2: Get Connection String
After creation, copy your connection string from the dashboard:
postgresql://username:password@ep-xxx-xxx-123456.us-east-2.aws.neon.tech/neondb?sslmode=requireStep 3: Initialize Database
Run these commands locally with your Neon DATABASE_URL:
# Set environment variable
export DATABASE_URL="your-neon-connection-string"
# Push schema to Neon
npm run db:push
# Seed with demo data
npm run db:seedEnvironment Configuration
Complete list of environment variables for production deployment.
# Database (Neon PostgreSQL)
DATABASE_URL="postgresql://..."
# NextAuth
AUTH_SECRET="random-32-character-secret"
AUTH_URL="https://your-app.vercel.app"
# OAuth (Optional)
AUTH_GOOGLE_ID="your-google-client-id"
AUTH_GOOGLE_SECRET="your-google-client-secret"
AUTH_GITHUB_ID="your-github-client-id"
AUTH_GITHUB_SECRET="your-github-client-secret"
# AI Features (Optional)
OPENAI_API_KEY="sk-your-openai-api-key"
OPENAI_BASE_URL="https://api.openai.com/v1"
# File Storage (Optional)
BLOB_READ_WRITE_TOKEN="your-vercel-blob-token"
# Email (Optional)
RESEND_API_KEY="re_your-resend-api-key"Deployment Checklist
Create Neon database project
Copy Neon connection string
Add DATABASE_URL to Vercel
Generate AUTH_SECRET (32+ chars)
Add AUTH_SECRET to Vercel
Run npm run db:push locally
Run npm run db:seed locally
Deploy to Vercel
Test login with demo accounts
(Optional) Configure OAuth providers
(Optional) Add OpenAI API key