close

DEV Community

Shivrajsinh Zala
Shivrajsinh Zala

Posted on

Stopwatch: How I Built a Sub-Second Transit Schedule Lookup for 123 Systems from Open GTFS Data

When you're rushing to catch a bus or train, you don't need a heavy 50MB map application that stalls on 3G connections. What you need is an instant, readable, stop-by-stop schedule: when is the next bus arriving, when is the last bus tonight, and what does the full day's service look like?

That challenge led me to create Stopwatch — a lightweight, instant public transit timetable lookup tool covering 123 transit networks across the United Kingdom, United States, Canada, Australia, Ireland, and New Zealand.

The entire codebase is open source on GitHub: shivrajsinhzala/transit-timetables.


Why Transit Schedules Need a Lightweight Alternative

Most transit agencies provide two options:

  1. Raw PDFs or Slow HTML Tables: Often buried three layers deep in municipal portals, poorly formatted for mobile viewports.
  2. Heavy Mapping Apps: Heavy routing calculators that consume battery, require background location tracking, and take 5–10 seconds to render when cellular reception is weak at an underground station or remote bus stop.

Stopwatch was architected specifically to bridge this gap: deliver clean, readable, full-day timetables with sub-second page loads on any device, fully accessible and offline-capable as a progressive web app (PWA).


Technical Highlights & Architecture

1. Ingestion of 123 GTFS Feeds

General Transit Feed Specification (GTFS) data is the global standard for public transit schedules. Stopwatch ingests static GTFS feeds across 123 agencies (from London buses and Sydney trains to Phoenix Valley Metro, Dublin Bus, Toronto TTC, and Auckland Transport).

  • Normalizes disparate agency stops, routes, service calendars, and trip stop times into a compressed schema.
  • Pre-calculates calendar exceptions (calendar_dates.txt) for accurate weekend, weekday, and public holiday departure tables.

2. Static Pre-Rendering & Edge CDN

  • Timetables are statically generated and cached at the edge, guaranteeing sub-100ms first contentful paint (FCP).
  • Zero tracking scripts, zero third-party telemetry, and zero bloat.
  • Built-in Service Worker caching allows commuters to check recently viewed lines even with zero cellular signal.

3. Phone-First Typography

Reading timetable matrices on small screens outdoors in harsh sunlight requires clear contrast, high typography standards, and clean hourly breakdowns rather than cramped desktop-oriented tables.


Explore Stopwatch & Source Code

Whether you commute daily or build open-source transit tools, feel free to explore the app, report issues, or contribute new agency feeds!

Top comments (1)

Collapse
 
officialmailkr profile image
오피셜메일 •

정적 시간표와 서비스 워커 캐시를 조합한 만큼, 이용자에게 데이터 갱신 시각과 오프라인 열람 여부를 함께 보여주면 좋겠습니다. 막차를 확인하는 상황에서는 예정 시간표인지 실시간 도착 정보인지도 분명해야겠어요. 공휴일 예외를 미리 계산하는 부분은 자정 이후 운행과 시간대 경계 사례까지 작은 테스트 데이터로 검증하면, 읽기 쉬운 화면과 별개로 시간표의 정확성도 점검하기 좋을 것 같습니다.