Skip to main content
World Monitor is designed for seamless deployment to Vercel, leveraging serverless functions, edge configuration, and optimized caching strategies.

Deployment Configuration

The vercel.json file in the project root configures deployment behavior, security headers, caching policies, and rewrites.

Ignore Command

World Monitor uses an intelligent ignore command to skip deployments when only documentation or non-production files change:
vercel.json
This command:
  • Skips deployment if only Markdown files changed
  • Ignores changes to docs/, e2e/, scripts/, and .github/ directories
  • Allows full deployment for code changes

Security Headers

Content Security Policy (CSP)

World Monitor implements a strict Content Security Policy that allows necessary external resources while maintaining security:
vercel.json
Key security features:
  • X-Content-Type-Options: Prevents MIME-type sniffing
  • X-Frame-Options: Prevents clickjacking (SAMEORIGIN only)
  • HSTS: Forces HTTPS with 2-year max age and preload
  • Permissions-Policy: Blocks camera, microphone, and geolocation access
  • CSP: Strict policy allowing only trusted sources

Caching Strategy

HTML Pages - No Cache

vercel.json

Static Assets - Immutable

vercel.json

Service Worker - Revalidate

vercel.json

Other Resources

  • Favicons: max-age=604800 (7 days)
  • Manifest: max-age=86400 (1 day)
  • Offline page: max-age=86400 (1 day)

Rewrites

PostHog Analytics Proxy

Proxy PostHog requests through your domain to avoid ad blockers:
vercel.json
This rewrites /ingest/* requests to PostHog’s US servers while keeping them on your domain.

Build Configuration

Environment Variables

Configure these environment variables in your Vercel project settings:

Required

  • FRED_API_KEY - Federal Reserve Economic Data API key
  • CONVEX_DEPLOYMENT - Convex deployment URL
  • CONVEX_DEPLOY_KEY - Convex deployment key

Optional

  • VITE_VARIANT - Set to tech, finance, or happy for variant builds
  • SENTRY_DSN - Sentry error tracking DSN
  • POSTHOG_API_KEY - PostHog analytics key

Rate Limiting

  • UPSTASH_REDIS_REST_URL - Upstash Redis URL for rate limiting
  • UPSTASH_REDIS_REST_TOKEN - Upstash Redis token

Vercel CLI Commands

Preview Deployment

Production Deployment

Environment Variables

Logs

Serverless Functions

World Monitor uses Vercel Serverless Functions in the api/ directory:
  • api/[domain]/v1/[rpc].ts - Sebuf RPC gateway for data APIs
  • api/rss-proxy.js - RSS feed proxy with allowlist
  • api/fred-data.js - Federal Reserve economic data proxy

API Routes

All API routes are automatically deployed as serverless functions:

Performance Optimization

Brotli Compression

World Monitor pre-compresses assets with Brotli during build:
vite.config.ts

Code Splitting

Large dependencies are split into separate chunks:
vite.config.ts

Multi-Variant Deployment

Deploy different variants to separate Vercel projects:
Each variant:
  • Uses different branding and metadata
  • Loads variant-specific datasets
  • Applies custom theme colors
  • Serves from dedicated domains

Monitoring

Vercel Analytics

World Monitor integrates with Vercel Analytics:

Sentry Error Tracking

Troubleshooting

Build Failures

If the build fails:
  1. Check TypeScript errors: npm run typecheck:all
  2. Verify environment variables are set
  3. Clear Vercel cache: vercel build --force

Function Timeouts

Serverless functions have a 10-second timeout on Hobby plan, 60 seconds on Pro:
  • Optimize API calls with caching
  • Use edge functions for faster cold starts
  • Consider upgrading to Pro for longer timeouts

Large Bundle Size

If bundle size exceeds limits:
  1. Review chunk sizes: npm run build shows warnings
  2. Lazy-load large dependencies
  3. Exclude heavy ML models from main bundle

CSP Violations

If resources are blocked by CSP:
  1. Check browser console for CSP violations
  2. Add trusted domains to vercel.json CSP header
  3. Test locally with production build: npm run preview