Skip to main content

Build Variants

World Monitor supports 4 build variants from a single codebase: Each variant:
  • 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

Each build command:
  1. Runs TypeScript type checking (tsc)
  2. Bundles assets with Vite
  3. Generates Brotli-compressed files (.br)
  4. Creates a service worker for PWA features
  5. Outputs to dist/

Build Output

Preview Production Build

Starts a local server at http://localhost:4173 serving the 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-js
    • maplibre — MapLibre GL JS
    • transformers — Transformers.js
    • onnxruntime — ONNX Runtime Web
    • d3 — D3.js
    • i18n — i18next
    • sentry — Error tracking
    • locale-{lang} — Lazy-loaded translations
  • Brotli pre-compression — All .js, .css, .html, .svg, .json, .wasm files > 1KB are pre-compressed with Brotli (.br extension)
  • Service worker — PWA features with offline map tile caching

Desktop Builds (Tauri)

Prerequisites

  1. Install Rust toolchain:
  1. Install platform-specific dependencies:

Build Desktop App

Each command:
  1. Syncs version from package.json to Tauri config
  2. Sets VITE_VARIANT and VITE_DESKTOP_RUNTIME=1
  3. Builds the sidecar sebuf gateway
  4. Builds the Tauri app with Rust

Build Output

Package and Sign (Release)

For distributable releases with code signing:
The packaging script (scripts/desktop-package.mjs):
  1. Builds the Tauri app
  2. Signs the app bundle/installer
  3. Notarizes (macOS only)
  4. Creates a distributable package

Type Checking

Check Frontend

Runs tsc --noEmit on the main TypeScript configuration.

Check API Handlers

Runs tsc --noEmit -p tsconfig.api.json on server-side code.

Check Everything

Runs both frontend and API type checks.

Build Optimizations

Chunk Size Limits

The build is configured to warn for chunks larger than 1200 KB:
This is intentionally higher than Vite’s default (500 KB) because geospatial libraries (MapLibre, deck.gl) produce large bundles even when split.

Manual Chunk Splitting

This ensures:
  • 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

The brotliPrecompressPlugin generates .br files for all static assets:
Vercel/Cloudflare automatically serve .br files when the client sends Accept-Encoding: br.

Environment Variables

Build-Time Variables

These are embedded into the JavaScript bundle at build time:

Runtime Variables (Server-Only)

These are available only in Vercel/serverless functions: See .env.example for the complete list.

CI/CD Integration

Vercel Deployment

Production builds are deployed automatically on push to main:
Variants are deployed to separate domains:
  • worldmonitor.app — Full variant
  • tech.worldmonitor.app — Tech variant
  • finance.worldmonitor.app — Finance variant
  • happy.worldmonitor.app — Happy variant

GitHub Actions

Desktop builds are automated via GitHub Actions:

Troubleshooting

Install buf CLI:
Regenerate proto code:
Update Rust toolchain:
Check which dependencies are bloating the bundle:
Clear service worker cache:

Next Steps

Testing

Run E2E, API, and regression tests

Deployment

Deploy to production