Skip to content

Infrastructure Architecture

Infrastructure Architecture

Trystpilot deploys to Vercel (frontend + API routes) with a PostgreSQL database hosted on Railway or Supabase. Static assets are served from Vercel’s Edge Network CDN. The Cloudflare proxy layer sits in front for DDoS mitigation and additional WAF rules. Secrets are managed via Vercel environment variables (never committed). CI/CD runs on GitHub Actions with the pr-commit-comments.yml workflow already in place.

graph TD subgraph "DNS / Proxy Layer" CF_DNS["Cloudflare DNS\n+ WAF + DDoS protection"] end subgraph "CDN / Delivery" VE["Vercel Edge Network\n(global CDN, static assets)"] end subgraph "Compute (Vercel)" FN["Serverless Functions\n(API routes — Node.js 20)"] EM["Edge Middleware\n(rate limit, headers)"] end subgraph "Data Layer" PG[(PostgreSQL\nRailway / Supabase)] Redis[(Upstash Redis\nrate limiting — planned)] end subgraph "External Services" HC["hCaptcha API"] CF_Analytics["Cloudflare Analytics\nBeacon"] VA["Vercel Analytics"] end subgraph "CI/CD" GH["GitHub Actions\n(.github/workflows/)"] GH -->|deploy preview| VE GH -->|deploy prod| VE end Internet --> CF_DNS --> VE VE --> EM --> FN FN --> PG FN --> Redis FN --> HC VE --> CF_Analytics VE --> VA

Environment Separation

EnvironmentURLTrigger
Productiontrystpilot.xyzMerge to main
Preview*.vercel.appPR opened / updated
Developmentlocalhost:3000Local npm run dev

Secret Management

All secrets injected via Vercel Environment Variables per environment. Reference: .env.example — canonical list of required vars. Never committed to git.

VariableScope
DATABASE_URLProduction + Preview
ADMIN_SECRETProduction only
NEXT_PUBLIC_CF_ANALYTICS_TOKENAll
UPSTASH_REDIS_REST_URLProduction + Preview (planned)
HCAPTCHA_SECRETProduction + Preview (planned)

Scalability Considerations

  • Vercel auto-scales serverless functions — no manual provisioning
  • Database connection pool (lib/db/client.ts) limits max connections to prevent PG exhaustion
  • Upstash Redis provides global, low-latency rate limiting without sticky sessions
  • Static profile pages can be ISR-cached at the edge once traffic warrants it