Generalized Open-Source Framework and Developer Toolkit specifically optimized for tracking eurobahn (ERB) transit operations.
Welcome to erb-tools! This project provides an incredibly flexible, generalized domain-driven ecosystem to fetch, process, and serve live public transit data. It defaults to extracting Eurobahn metrics across regional transit operations. Built with Hexagonal Architecture in a Turborepo monorepo, it enables rapid development of CLI tools, backend APIs, and scraping fallbacks.
This monorepo strictly follows Domain-Driven Design and Hexagonal Architecture. The business logic is generalized (e.g. TransitDeparture) and isolated in the @erb-tools/core package. External systems (like HAFAS or website scraping) are implemented as Adapters that fulfill the Ports defined in the Core, filtering down to eurobahn logic seamlessly.
📦 erb-tools
┣ 📂 packages
┃ ┣ 📂 core # 🧠 Generalized Business Domain & Transit Ports
┃ ┃ ┗ 📜 NO external frameworks or network libraries here. Pure TypeScript.
┃ ┣ 📂 data-sources # 🔌 The Adapters
┃ ┃ ┣ 📂 hafas-client # Implementation of TransitDataPort using db-hafas
┃ ┃ ┗ 📂 web-scraper # Fallback scraping of traffic updates
┃ ┗ 📂 entrypoints # 🚀 The Consumer Applications
┃ ┣ 📂 api # Express.js REST API providing clean JSON
┃ ┗ 📂 cli # Commander-based terminal interface
┣ 📜 turbo.json # Turborepo Build Pipelines
┣ 📜 pnpm-workspace.yaml # Workspace configuration
┗ 📜 package.json
- Node.js (v20+)
pnpm(v8+)
Clone the repository and install all dependencies:
git clone https://github.com/dwohlgemuth-link/erb-tools.git
cd erb-tools
pnpm installCompile all packages using Turborepo's ultra-fast caching:
pnpm buildGet live generalized departures for a station (e.g., Dortmund Hbf: 8000080), strictly filtered for Eurobahn operators:
cd packages/entrypoints/cli
node dist/index.js departures 8000080 --operator eurobahnSpin up the local Express backend to serve data over HTTP:
cd packages/entrypoints/api
# Uses the PORT env variable or defaults to 3000
pnpm startTest the generalized eurobahn endpoints:
- Departures: http://localhost:3000/v1/eurobahn/departures/8000080
- Disruptions: http://localhost:3000/v1/eurobahn/disruptions
Contributions, issues, and feature requests are welcome! We enforce strict TypeScript typing and modular design. Feel free to check the issues page or open a PR.
This project is MIT licensed.