Skip to content

jonerrr/trainstatus

Repository files navigation

Train Status

Warning

This is a work in progress. Some features are still missing/broken.

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 PostGIS tables generated by the sqlx migrations.

Requirements

Production Setup

  1. Review and set the required environment variables listed in backend/README.md and frontend/README.md.
  2. Geo styles are generated from geo/styles/*.json during the geo-assets image build. Unless you are using http://localhost:5173, you will need to build your own image with the correct domain.
    1. Set the STYLE_BASE_URLS arg when building geo/Dockerfile.assets to include your host URL(s) (comma-separated).
    2. Run mise //geo:build:assets to build the asset image.
  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. In demo.pod.yml, set martin.yml -> styles.sources.dark-matter to the matching generated filename (for example dark-matter.example-com.json).
  6. Launch it with mise demo.

Local Development Setup

  1. Clone the repository
  2. Run mise i to ensure all tools are installed
  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. You can pull the geo data and assets from ghcr or build them locally with mise //geo:build (it will take a while).
  5. Run mise //geo:export to export the valhalla config.
  6. Start the required services with mise start-containers.
  7. Once everything is up, start the backend and frontend with mise dev.

To stop and clean up the local dev pod, run podman kube down dev.pod.yml. You can also run mise //backend:reset-db to remove volumes created by the dev.pod.yml.

About

Public transit data collector, API, and frontend

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors