Setting up a GTFS Realtime Validator app
The GTFS Realtime Validator is a open-source tool that allows validating a GTFS Realtime feed given a matching GTFS Schedule file. By using both datasets, the validator can not only check the realtime feed's format, but also the quality of its data. It looks like this:

The run the validator on your machine, either fork our ready-made repository or follow this tutorial to build your own setup from scratch.
FYI the tool is maintained in MobilityData's gtfs-realtime-validator repository but it was originally created by an independent team. See their article Introducing the GTFS-realtime Validator.
Prerequisites
For this project, as for all projects here at MobilityDataDev, you'll need:
- a code editor (e.g. Visual Studio Code)
- Docker Desktop
- a folder (or repository) on your local machine.
That's it!
Creating the app
The official documentation provides two installation guides:
-
The first consists in installing Java and the webapp package, then running the command
java -jar {JAR file name}. -
The second uses Docker commands to either pull or build an image, then run it.
However, we're using a third approach: Docker Compose. This enables putting all the configuration in one file, including complimentary services that we'll get to in a second, then run it all in one single, simple command.
Docker Compose is a tool for defining and running multi-container applications. [It] simplifies the control of your entire application stack, making it easy to manage services, networks, and volumes in a single, comprehensible YAML configuration file. Then, with a single command, you create and start all the services from your configuration file. – Source
Here goes:
- Create a
./docker-compose.ymlfile at the root of your repository, containing the service definition for the validator:
services:
gtfs-rt-validator-service:
container_name: gtfs-rt-validator-container
image: ghcr.io/mobilitydata/gtfs-realtime-validator
ports:
- "8081:8080"
environment:
JAVA_OPTS: "-Xmx5g -XX:MaxMetaspaceSize5g"
-
Run
docker compose up. -
Open http://localhost:8081.
And just like that, the validator tool is now available! It looks like this:
Using the app
Using the GTFS RT Validator is incredibly simple. All you need to know is right there on that web page:
What is the GTFS-Realtime Validator?
The upper-left box tells us what the tool does in one sentence, and provides a link to exact list of test rules.
Getting Started
The upper-right box provides a short, 5-step guide to create your very first validation report.
Step 1: Add the URL for your GTFS zip file
The lower-left box has three form inputs:
- The "GTFS feed" input box requires a direct URL to a valid GTFS Schedule ZIP file.
That URL must be a direct download link! Test it in your browser first to make sure it doesn't redirect or responds with an HTML page.
"Oh no, I only have a local ZIP file and can't upload it to the web".
No worries! Create a new ./gtfs-schedule-files folder then add a service to ./docker-compose.yml to expose that directly on localhost:
services:
# ...
server-service:
container_name: server-container
image: python:3.9-slim
command: python3 -m http.server 8000 --directory /shared
ports:
- "8082:80"
volumes:
- ./gtfs-schedule-files:/shared
Run docker compose up again to restart both services, then open http://localhost:8082/my-file.zip. If all went well, your browser will download the file.
Now you can access your local file in the validator tool from inside the container, using the URL http://server-container/my-file.zip.
-
The "Run GTFS validation" checkbox is optional. If selected, the tool also validates the GTFS Schedule data alone. This takes longer though.
-
The "Use shapes.txt for GTFS-realtime rules" checkbox is also optional. It .... TODO
Step 1: Add the URL for your GTFS zip file
WIP