NYC Transit Hub

A personal, non-commercial application providing real-time MTA transit information, reliability analytics, and accessibility-aware routing for New York City.

Real-Time Data
Open Source
Accessibility-First

Features

Live Arrivals

Real-time train arrival predictions for any subway station, updated every 30 seconds.

Live Tracker

Individual subway trips on maps and line diagrams, with between-stop geography clearly presented as an estimate.

Service Alerts

Current delays, planned work, and service changes with affected routes highlighted.

Crowding Estimates

Multi-factor crowding analysis combining headways, demand patterns, delays, and alerts.

Accessibility

Real-time elevator/escalator status and accessibility-aware trip planning.

Trip Planner

Point-to-point routing with real-time delay integration and accessibility options.

How It Works

1. Data Ingestion

MTA publishes real-time data via GTFS-Realtime feeds. We fetch subway, bus, LIRR, and Metro-North data every 30 seconds.

2. Processing

Protocol Buffer messages are decoded and parsed into structured data. Arrivals, alerts, and vehicle positions are extracted and cached.

3. Presentation

Clean, responsive UI displays the data with smart defaults. Server-side rendering ensures fast initial loads.

Tech Stack

Frontend

Next.js 16 – React framework with App Router
TypeScript – Type-safe development (strict mode)
HeroUI v2 – Modern React component library
Tailwind CSS v4 – Utility-first styling
Recharts – Data visualization

Backend

Next.js API Routes – Serverless API endpoints
Protobuf.js – GTFS-Realtime message parsing
PostgreSQL – Supabase-hosted database
Prisma – Type-safe database ORM
Zod – Runtime schema validation

Data Sources

MTA GTFS-Realtime – Subway, bus, LIRR, Metro-North feeds
Service Alerts API – Delays, planned work, changes
Elevator/Escalator API – Accessibility equipment status
Static GTFS – Station metadata and routes
OpenTripPlanner – Trip planning engine (MTA-hosted)

Quality & Testing

Vitest – Unit and component testing
React Testing Library – Component testing utilities
Playwright – End-to-end testing
ESLint – Code quality and style
TypeScript Strict – Maximum type safety

Crowding Algorithm

Our enhanced crowding system combines multiple real-time factors to estimate train crowding:

35%

Headway

Time between trains

35%

Demand

Time-of-day patterns

20%

Delays

Real-time delays

10%

Alerts

Service disruptions

Crowding is estimated, not measured. MTA does not provide real-time passenger counts.

Architecture


┌─────────────────────────────────────────────────────────────────┐
│                         NYC Transit Hub                          │
├─────────────────────────────────────────────────────────────────┤
│                                                                   │
│   ┌─────────────┐    ┌─────────────┐    ┌─────────────┐         │
│   │   Browser   │◄───│  Next.js    │◄───│   Vercel    │         │
│   │   (React)   │    │  App Router │    │   Edge      │         │
│   └─────────────┘    └──────┬──────┘    └─────────────┘         │
│                             │                                     │
│                             ▼                                     │
│   ┌─────────────────────────────────────────────────────────┐   │
│   │                    API Routes                            │   │
│   │  /api/trains  /api/alerts  /api/stations  /api/crowding │   │
│   └─────────────────────────┬───────────────────────────────┘   │
│                             │                                     │
│         ┌───────────────────┼───────────────────┐               │
│         ▼                   ▼                   ▼               │
│   ┌───────────┐       ┌───────────┐       ┌───────────┐         │
│   │   MTA     │       │  Supabase │       │   OTP     │         │
│   │ GTFS-RT   │       │ PostgreSQL│       │  (Trips)  │         │
│   └───────────┘       └───────────┘       └───────────┘         │
│                                                                   │
└─────────────────────────────────────────────────────────────────┘
              

Privacy

  • • No account required for basic features
  • • Favorites saved on this browser or device
  • • Location used for nearby transit only when requested
  • • No third-party tracking or analytics SDK
  • • Search and nearby requests are sent to the NYC Transit Hub backend

Open Source

This is a personal, non-commercial project. The source code is available on GitHub.

View on GitHub

Credits

Data provided by Metropolitan Transportation Authority (MTA)

Subway icons from mta-subway-bullets

Built with Next.js and HeroUI