Deployment Guide
Deploy OMOBL SSO to production on Vercel with PostgreSQL
Vercel
PostgreSQL
Production Ready
Before You Begin
Ensure you have accounts set up for:
- • Vercel - For hosting the application
- • Supabase/Vercel Postgres - For production database
- • Clerk - For authentication (production instance)
- • GitHub - For repository hosting
Choose Your Deployment Platform
Vercel (Recommended)
Optimized for Next.js applications
- Zero-configuration deployments
- Automatic SSL certificates
- Edge network CDN
- Integrated analytics
- Git-based workflow
Self-Hosted (Advanced)
Full control over infrastructure
- Complete infrastructure control
- Custom scaling strategies
- Requires DevOps expertise
- Manual SSL/security setup
- Infrastructure maintenance
Deploy to Vercel
1
Set Up Production Database
PostgreSQL Database
Option A: Vercel Postgres (Recommended)
- Go to your Vercel project dashboard
- Navigate to the "Storage" tab
- Click "Create Database" and select "Postgres"
- Copy the DATABASE_URL connection string
Option B: Supabase (Alternative)
- Create a new project at supabase.com
- Go to Project Settings → Database
- Copy the Connection String (Session mode for direct connections)
- Use Connection Pooling string for production
Make sure to use the connection pooling URL (port 6543 with
pgbouncer=true) for production to avoid connection limits.2
Configure Prisma for PostgreSQL
Update prisma/schema.prisma:
datasource db {
provider = "postgresql" // Change from "sqlite"
url = env("DATABASE_URL")
}Create a new migration for PostgreSQL:
npx prisma migrate dev --name init_postgresql3
Configure Environment Variables
Add the following environment variables in Vercel:
# Database
DATABASE_URL="postgresql://..."
# Clerk (Production Instance)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_live_..."
CLERK_SECRET_KEY="sk_live_..."
NEXT_PUBLIC_CLERK_SIGN_IN_URL="/sign-in"
NEXT_PUBLIC_CLERK_SIGN_UP_URL="/sign-up"
CLERK_WEBHOOK_SECRET="whsec_..."
# Application
NEXT_PUBLIC_APP_URL="https://www.omobl.com"
# Encryption (Generate a secure 32-character key)
ENCRYPTION_KEY="your-secure-32-character-key-here"
# Optional: Analytics
NEXT_PUBLIC_ANALYTICS_ID="your-analytics-id"Security Best Practices
- • Use Clerk production instance keys (pk_live_, sk_live_)
- • Generate a cryptographically secure ENCRYPTION_KEY
- • Never commit .env files to version control
- • Use different keys for staging and production
4
Deploy to Vercel
Method 1: Vercel CLI
npm install -g vercel
vercel login
vercel --prodMethod 2: GitHub Integration (Recommended)
- Push your code to GitHub
- Go to vercel.com/new
- Import your GitHub repository
- Configure build settings (Vercel auto-detects Next.js)
- Add environment variables
- Click "Deploy"
5
Run Database Migrations
After deployment, run migrations on production database:
DATABASE_URL="postgresql://..." npx prisma migrate deployOptionally, seed the database with initial data:
DATABASE_URL="postgresql://..." npx tsx prisma/seed.tsOnly run seed on a fresh database. Running seed multiple times will cause unique constraint errors.
6
Configure Clerk Webhooks
- Go to Clerk Dashboard → Webhooks
- Click "Add Endpoint"
- Set endpoint URL:
https://www.omobl.com/api/webhooks/clerk - Subscribe to these events:
- • user.created
- • user.updated
- • user.deleted
- • session.created
- • session.ended
- Copy the webhook signing secret
- Add it to Vercel environment variables as
CLERK_WEBHOOK_SECRET
7
Verify Deployment
Run the deployment verification script:
chmod +x scripts/verify-deployment.sh
./scripts/verify-deployment.shCheck these critical items manually:
- Application loads at production URL
- Sign up/sign in works correctly
- Database connections are stable
- Webhooks are receiving events
- SSL certificate is active
Production Checklist
Review before going live
- All environment variables set in Vercel
- Database migrations applied successfully
- Clerk webhooks configured and tested
- Custom domain configured (optional)
- Audit logging enabled and retention policy set
- Analytics aggregation cron job scheduled
- Master Admin account created
- Security headers configured
- Error monitoring set up (e.g., Sentry)
See DEPLOYMENT_CHECKLIST.md for complete list.
Next Steps
After successful deployment
- Set up Monitoring - Configure logging and error tracking
- Review Environment Variables - Complete environment configuration reference
- Security Best Practices - Harden your production deployment
- Troubleshooting Guide - Common deployment issues and solutions