● live · 247d

MTA Dashboard

Real-time LIRR and Subway tracking from live GTFS-realtime feeds

pythongtfspostgresqlreact

repository

python 74.4%tsx 17.1%typescript 7.7%css 0.6%dockerfile 0.2%

last commit 18d ago 0 commits 7d 56 30d 333 ytd

MTA feeds publish trip updates, vehicle positions, and service alerts in the GTFS-realtime protobuf format on 30-second refresh cycles. The backend runs a set of Python collectors that subscribe to those feeds continuously, reconcile incoming trip update fragments against the static schedule, and write the merged result into PostgreSQL with TimescaleDB for hypertable-based retention management.

Departure data is served by a FastAPI backend that joins live trip estimates against the static schedule to produce per-station departure boards with platform, track, and status annotations. The React SPA consumes a lightweight polling API and renders per-station views with countdown timers, branch color coding, and a compact stop-tracker diagram that shows a train's current position relative to all stops on its run.

The collector layer handles feed irregularities cleanly: trips that drop out of the feed mid-run are held in a pending state rather than immediately cleared, reducing flicker on the board when a feed momentarily stalls. Service alerts are parsed separately and surfaced as banner annotations on the affected stations.

Architecture

Three Python services run in Docker Swarm: a GTFS static importer that refreshes the schedule database on each published feed version, a realtime collector that polls the GTFS-RT endpoint and upserts trip updates, and the FastAPI application server. PostgreSQL with TimescaleDB manages both the schedule tables and the time-series departure estimates. The React frontend is a single-page app deployed as a static build behind Traefik.