See Finnish train schedules in real-time. The site uses an MQTT connection to keep the data fresh and updates in a matter of milliseconds.
Pnpm workspaces with Turborepo is used to keep internal packages in sync. Each of the packages have their own suite of automated tests that can be run from the workspace root or the package in question. Documentation is available in the Wiki.
The repo consists of three main packages:
-
The site, built on Next.js and deployed to Vercel. Tested with unit tests and automatic Storybook e2e and integration tests.
-
A minimal wrapper for Digitraffic's REST endpoints. Also provides some extra features such as localized stations for Finnish, English and Swedish.
-
Utilities for working with Digitraffic's MQTT APIs. For example, you can listen to trains just by initiating the client and asynchronously looping over any updates:
for await (train of client.trains) { console.log(`Train updated: ${train.trainNumber}.`) }
Node.js version 20 is required; 20 and 22 are tested.
- Clone the repository with your preferred method. Whether that be the Github CLI, degit or just git commands.
- This repository uses pnpm for package management so you should have it installed. If you don't, you can simply run
corepack enable && corepack installto install it. Note that, as of version v9 of pnpm, pnpm requires you to use the version specified in package.json packageManager field. - Run
pnpm install. For the first run runningpnpm devfrom the workspace root builds the packages.
Copyright (C) 2025 Jasper Nykänen
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.