The Metropolitan Transit Authority is the primary public transportation authority for the greater New York City region. It provides real-time information about its buses, subway trains, and track trains using a bundle of what are called GTFS-Realtime feeds. Each GTFS-RT feed represents a snapshot of a slice of the MTA's service jurisdiction at a certain timestamp.
This repository comprises a web application which uses MTA GTFS-Realtime data to surface relevant train trip information to users. It is dependent on the APIs defined in the and repositories.
This application is a proof-of-concept meant to demonstrate the utility of the ground-truth train arrival and departure
data provided by the
subway-explorer-api. It is also
You will need to have Node.JS installed and configured.
Clone this repository:
git clone https://github.com/ResidentMario/subway-explorer-webapp
Enter the root of your copy of the repository and install the required packages:
npm install --all
Set environment variables pointing to the
export GMAPS_PROXY_SERVICE_URI=localhost:9000 export SUBWAY_EXPLORER_SERVICE_URI=localhost:3000
Then generate the distribution from the source by running the following:
npm run-script build
Finally, the application can be served by running the following from the root folder:
npx http-server .
The application will fail if you do not also have the
running as well. For instructions on setting those up, see the
README.md in their respective repositories.
This application is still heavily a WIP. This quickstart is incomplete in the meantime!
Using the container
This repo contains a Docker file bundled with Node.JS and this application.
To build the container image, run the following from the root folder:
docker build -t residentmario/subway-explorer-webapp .
The container build process will, by default, assume that the two API services are exposed on localhost at ports 9000 and 3000, respectively. This is the default configuration, and what you will get if you follow the instructions in the
README files verbatim. If you're running the services someplace else, you can change where the application looks for them by running the following instead:
docker build . -t residentmario/subway-explorer-webapp:latest --build-arg GMAPS_PROXY_SERVICE_URI=URI:PORT SUBWAY_EXPLORER_SERVICE_URI=URI:PORT
URI:PORT with the locations and ports of your choosing.
Then, to run the container (pointing it to
docker run -p 8080:8080 -d residentmario/subway-explorer-webapp
You can visit the following URI in the browser to verify that the connection is being served:
You can also jump inside the container by running
docker exec -it 949cc5d81abe /bin/bash (replacing the name with the
name of the running image, discoverable via
docker ps) and inspect the running processes to verify things are running