mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-05-13 02:26:22 +02:00
* feat(supply-chain): replace S&P Global with 3 free maritime data sources Replace expensive S&P Global Maritime API with IMF PortWatch (vessel transit counts), CorridorRisk (risk intelligence), and AISStream chokepoint crossing counter. All external API calls run on Railway relay, Vercel reads Redis only. - Add 4 new chokepoints (10 total): Cape of Good Hope, Gibraltar, Bosphorus, Dardanelles - Add TransitSummary proto (field 14) with today counts, WoW%, 180d history, risk context - Add D3 multi-line chart (tanker vs cargo) with expandable chokepoint cards - Add crossing detection with enter+dwell+exit semantics, 30min cooldown, 5min min dwell - Add PortWatch seed loop (6h), CorridorRisk seed loop (1h), transit seed loop (10min) - Add canonical chokepoint ID map for cross-source name resolution - 177 tests passing across 6 test files * fix(supply-chain): address P2 review findings - Discard partial PortWatch pagination results on mid-page failure (prevents truncated history with wrong WoW numbers cached for 6h) - Rename "Transit today" to "24h" label (rolling 24h window, not calendar day) - Fix chart label from "30d" to "180d" (matches actual PortWatch query range) - Add 30s initial seed for chokepoint transits on relay cold start (prevents 10min gap of zero transit data) * feat(supply-chain): swap D3 chart for TradingView lightweight-charts Replace hand-rolled D3 SVG transit chart with lightweight-charts v5 canvas rendering for Bloomberg-quality time-series visualization. - Add TransitChart helper class with mount/destroy lifecycle, theme listener, and autoSize support - Use MutationObserver (not rAF) to mount chart after setContent debounce - Clean up chart on tab switch, collapse, and re-render (no orphaned canvases) - Respond to theme-changed events via chart.applyOptions() - D3 stays for other 5 components (ProgressCharts, RenewableEnergy, etc.) * feat(supply-chain): add geo coords and trade routes for 4 new chokepoints Cherry-pick from PR #1511: Cape of Good Hope, Gibraltar, Bosphorus, and Dardanelles map-layer coordinates and trade route definitions. * fix(supply-chain): health.js v2->v4 key + double cache TTLs for missed seeds - health.js chokepoints key was still v2, now v4 (matches handler + bootstrap) - PortWatch TTL: 21600s (6h) -> 43200s (12h), seed interval stays 6h - CorridorRisk TTL: 3600s (1h) -> 7200s (2h), seed interval stays 1h - Ensures one missed seed run doesn't expire the key and cause empty data
220 lines
6.9 KiB
Plaintext
220 lines
6.9 KiB
Plaintext
# ============================================
|
|
# World Monitor — Environment Variables
|
|
# ============================================
|
|
# Copy this file to .env.local and fill in the values you need.
|
|
# All keys are optional — the dashboard works without them,
|
|
# but the corresponding features will be disabled.
|
|
#
|
|
# cp .env.example .env.local
|
|
#
|
|
# ============================================
|
|
|
|
|
|
# ------ AI Summarization (Vercel) ------
|
|
|
|
# Groq API (primary — 14,400 req/day on free tier)
|
|
# Get yours at: https://console.groq.com/
|
|
GROQ_API_KEY=
|
|
|
|
# OpenRouter API (fallback — 50 req/day on free tier)
|
|
# Get yours at: https://openrouter.ai/
|
|
OPENROUTER_API_KEY=
|
|
|
|
|
|
# ------ Cross-User Cache (Vercel — Upstash Redis) ------
|
|
|
|
# Used to deduplicate AI calls and cache risk scores across visitors.
|
|
# Create a free Redis database at: https://upstash.com/
|
|
UPSTASH_REDIS_REST_URL=
|
|
UPSTASH_REDIS_REST_TOKEN=
|
|
|
|
|
|
# ------ Market Data (Vercel) ------
|
|
|
|
# Finnhub (primary stock quotes — free tier available)
|
|
# Register at: https://finnhub.io/
|
|
FINNHUB_API_KEY=
|
|
|
|
|
|
# ------ Energy Data (Vercel) ------
|
|
|
|
# U.S. Energy Information Administration (oil prices, production, inventory)
|
|
# Register at: https://www.eia.gov/opendata/
|
|
EIA_API_KEY=
|
|
|
|
|
|
# ------ Economic Data (Vercel) ------
|
|
|
|
# FRED (Federal Reserve Economic Data)
|
|
# Register at: https://fred.stlouisfed.org/docs/api/api_key.html
|
|
FRED_API_KEY=
|
|
|
|
|
|
# ------ Aviation Intelligence (Vercel) ------
|
|
|
|
# AviationStack (live flight data, airport flights, carrier ops)
|
|
# Register at: https://aviationstack.com/
|
|
AVIATIONSTACK_API=
|
|
|
|
# ICAO API (NOTAM airport closures — optional, MENA region)
|
|
# Register at: https://applications.icao.int/
|
|
ICAO_API_KEY=
|
|
|
|
# Travelpayouts (flight price search — optional, demo only)
|
|
# Register at: https://www.travelpayouts.com/
|
|
TRAVELPAYOUTS_API_TOKEN=
|
|
|
|
|
|
# ------ Aircraft Tracking (Vercel) ------
|
|
|
|
# Wingbits aircraft enrichment (owner, operator, type)
|
|
# Contact: https://wingbits.com/
|
|
WINGBITS_API_KEY=
|
|
|
|
|
|
# ------ Conflict & Protest Data (Vercel) ------
|
|
|
|
# ACLED (Armed Conflict Location & Event Data — free for researchers)
|
|
# Register at: https://acleddata.com/
|
|
#
|
|
# RECOMMENDED: Set email + password for automatic OAuth token refresh.
|
|
# ACLED access tokens expire every 24 hours; with these credentials,
|
|
# the server will automatically exchange them for a fresh token.
|
|
#
|
|
# SECURITY NOTE: These credentials are stored in plaintext in .env.local.
|
|
# This is an acceptable trade-off for a self-hosted dashboard because:
|
|
# (a) .env.local is gitignored and never committed,
|
|
# (b) ACLED accounts are free and grant read-only API access,
|
|
# (c) the alternative (manual token rotation every 24 h) is impractical.
|
|
# If this is a concern for your deployment, use ACLED_ACCESS_TOKEN instead
|
|
# and manually refresh the token daily.
|
|
ACLED_EMAIL=
|
|
ACLED_PASSWORD=
|
|
#
|
|
# LEGACY: Static access token (optional fallback — expires after 24 h).
|
|
# Only needed if you prefer not to store email/password above.
|
|
# Generate at: https://acleddata.com/ → My Account → API Access
|
|
ACLED_ACCESS_TOKEN=
|
|
|
|
# UCDP (Uppsala Conflict Data Program — access token required since 2025)
|
|
# Register at: https://ucdp.uu.se/apidocs/
|
|
UCDP_ACCESS_TOKEN=
|
|
|
|
|
|
# ------ Internet Outages (Vercel) ------
|
|
|
|
# Cloudflare Radar API (requires free Cloudflare account with Radar access)
|
|
CLOUDFLARE_API_TOKEN=
|
|
|
|
|
|
# ------ Satellite Fire Detection (Vercel) ------
|
|
|
|
# NASA FIRMS (Fire Information for Resource Management System)
|
|
# Register at: https://firms.modaps.eosdis.nasa.gov/
|
|
NASA_FIRMS_API_KEY=
|
|
|
|
|
|
# ------ Railway Relay (scripts/ais-relay.cjs) ------
|
|
# The relay server handles AIS vessel tracking + OpenSky aircraft data + RSS proxy.
|
|
# It can also run the Telegram OSINT poller (stateful MTProto) when configured.
|
|
# Deploy on Railway with: node scripts/ais-relay.cjs
|
|
|
|
# AISStream API key for live vessel positions
|
|
# Get yours at: https://aisstream.io/
|
|
AISSTREAM_API_KEY=
|
|
|
|
# OpenSky Network OAuth2 credentials (higher rate limits for cloud IPs)
|
|
# Register at: https://opensky-network.org/
|
|
OPENSKY_CLIENT_ID=
|
|
OPENSKY_CLIENT_SECRET=
|
|
|
|
|
|
# ------ Telegram OSINT (Railway relay) ------
|
|
# Telegram MTProto keys (free): https://my.telegram.org/apps
|
|
TELEGRAM_API_ID=
|
|
TELEGRAM_API_HASH=
|
|
|
|
# GramJS StringSession generated locally (see: scripts/telegram/session-auth.mjs)
|
|
TELEGRAM_SESSION=
|
|
|
|
# Which curated list bucket to ingest: full | tech | finance
|
|
TELEGRAM_CHANNEL_SET=full
|
|
|
|
# ------ Railway Relay Connection (Vercel → Railway) ------
|
|
|
|
# Server-side URL (https://) — used by Vercel edge functions to reach the relay
|
|
WS_RELAY_URL=
|
|
|
|
# Optional client-side URL (wss://) — local/dev fallback only
|
|
VITE_WS_RELAY_URL=
|
|
|
|
# Shared secret between Vercel and Railway relay.
|
|
# Must be set to the SAME value on both platforms in production.
|
|
RELAY_SHARED_SECRET=
|
|
|
|
# Header name used to send the relay secret (must match on both platforms)
|
|
RELAY_AUTH_HEADER=x-relay-key
|
|
|
|
# Emergency production override to allow unauthenticated relay traffic.
|
|
# Leave unset/false in production.
|
|
ALLOW_UNAUTHENTICATED_RELAY=false
|
|
|
|
# Rolling window size (seconds) used by relay /metrics endpoint.
|
|
RELAY_METRICS_WINDOW_SECONDS=60
|
|
|
|
|
|
# ------ Supply Chain Intelligence (Vercel / Railway relay) ------
|
|
|
|
# CorridorRisk API (maritime corridor risk scoring — optional)
|
|
# Register at: https://corridorrisk.io/
|
|
CORRIDOR_RISK_API_KEY=
|
|
|
|
|
|
# ------ Public Data Sources (no keys required) ------
|
|
|
|
# UNHCR (UN Refugee Agency) — public API, no auth (CC BY 4.0)
|
|
# Open-Meteo — public API, no auth (processes Copernicus ERA5)
|
|
# WorldPop — public API, no auth needed
|
|
|
|
|
|
# ------ Site Configuration ------
|
|
|
|
# Site variant: "full" (worldmonitor.app) or "tech" (tech.worldmonitor.app)
|
|
VITE_VARIANT=full
|
|
|
|
# API base URL for web redirect. When set, browser fetch calls to /api/*
|
|
# are redirected to this URL. Leave empty for same-domain API (local installs).
|
|
# Production: https://api.worldmonitor.app
|
|
VITE_WS_API_URL=
|
|
|
|
# Client-side Sentry DSN (optional). Leave empty to disable error reporting.
|
|
VITE_SENTRY_DSN=
|
|
|
|
# Map interaction mode:
|
|
# - "flat" keeps pitch/rotation disabled (2D interaction)
|
|
# - "3d" enables pitch/rotation interactions (default)
|
|
VITE_MAP_INTERACTION_MODE=3d
|
|
|
|
# Self-hosted map tiles (optional — PMTiles on Cloudflare R2 or any HTTP server)
|
|
# Leave empty to use free OpenFreeMap tiles. Set to your own PMTiles URL for self-hosted tiles.
|
|
# See: https://protomaps.com/docs/pmtiles for how to generate PMTiles files.
|
|
VITE_PMTILES_URL=
|
|
# Public CORS-enabled URL for the same PMTiles file (used by Tauri desktop app).
|
|
# If your VITE_PMTILES_URL is behind a reverse proxy without CORS, set this to the
|
|
# direct R2/S3 public URL. The desktop app uses this URL; the web app uses VITE_PMTILES_URL.
|
|
VITE_PMTILES_URL_PUBLIC=
|
|
|
|
|
|
# ------ Desktop Cloud Fallback (Vercel) ------
|
|
|
|
# Comma-separated list of valid API keys for desktop cloud fallback.
|
|
# Generate with: openssl rand -hex 24 | sed 's/^/wm_/'
|
|
WORLDMONITOR_VALID_KEYS=
|
|
|
|
|
|
# ------ Registration DB (Convex) ------
|
|
|
|
# Convex deployment URL for email registration storage.
|
|
# Set up at: https://dashboard.convex.dev/
|
|
CONVEX_URL=
|