MCPcopy Index your code
hub / github.com/BetterBahn/betterbahn

github.com/BetterBahn/betterbahn @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
77 symbols 189 edges 49 files 4 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

BetterBahn

BetterBahn is a web app for finding the best train journeys in Germany. While split ticketing is supported to help save money, it is rather the exception. The app will be extended with many more features in the future. You can find out more about the project on our website.

[!WARNING] It seems like Deutsche Bahn has introduced a change that prevents Betterbahn from working. This causes the error ENOTFOUND app.vendo.noncd.db.de. See https://github.com/BetterBahn/betterbahn/issues/225 for more details.

Technology

This project uses the db-vendo-client for accessing Deutsche Bahn ticketing data, which is licensed under the ISC License.

Legal Notice

This is not an official repository or project of Deutsche Bahn AG. It is an independent project and not affiliated with or endorsed by Deutsche Bahn. To use this code or the db-vendo-client permission from the Deutsche Bahn AG is necessary.

Getting Started

Prerequisites

To run the project locally

  1. Clone the repository and navigate to the folder

shell git clone https://github.com/l2xu/betterbahn.git cd betterbahn

  1. Install dependencies with pnpm install

You can install pnpm via corepack (included with Node.js):

shell corepack enable corepack prepare pnpm@latest --activate

or via npm:

shell npm install -g pnpm@latest-10

then run pnpm install in the project directory.

  1. Start the development server with pnpm run dev and navigate to http://localhost:3000 in your browser.

Docker

You can also build and run BetterBahn as a Docker container. A Dockerfile is included in the repository.

Docker Compose

You can run the app with docker compose:

Default/Development

docker compose -f docker-compose/docker-compose.yaml --project-directory=./ up -d

http://localhost:3000

Installation Guides

For detailed installation instructions on different platforms please refer to the Wiki

License

This project is licensed under the AGPL-3.0-only. See the LICENSE file for details.

Community and Contribution

Join the Discord community to ask questions, share feedback, and connect with other users and contributors.

Want to contribute? Please read the Code of Conduct and see the Contributing Guide for details on how to get started.

How it works

BetterBahn searches for train journeys and can use split ticketing to help you find cheaper options—though this is usually the exception, not the rule. For a detailed explanation and demonstration, check out the YouTube video.

About the Author

Created by Lukas Weihrauch.


Made with ❤️ for train travelers in Germany.

Extension points exported contracts — how you extend this code

Props (Interface)
(no doc)
components/Journey.tsx
Props (Interface)
(no doc)
components/discount/SplitOptionsCard.tsx
Station (Interface)
(no doc)
utils/createUrl.ts
VendoClient (Interface)
(no doc)
utils/db-vendo-client-types.d.ts
TrainLine (Interface)
(no doc)
utils/types.ts
SplitAnalysis (Interface)
(no doc)
app/api/analyzeJourney.ts
Props (Interface)
(no doc)
app/discount/Analysis.tsx
JourneyInfoRowProps (Interface)
(no doc)
components/discount/JourneyInfoRow.tsx

Core symbols most depended-on inside this repo

formatTime
called by 12
utils/formatUtils.ts
getJourneyLegsWithTransfers
called by 9
utils/journeyUtils.ts
getStationName
called by 6
utils/journeyUtils.ts
useLocalStorage
called by 4
components/SearchForm/useLocalStorage.ts
formatPriceDE
called by 4
utils/priceUtils.ts
legIsFlixTrain
called by 4
utils/deutschlandTicketUtils.ts
isLegCoveredByDeutschlandTicket
called by 4
utils/deutschlandTicketUtils.ts
useUrlParams
called by 3
components/discount/useUrlParams.ts

Shape

Function 63
Interface 13
Method 1

Languages

TypeScript100%

Modules by API surface

utils/createUrl.ts7 symbols
utils/journeyUtils.ts4 symbols
utils/formatUtils.ts4 symbols
utils/deutschlandTicketUtils.ts3 symbols
utils/db-vendo-client-types.d.ts3 symbols
components/discount/OriginalJourneyCard.tsx3 symbols
components/discount/ErrorDisplay.tsx3 symbols
components/SearchForm/useLocalStorage.ts3 symbols
app/discount/Analysis.tsx3 symbols
utils/types.ts2 symbols
utils/parseHinfahrtRecon.ts2 symbols
components/discount/StatusBox.tsx2 symbols

For agents

$ claude mcp add betterbahn \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact