Elie Habib 0a4eff0053 feat(portwatch): split port-activity into standalone Railway cron + restore per-country shape (#3231)
Context: PR #3225 globalised EP3 because the per-country shape was
missing the section budget. Post-merge production log (2026-04-20)
proved the globalisation itself was worse: 42s/page full-table scans
(ArcGIS has no `date` index — confirmed via service metadata probe)
AND intermittent "Invalid query parameters" on the global WHERE.

Probes of outStatistics as an alternative showed it works for small
countries (BRA: 19s, 103 ports) but times out server-side for heavy
ones (USA: 313k historic rows, 30s+ server-compute, multiple
retries returned HTTP_STATUS 000). Not a reliable path.

The only shape ArcGIS reliably handles is per-country WHERE ISO3='X'
AND date > Y (uses the ISO3 index). Its problem was fitting 174
countries in the 420s portwatch bundle budget — solve that by giving
it its own container.

Changes:

- scripts/seed-portwatch-port-activity.mjs: restore per-country
  paginated EP3 with the accumulator shape from PR #3225 folded into
  the per-country loop (memory stays O(ports-per-country), not
  O(all-rows)). Keep every stabiliser: AbortSignal.any through
  fetchWithTimeout, SIGTERM handler with stage/batch/errors flush,
  per-country Promise.race with AbortController that actually cancels
  the work, eager p.catch for mid-batch error flush.
- Add fetchWithRetryOnInvalidParams — single retry on the specific
  "Invalid query parameters" error class ArcGIS has returned
  intermittently in prod. Does not retry other error classes.
- Bump LOCK_TTL_MS from 30 to 60 min to match the wider wall-time
  budget of the standalone cron.
- scripts/seed-bundle-portwatch.mjs: remove PW-Port-Activity from the
  main portwatch bundle. Keeps PW-Disruptions (hourly), PW-Main (6h),
  PW-Chokepoints-Ref (weekly).
- scripts/seed-bundle-portwatch-port-activity.mjs: new 1-section
  bundle. 540s section timeout, 570s bundle budget. Includes the
  full Railway service provisioning checklist in the header.
- Dockerfile.seed-bundle-portwatch-port-activity: mirrors the
  resilience-validation pattern — node:22-alpine, full scripts/ tree
  copy (avoids the add-an-import-forget-to-COPY class that has bit
  us 3+ times), shared/ for _country-resolver.
- tests/portwatch-port-activity-seed.test.mjs: rewrite assertions for
  the per-country shape. 54 tests pass (was 50, +4 for new
  assertions on the standalone bundle + Dockerfile + retry wrapper +
  ISO3 shape). Full test:data: 5883 pass. Typecheck + lint clean.

Post-merge Railway provisioning: see header of
seed-bundle-portwatch-port-activity.mjs for the 7-step checklist.
2026-04-20 15:21:43 +04:00

World Monitor

Real-time global intelligence dashboard — AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface.

GitHub stars GitHub forks Discord License: AGPL v3 TypeScript Last commit Latest release

Web App  Tech Variant  Finance Variant  Commodity Variant  Happy Variant

Download Windows  Download macOS ARM  Download macOS Intel  Download Linux

Documentation  ·  Releases  ·  Contributing

World Monitor Dashboard


What It Does

  • 435+ curated news feeds across 15 categories, AI-synthesized into briefs
  • Dual map engine — 3D globe (globe.gl) and WebGL flat map (deck.gl) with 45 data layers
  • Cross-stream correlation — military, economic, disaster, and escalation signal convergence
  • Country Intelligence Index — composite risk scoring across 12 signal categories
  • Finance radar — 92 stock exchanges, commodities, crypto, and 7-signal market composite
  • Local AI — run everything with Ollama, no API keys required
  • 5 site variants from a single codebase (world, tech, finance, commodity, happy)
  • Native desktop app (Tauri 2) for macOS, Windows, and Linux
  • 21 languages with native-language feeds and RTL support

For the full feature list, architecture, data sources, and algorithms, see the documentation.


Quick Start

git clone https://github.com/koala73/worldmonitor.git
cd worldmonitor
npm install
npm run dev

Open localhost:5173. No environment variables required for basic operation.

For variant-specific development:

npm run dev:tech       # tech.worldmonitor.app
npm run dev:finance    # finance.worldmonitor.app
npm run dev:commodity  # commodity.worldmonitor.app
npm run dev:happy      # happy.worldmonitor.app

See the self-hosting guide for deployment options (Vercel, Docker, static).


Tech Stack

Category Technologies
Frontend Vanilla TypeScript, Vite, globe.gl + Three.js, deck.gl + MapLibre GL
Desktop Tauri 2 (Rust) with Node.js sidecar
AI/ML Ollama / Groq / OpenRouter, Transformers.js (browser-side)
API Contracts Protocol Buffers (92 protos, 22 services), sebuf HTTP annotations
Deployment Vercel Edge Functions (60+), Railway relay, Tauri, PWA
Caching Redis (Upstash), 3-tier cache, CDN, service worker

Full stack details in the architecture docs.


Flight Data

Flight data provided gracefully by Wingbits, the most advanced ADS-B flight data solution.


Data Sources

WorldMonitor aggregates 65+ external data sources across geopolitics, finance, energy, climate, aviation, cyber, military, infrastructure, and news intelligence. See the full data sources catalog for providers, feed tiers, and collection methods.


Contributing

Contributions welcome! See CONTRIBUTING.md for guidelines.

npm run typecheck        # Type checking
npm run build:full       # Production build

License

AGPL-3.0 for non-commercial use. Commercial license required for any commercial use.

Use Case Allowed?
Personal / research / educational Yes
Self-hosted (non-commercial) Yes, with attribution
Fork and modify (non-commercial) Yes, share source under AGPL-3.0
Commercial use / SaaS / rebranding Requires commercial license

See LICENSE for full terms. For commercial licensing, contact the maintainer.

Copyright (C) 2024-2026 Elie Habib. All rights reserved.


Author

Elie HabibGitHub

Contributors

Security Acknowledgments

We thank the following researchers for responsibly disclosing security issues:

  • Cody Richard — Disclosed three security findings covering IPC command exposure, renderer-to-sidecar trust boundary analysis, and fetch patch credential injection architecture (2026)

See our Security Policy for responsible disclosure guidelines.


worldmonitor.app  ·  docs.worldmonitor.app  ·  finance.worldmonitor.app  ·  commodity.worldmonitor.app

Star History

Star History Chart
Description
Mirrored from GitHub
Readme AGPL-3.0 382 MiB
Languages
TypeScript 49.1%
JavaScript 47%
CSS 2.9%
HTML 0.4%
Rust 0.3%
Other 0.1%