Build Variants
World Monitor supports 4 build variants from a single codebase:| Variant | Environment Variable | Production URL | Focus |
|---|---|---|---|
| Full | VITE_VARIANT=full | worldmonitor.app | Geopolitics, military, conflicts |
| Tech | VITE_VARIANT=tech | tech.worldmonitor.app | AI/ML, startups, cloud |
| Finance | VITE_VARIANT=finance | finance.worldmonitor.app | Markets, trading, central banks |
| Happy | VITE_VARIANT=happy | happy.worldmonitor.app | Good news, positive trends |
- Loads curated data layers and RSS feeds
- Uses variant-specific branding and metadata
- Shares the same codebase and build pipeline
Web Builds (Production)
Build All Variants
- Runs TypeScript type checking (
tsc) - Bundles assets with Vite
- Generates Brotli-compressed files (
.br) - Creates a service worker for PWA features
- Outputs to
dist/
Build Output
Preview Production Build
Build Configuration
Vite configuration (vite.config.ts):
-
Chunk splitting — Large dependencies are split into separate chunks:
deck-stack— deck.gl, luma.gl, loaders.gl, math.gl, h3-jsmaplibre— MapLibre GL JStransformers— Transformers.jsonnxruntime— ONNX Runtime Webd3— D3.jsi18n— i18nextsentry— Error trackinglocale-{lang}— Lazy-loaded translations
-
Brotli pre-compression — All
.js,.css,.html,.svg,.json,.wasmfiles > 1KB are pre-compressed with Brotli (.brextension) - Service worker — PWA features with offline map tile caching
Desktop Builds (Tauri)
Prerequisites
- Install Rust toolchain:
- Install platform-specific dependencies:
- macOS
- Windows
- Linux
Build Desktop App
- Syncs version from
package.jsonto Tauri config - Sets
VITE_VARIANTandVITE_DESKTOP_RUNTIME=1 - Builds the sidecar sebuf gateway
- Builds the Tauri app with Rust
Build Output
- macOS
- Windows
- Linux
Package and Sign (Release)
For distributable releases with code signing:scripts/desktop-package.mjs):
- Builds the Tauri app
- Signs the app bundle/installer
- Notarizes (macOS only)
- Creates a distributable package
Type Checking
Check Frontend
tsc --noEmit on the main TypeScript configuration.
Check API Handlers
tsc --noEmit -p tsconfig.api.json on server-side code.
Check Everything
Build Optimizations
Chunk Size Limits
The build is configured to warn for chunks larger than 1200 KB:Manual Chunk Splitting
- Heavy dependencies are loaded on-demand
- Browser can cache stable libraries separately
- Initial page load is faster
Tree Shaking
Unused exports are automatically removed during build:Brotli Compression
ThebrotliPrecompressPlugin generates .br files for all static assets:
.br files when the client sends Accept-Encoding: br.
Environment Variables
Build-Time Variables
These are embedded into the JavaScript bundle at build time:| Variable | Purpose | Example |
|---|---|---|
VITE_VARIANT | Build variant | full, tech, finance, happy |
VITE_DESKTOP_RUNTIME | Enable desktop features | 1 |
VITE_SENTRY_DSN | Error tracking | https://... |
VITE_POSTHOG_KEY | Product analytics | phc_... |
VITE_MAP_INTERACTION_MODE | Map controls | 3d or flat |
Runtime Variables (Server-Only)
These are available only in Vercel/serverless functions:| Variable | Purpose |
|---|---|
GROQ_API_KEY | AI summarization (Groq) |
OPENROUTER_API_KEY | AI summarization (OpenRouter) |
UPSTASH_REDIS_REST_URL | Cache backend |
UPSTASH_REDIS_REST_TOKEN | Cache authentication |
FINNHUB_API_KEY | Stock quotes |
EIA_API_KEY | Energy data |
ACLED_ACCESS_TOKEN | Conflict data |
WINGBITS_API_KEY | Aircraft enrichment |
.env.example for the complete list.
CI/CD Integration
Vercel Deployment
Production builds are deployed automatically on push tomain:
worldmonitor.app— Full varianttech.worldmonitor.app— Tech variantfinance.worldmonitor.app— Finance varianthappy.worldmonitor.app— Happy variant
GitHub Actions
Desktop builds are automated via GitHub Actions:Troubleshooting
Build fails with 'buf: command not found'
Build fails with 'buf: command not found'
Install buf CLI:
Type errors in generated code
Type errors in generated code
Regenerate proto code:
Desktop build fails with Rust errors
Desktop build fails with Rust errors
Update Rust toolchain:
Bundle size too large
Bundle size too large
Check which dependencies are bloating the bundle:
Service worker not updating
Service worker not updating
Clear service worker cache:
Next Steps
Testing
Run E2E, API, and regression tests
Deployment
Deploy to production