← Back to Documentation
Deployment Guide
Deploy Intrex to production using Vercel (recommended) or your preferred hosting platform.
Vercel (Recommended)
- ✓ Native Next.js support
- ✓ Built-in cron jobs
- ✓ Automatic scaling
- ✓ Edge network
- ✓ Preview deployments
Self-Hosted
- • Docker or PM2 deployment
- • Manual cron job setup
- • Configure reverse proxy
- • Manage SSL certificates
- • Self-managed scaling
Deployment Steps
1
Prepare Environment
- Set up production Supabase project
- Configure production environment variables
- Generate strong AUTH_SECRET (32+ chars)
- Configure SMTP for production email
2
Database Setup
- Run migrations: pnpm db:migrate
- Seed jurisdictions: pnpm db:seed
- Enable RLS policies on all tables
- Configure connection pooling
3
Vercel Deployment
- Push code to GitHub
- Import project in Vercel dashboard
- Add environment variables
- Configure build settings (Next.js default)
- Deploy and verify
4
Post-Deployment
- Verify SSL certificates are valid
- Test notification connectors
- Create admin user
- Configure cron jobs
- Set up monitoring
Production Environment Variables
| Variable | Importance | Description |
|---|---|---|
| POSTGRES_URL | Critical | Production database connection (use pooler) |
| AUTH_SECRET | Critical | JWT signing secret (32+ chars, generate new) |
| BASE_URL | Critical | Production domain URL (https://...) |
| PLATFORM_SMTP_HOST | Critical | Production SMTP server |
| PLATFORM_SMTP_PORT | Critical | SMTP port (587 or 465) |
| PLATFORM_SMTP_USER | Critical | SMTP username/email |
| PLATFORM_SMTP_PASS | Critical | SMTP password/app password |
| PLATFORM_EMAIL_FROM | Critical | Verified sender address |
| SENTRY_DSN | Recommended | Error monitoring (Sentry) |
| LOG_LEVEL | Recommended | Logging level (info/warn/error) |
| STRIPE_SECRET_KEY | Optional | If using Stripe billing |
| STRIPE_WEBHOOK_SECRET | Optional | Stripe webhook secret |
Production Security Checklist
Strong AUTH_SECRET generated (32+ chars)
Database RLS policies enabled
HTTPS enforced on all routes
Production SMTP configured
Cron jobs configured
Error monitoring enabled (Sentry recommended)
Database Configuration
# 1. Create production Supabase project
# Go to https://supabase.com and create new project
# 2. Get connection string (use connection pooler for serverless)
# Dashboard → Settings → Database → Connection Pooling
# 3. Run migrations
pnpm db:migrate
# 4. Verify RLS policies are enabled
# Dashboard → Database → Policies (should show policies for each table)Connection Pooling
For serverless deployments, always use the connection pooler URL (port 6543) instead of direct database connection. This prevents connection exhaustion.
Vercel Configuration
# vercel.json - Already included in project
{
"crons": [
{
"path": "/api/cron/ssl-scan",
"schedule": "0 */12 * * *"
},
{
"path": "/api/cron/process-notifications",
"schedule": "*/5 * * * *"
},
{
"path": "/api/cron/retries",
"schedule": "*/5 * * * *"
},
{
"path": "/api/cron/recurrence",
"schedule": "0 2 * * *"
}
]
}Post-Deployment Verification
Health Checks
- ✓ Landing page loads (200 OK)
- ✓ Sign-up page accessible
- ✓ API endpoints responding
- ✓ Database connection working
Feature Tests
- ✓ Can create admin account
- ✓ Branch creation works
- ✓ Email notifications send
- ✓ SSL monitoring runs
Monitoring & Alerts
Recommended Tools
- • Sentry - Error tracking
- • UptimeRobot - Availability
- • Supabase Dashboard - DB health
- • Vercel Analytics - Performance
Key Metrics
- • API response times
- • Database connection pool
- • Failed notification rate
- • SSL certificate expiry
Common Deployment Issues
Build fails on Vercel
Check Node.js version is 20+. Verify all env vars are set in Vercel dashboard.
Database connection errors
Verify POSTGRES_URL format. Check Supabase IP allowlist includes Vercel IPs (use 0.0.0.0/0 for testing).
Cron jobs not running
Verify vercel.json configuration. Check Vercel dashboard Cron section for job status.
Auth/session issues
Ensure AUTH_SECRET is 32+ characters. Check cookie settings (secure: true in production).
Emails not sending
Verify SMTP credentials. Check SMTP provider settings (Gmail needs app passwords).