Skip to content

Project: expand mta-js beyond NYC transit feeds #8

@gtokman

Description

@gtokman

Goal

Expand mta-js from an NYC/MTA-focused client into a small multi-agency urban rail/transit client, while preserving the current MTA API surface and Bun-first development workflow.

Why this matters

The repo already has a reusable GTFS-Realtime decoder and a hosted/static lookup model. Many US subway, metro, light rail, and rapid transit agencies expose GTFS static data, GTFS-Realtime protobuf feeds, or public REST APIs. We can add agencies incrementally by starting with agencies whose public feeds map cleanly to the existing arrivals, vehicles, alerts, stops.near, and route metadata concepts.

Implementation shape to investigate

  • Add an agency/provider layer instead of hardcoding every feed into MTA-specific config.
  • Keep MTA as a backwards-compatible export; consider a broader Transit or AgencyClient export for non-NYC systems.
  • Normalize shared outputs for arrivals, vehicle positions, alerts, routes, stops, and colors.
  • Support per-agency auth/config: API key headers, query params, no-auth GTFS-RT URLs, and hosted proxy endpoints.
  • Add fixtures for static GTFS zips and GTFS-RT protobuf responses so bun test can cover each adapter without live network calls.
  • Prioritize agencies with GTFS-RT first because src/gtfs-realtime.ts already decodes protobuf feeds.

Priority 1: requested systems

BART

  • Official developer docs: https://www.bart.gov/schedules/developers/api
  • GTFS/static data: https://www.bart.gov/schedules/developers/gtfs
  • Notes: BART exposes a legacy REST/XML API plus GTFS static and GTFS-Realtime resources. Good first non-MTA rail-only adapter because the network is compact and route/station concepts are clean.
  • Work to verify: realtime feed coverage for trip updates, service alerts, and vehicle positions; API key requirements for legacy endpoints.

Muni / SFMTA

MBTA

Washington, DC / WMATA

Los Angeles Metro

MARTA

  • Developer resources: https://www.itsmarta.com/app-developer-resources.aspx
  • Notes: MARTA publishes GTFS static data and public realtime resources. Small rail network, useful as an adapter test case after BART.
  • Work to verify: current rail realtime endpoint format, API key requirements, and whether bus/rail share the same API response schema.

SEPTA

  • Developer portal: https://www3.septa.org/developer/
  • TransitView and TrainView APIs: https://www3.septa.org/api/
  • Notes: SEPTA has public APIs plus GTFS resources. Coverage spans subway/elevated, trolley, bus, and regional rail, so adapter scope should start with rapid transit and expand carefully.
  • Work to verify: realtime subway/trolley support versus regional rail-specific APIs; consistent stop and route IDs across GTFS and API responses.

Priority 2: good additional candidates

CTA / Chicago L

PATH

NJ Transit

Miami-Dade Metrorail / Metromover

TriMet MAX / Portland

  • Developer portal: https://developer.trimet.org/
  • Notes: Public API with app ID, arrivals, vehicles, routes, and GTFS. Strong candidate for proving configurable auth/query-param support.

Sound Transit Link / Seattle

Denver RTD rail

Dallas DART rail

Shared references

Proposed milestones

  1. Research spike: confirm feed URLs, auth, licensing, realtime entity coverage, and update cadence for each Priority 1 agency.
  2. Adapter design: introduce provider config, normalized route/stop/arrival/vehicle/alert types, and backwards-compatible MTA exports.
  3. First adapter: BART or MBTA, chosen based on easiest live feed + static fixture setup.
  4. Bay Area adapter: add Muni/SFMTA via 511 after token handling and operator filtering are clear.
  5. Northeast/large systems: MBTA, WMATA, SEPTA, CTA.
  6. West/South systems: LA Metro, MARTA, Miami-Dade, TriMet, Sound Transit, DART, Denver RTD as verified.
  7. Docs/examples: show per-agency setup, required API keys, feed limitations, and normalized output examples.

Acceptance criteria

  • Existing MTA tests and public exports continue to pass.
  • Each added agency has documented feed URLs, auth requirements, and source links.
  • Each adapter has offline fixtures and bun test coverage for at least arrivals and alerts where data is available.
  • Agency-specific quirks are documented instead of hidden in generic code paths.
  • README includes a clear support matrix for static GTFS, trip updates, vehicle positions, alerts, auth, and known limitations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions