Infrastructure

Deployment Guide

Portable deployment configurations for Cloudflare, Vercel, DigitalOcean, and self-hosted environments.

Supported Platforms

Cloudflare Pages/Workers

Edge-first deployment with global CDN

  • Zero cold starts
  • Global edge network
  • Automatic HTTPS

Vercel

Optimized for Next.js applications

  • Preview deployments
  • Edge functions
  • Analytics built-in

DigitalOcean App Platform

Simple container-based deployment

  • Managed databases
  • Auto-scaling
  • Cost-effective

Self-Hosted (Docker)

Full control on your infrastructure

  • Complete ownership
  • Custom networking
  • On-premise option

CI/CD Pipeline

1

CI

Lint (ESLint)
Type check (tsc)
Unit tests (Vitest)
Security scan (Semgrep)
2

Staging

Build application
Run migrations
Deploy to staging
Run integration tests
3

Production

Approve deployment
Run migrations
Blue-green deploy
Health check

Environment Variables

# Database
DATABASE_URL="postgresql://user:pass@host:5432/db"

# Authentication
NEXTAUTH_SECRET="your-secret-key"
NEXTAUTH_URL="https://your-domain.com"

# Optional: External services
SENTRY_DSN="..."
ANALYTICS_ID="..."

Store secrets in your platform's secret management (Cloudflare Secrets, Vercel Environment Variables, etc.). Never commit secrets to git.

Database Migrations

# Generate migration from schema changes
yarn prisma migrate dev --name add_user_preferences

# Apply migrations in production
yarn prisma migrate deploy

# Reset database (development only)
yarn prisma migrate reset