Skip to content

About

Public transit data collector, API, and frontend

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

1,057 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Train Status

Warning

This is a work in progress. Some features are still missing/broken and breaking changes will occur.

The best website to check the status of your train (and bus).

If you'd like to try a hosted version of the API, you can read the API Documentation. You can also host your own version using the prebuilt container images linked to this repository.

A realtime transit map is available at trainstat.us/map.

Features

  • Blazingly fast 😼😼😼😼
  • Real-time alerts and arrivals for various transit agencies
  • Works offline
  • Installable as a PWA
  • Shallow routing between modals so you never lose your place
  • Shareable links for your trip
  • Works on mobile and desktop
  • No ads or tracking (your geolocation data never leaves your device)
  • View transit data at a specific point in time
  • Simple JSON API that you can use to develop your own applications.
  • Automatic vector tile layers for spatial data using Martin.

Agencies Supported

Agency Status
MTA Subway ✅
MTA Bus ✅
NJT Bus ✅
NJT Rail 🚧
LIRR 🚧
MNR 🚧
  • ✅: Complete
  • ⚠️: Working on it
  • 🚧: Not started yet

Self Hosting

Note

You might need to restart the martin container on the first run so it picks up the tile functions installed by the baseline migrations.

Requirements

Production Setup

  1. Review and set the required environment variables listed in backend/README.md and frontend/README.md.
  2. Geo styles in geo/styles/*.json use relative URLs. Martin reads the X-Forwarded-Host/X-Forwarded-Proto headers to resolve the public URL, so make sure your reverse proxy forwards them (see the traefik service in demo.pod.yml).
  3. See demo.pod.yml for an example deployment with traefik.
  4. Copy demo.configmap.yml.example to demo.configmap.yml and fill in the required values.
  5. Launch it with mise demo. This starts the trainstatus-demo pod when it is not already running.

Local Development Setup

  1. Clone the repository
  2. Run mise bootstrap --only tools,task to install the tools and Git hooks.
  3. Set the environment variables as listed in backend/README.md inside a backend/mise.local.toml you create.
    • Non-sensitive variables like the DB URLs are already set in the root mise.toml.
  4. Within the backend/ directory, run mise bootstrap packages to install the required build dependencies for Valhalla and protobufs.
  5. You can pull the geo data and assets from ghcr or build them locally with mise //geo:build (it will take a while).
  6. Run mise //geo:export to export the Valhalla tile extract.
  7. Start Postgres and Martin with mise containers:up.
  8. Start the backend and frontend with mise dev. This starts the dev pod first when it is not already running.

mise containers:down stops the dev pod and keeps its volumes. mise reset deletes that pod and its volumes, then creates them again. Both commands take an optional suffix, dev by default: mise reset demo targets the trainstatus-demo pod from demo.pod.yml.

About

Public transit data collector, API, and frontend

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages