Almost On Board is a web application that provides real-time public transportation departure information from Västtrafik. The app allows users to search for specific stop points and view the next three upcoming departures from the chosen platform. This works as a digital real time departure board. A stressed traveller don't need to input the same search multiple times and can access their stop point of choice fast.
- Search for stop points across the Västtrafik network
- Select specific platforms at each stop
- View real-time departure information including:
- Line number and name
- Direction
- Transport mode (bus, tram or ferry)
- Estimated departure time in minutes
- Cancellation status
- Node.js with Express.js for the backend
- JavaScript for the frontend
- Västtrafik's Public API for transportation data
- Axios for HTTP requests
- ES modules for code organization
- Node.js (v14+)
- npm
- Västtrafik API credentials
-
Clone the repository
git clone https://github.com/yourusername/almost-on-board.git cd almost-on-board -
Install dependencies ```bash npm install
-
Create an account on https://developer.vasttrafik.se/ and create an app for program and fetch your "Klientidentifierare" (VASTTRAFIK_ID) & "Hemlighet" (VASTTRAFIK_SECRET)
-
Create a .env file in the root directory with your Västtrafik API credentials ```bash VASTTRAFIK_ID=your_client_id VASTTRAFIK_SECRET=your_client_secret
-
Start the server ```bash npm run start
-
Access the application at http://localhost:4000
- Enter a stop point name in the search field and click "SÖK"
- Select a stop point from the radio buttons that appear
- Enter a platform designation (default is "A")
- Click "SPARA" to save the search
- Click on the left arrow to head back to the live departure board.
- Departure information will update automatically every 15 seconds
The application includes several API endpoints:
/search - Search for stop points by text
/data - Get departure information for a selected stop point
/data/:token - Get departure information using a cached token
The application is configured for deployment on Vercel with the included vercel.json configuration file.
The application includes route protection middleware that prevents direct access to API endpoints, allowing them to be accessed only from the application frontend.
This project is licensed under the MIT License
Thanks to Västtrafik for providing such a great public transportation API! Västtrafik's Documentation for the API
