Query Dutch Railways (NS) for train departures, trip planning, disruptions, and station search via the trein CLI.
A CLI for the NS (Dutch Railways) API with real-time departures, trip planning, disruptions, and station search.
npm (recommended):
```bash
npm i -g trein
```
Or download a standalone binary from [GitHub Releases](https://github.com/joelkuijper/trein/releases).
Get an API key from https://apiportal.ns.nl/ and set it:
```bash
export NS_API_KEY="your-api-key"
```
Or create `~/.config/trein/trein.config.json`:
```json
{ "apiKey": "your-api-key" }
```
```bash
trein departures "Amsterdam Centraal"
trein d amsterdam
trein d amsterdam --json # structured output
```
```bash
trein trip "Utrecht" "Den Haag Centraal"
trein t utrecht denhaag --json
```
```bash
trein disruptions
trein disruptions --json
```
```bash
trein stations rotterdam
trein s rotterdam --json
```
```bash
trein alias set home "Amsterdam Centraal"
trein alias set work "Rotterdam Centraal"
trein alias list
trein d home # uses alias
```
Leave a review
No reviews yet. Be the first to review this skill!