Skip to content

samwilsonSW/ChokepointMonitor

Repository files navigation

Chokepoint Monitor

🌐 Live Demo: chokepointmonitor.com

Deployed on Render FastAPI Svelte Supabase

A full-stack geospatial risk visualization tool that correlates armed conflict events with energy market data across three critical maritime oil chokepoints: the Strait of Hormuz, Bab el-Mandeb, and the Strait of Malacca.


What It Does

Chokepoint Monitor ingests conflict event data from ACLED and financial time-series data from Yahoo Finance, stores them in a PostGIS-enabled PostgreSQL database, and surfaces them through an interactive map with heatmaps, geofenced regions, and a financial correlation panel.

Chokepoint Daily Oil Flow Strategic Importance
Strait of Hormuz ~21M barrels Primary route for Middle East oil exports
Bab el-Mandeb ~5M barrels Connects Mediterranean via Suez Canal
Strait of Malacca ~16M barrels Primary route for Asian energy imports

Try It

  1. Explore the heatmap — Navigate to the Persian Gulf or Red Sea. Darker clusters = higher conflict density.
  2. Use the date slider — Filter events by time period (defaults to YTD, expands to 3-year history).
  3. Click a geofence — Click any chokepoint polygon to see conflict events within that region.
  4. Open the Insights panel — View financial correlation charts with risk metrics.
  5. Switch tickers — Try CL=F (WTI Crude), BZ=F (Brent), FRO (Frontline Tankers), or STNG (Scorpio Tankers).

Architecture

The backend is a FastAPI service backed by Supabase (PostgreSQL + PostGIS). Conflict data is ingested via a Python pipeline from ACLED exports; financial data is fetched daily from Yahoo Finance via a GitHub Actions cron job. The frontend is Svelte 5 with MapLibre GL for WebGL map rendering and D3.js for correlation charts.

A key design decision: recency weighting for the heatmap is computed client-side on every slider change, so visual density stays consistent whether you're viewing 3 months or 3 years of data — no server round-trip needed.


Tech Stack

Backend: FastAPI · PostgreSQL 15 + PostGIS · Supabase · Python · Uvicorn
Frontend: Svelte 5 · MapLibre GL · D3.js · Tailwind CSS · Skeleton UI
Infrastructure: Render · GitHub Actions (daily data pipeline) · Vite


Getting Started

Prerequisites

Quick Start

git clone https://github.com/samwilsonSW/ChokepointMonitor.git
cd ChokepointMonitor
npm run install:all
cp .env.example .env
# Add your SUPABASE_URL, SUPABASE_KEY, and MAPTILER_KEY to .env
npm run dev

Scripts

Command Description
npm run install:all Install Node + Python dependencies
npm run dev Run frontend + backend in parallel
npm run dev:frontend Svelte dev server only
npm run dev:backend FastAPI server only
npm run render:build Production build for Render
npm run render:start Production server for Render

What I Learned

My biggest takeaway here is that global energy market movements are impacted by a lot more than just conflict events. I happened to be finishing up this MVP during the first month of the US-Iran conflict and the events around the Strait of Hormuz, causing a good amount of correlation, but this seems to be the exception, not the rule.

Outside of financial takeaways, I learned that architecture and system design is an extremely important thing to think about when building a project. The pipelines for this project were draining, particularly because I didn't take the time prior to starting to whiteboard out a clean design for how data would flow through the system. Going forward, I will be much more thoughtful about these types of decisions before building them out.

The dead ends: I spent a week trying to get some sort of real-time data view early on, wanting to build something that felt responsive and impressive. This inevitably resulted in wasting a week trying to build something that wasn't worth the time, effort, or money for a project of this scale. I understand this now: Tradeoffs are important, and recognizing them saves time, effort, and mental well-being.

This project was my first big undertaking, and it's made me enjoy being a developer in a way I hadn't before. There are improvements that should be made, especially with the UI, and maybe I'll come back around and clean those up in the future. For now, I'm moving on to another project, one that doesn't make me feel as attached to one single hypothesis or idea.


Built by Sam Wilson

About

A maritime chokepoint analysis visualization - relating increases in prices of goods flowing through maritime chokepoints with civil and geopolitical conflicts near the chokepoints

Resources

Stars

Watchers

Forks

Contributors