Skip to content

erille/mon-rer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

343 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rer-web

Python 3.12+ FastAPI Docker Tests License

Rewrite of the departures board for Ile-de-France Mobilites train data app from original author: https://x0r.fr.

App Preview

Live app

Mon RER app screenshot

Stack

  • Python 3.12+
  • FastAPI
  • Jinja templates
  • Vanilla JavaScript
  • Docker for deployment

What Changed

The old Perl/Dancer + PostgreSQL + GTFS import pipeline has been replaced with a smaller FastAPI app that is easier to run and maintain.

Preserved behavior:

  • station selection with /?s=CODE
  • live departures board
  • station autocomplete
  • line filtering
  • saved station cookie
  • compatibility endpoints: /json and /autocomp

Improvements:

  • typed configuration from environment variables
  • explicit handling for invalid token, rate limits, upstream failures, and empty results
  • health endpoint at /health
  • simpler deployment with Docker
  • cleaner responsive UI
  • structured Python service layer and tests

Important Migration Assumptions

  • The rewrite intentionally removes the legacy PostgreSQL + GTFS schedule database to avoid the largest operational burden in the original project.
  • The app still shows planned and expected departure times from the live IDFM payload when available.
  • Downstream stopping patterns from the old GTFS enrichment are not rebuilt in this version, so dessertes currently falls back to Desserte indisponible.
  • A compact station dataset is bundled from the legacy repository data. A small number of stations in that snapshot do not have a usable real-time stop-area reference and will return a clear message instead of departures.
  • Line reference mapping is bundled from the SNCF GTFS routes dataset so line badges and filters still work without keeping a live GTFS database.

Environment Variables

Required:

  • IDFM_API_TOKEN: API token for prim.iledefrance-mobilites.fr

Optional:

  • APP_ENV: application environment, default development
  • HOST: bind host, default 0.0.0.0
  • PORT: bind port, default 8000
  • LOG_LEVEL: logging level, default INFO
  • DEFAULT_STATION: default station code, default GDS
  • CACHE_TTL_SECONDS: upstream cache TTL, default 20
  • REQUEST_TIMEOUT_SECONDS: upstream request timeout, default 8
  • MAX_DEPARTURES: number of departures to display, default 6

See .env.example.

Local Run

  1. Copy .env.example to .env.
  2. Set IDFM_API_TOKEN in .env.
  3. Install dependencies:
python -m pip install -e .[dev]
  1. Start the app:
python -m app

Open http://127.0.0.1:8000.

For auto-reload during development:

python -m uvicorn app.main:app --reload --host 127.0.0.1 --port 8000

Docker

Build and run with Docker Compose:

docker compose up --build -d

Or plain Docker:

docker build -t rer-web .
docker run --env-file .env -p 8000:8000 --restart unless-stopped rer-web

The container binds to HOST and PORT from the environment. For a standard reverse proxy setup, keep HOST=0.0.0.0 and proxy to the configured PORT.

Endpoints

  • /: HTML app
  • /json: legacy-compatible departures JSON
  • /api/departures: canonical departures JSON
  • /autocomp: legacy-compatible station autocomplete JSON
  • /api/stations/autocomplete: canonical station autocomplete JSON
  • /health: health check

Tests

python -m pytest

Footer Credits

The footer now shows:

  • ketah.info
  • Original author: https://x0r.fr

About

Self-hosted FastAPI departures board for RER and Transilien live data from Ile-de-France Mobilites

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors