Files
world/.env.example
Hanzo Dev 4a5d753642 world: native @hanzo/event telemetry — one client, subsumes Sentry + Umami
Converge world's client telemetry on the ONE canonical Hanzo Cloud front
door: pageviews, product events, and errors all leave through @hanzo/event
to POST /v1/event, lensed server-side into web analytics, product analytics,
and error tracking. This supersedes v2.4.47's fragmented client stack — the
third-party Sentry bundle and the direct analytics.hanzo.ai (Umami) page
script both fed lenses the /v1/event stream now feeds server-side, so loading
them client-side double-counted the same lenses.

- bootstrap/telemetry.ts: the one client. Framework-agnostic createAnalytics,
  brand-resolved host (hanzo/lux/zoo), IAM bearer injected at the composition
  root (else a write-only publishable key so the fail-closed door accepts
  logged-out ingest), consent gate (DNT / GPC / opt-out), SPA pageview on
  pathname change, and filtered global error capture that preserves the
  curated WebGL/map noise-filter verbatim.
- Product moments captured with the shared EVENTS vocabulary: country
  drill-down, map-layer toggle, variant switch, share, and the AI analyst
  chat funnel (start + per message). identify/group on the signed-in session.
- Remove @sentry/browser + bootstrap/sentry.ts; drop the Umami injection +
  track() from bootstrap/analytics.ts. GTM (marketing tags) stays — an
  orthogonal, env-gated concern @hanzo/event does not cover.

Logged-out marketing/public views load it too — anonymous, consent-gated.
typecheck + vite build + data tests green.
2026-07-22 22:45:44 -07:00

137 lines
4.1 KiB
Bash

# ============================================
# 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=
# ------ 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/
ACLED_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 and OpenSky aircraft data.
# 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=
# ------ Railway Relay Connection (Vercel → Railway) ------
# Server-side URL (https://) — used by Vercel edge functions to reach the relay
WS_RELAY_URL=
# Client-side URL (wss://) — used by the browser to connect via WebSocket
VITE_WS_RELAY_URL=
# ------ Public Data Sources (no keys required) ------
# UCDP (Uppsala Conflict Data Program) — public API, no auth
# UNHCR (UN Refugee Agency) — public API, no auth (CC BY 4.0)
# Open-Meteo — public API, no auth (processes Copernicus ERA5)
# WorldPop — public API, optional key for higher rate limits
# WORLDPOP_API_KEY=
# ------ Telemetry (Hanzo Cloud — @hanzo/event) ------
# Telemetry (pageviews, product events, errors) posts to api.hanzo.ai/v1/event,
# fanned server-side into web analytics, product analytics, and error tracking.
# Signed-in visitors are attributed by their IAM bearer automatically. To also
# accept LOGGED-OUT / anonymous traffic on the fail-closed door, ship a write-only
# publishable ingest key (pk_live_…). It is safe to bundle (cannot read, only
# ingest). Mint one per org via POST /v1/ingest/keys. Absent → anonymous events
# are best-effort (dropped by the door unless it allows unauthenticated ingest).
VITE_HANZO_INGEST_KEY=
# Google Tag Manager container id (marketing tags — GA / ad pixels). Orthogonal
# to the telemetry above; no-op until provisioned from KMS.
# VITE_GTM_ID=
# ------ Site Configuration ------
# Site variant: "full" (worldmonitor.app) or "tech" (tech.worldmonitor.app)
VITE_VARIANT=full
# Map interaction mode:
# - "flat" keeps pitch/rotation disabled (2D interaction)
# - "3d" enables pitch/rotation interactions (default)
VITE_MAP_INTERACTION_MODE=3d