Get real-time TfL (Transport for London) service status in a straightforward and minimalist design. No more fumbling through apps or web pages to know if your line is running smoothly. Built with pure JavaScript (ok, a tiny bit of CSS to allow the new Overground line colours to be striped), and calling the TfL API directly, this lightweight tool can be easily integrated into your workflow or dashboard.
Experience Super Simple TfL Status in action with these quick demo links, or embed these pages in your home automation dashboard.
| Description | Live Link |
|---|---|
| Tube Only | π Tube |
| Elizabeth Line Only | π Elizabeth Line |
| Tube + Elizabeth Line | ππ Combo 1 |
| Tube + Overground | ππ Combo 2 |
| All Modes | π All Modes |
| All Modes + Names | π All Modes + Names |
Click on the live links to explore different configurations and find the one that suits you the best!
- π Fast: Fetches and displays statuses in seconds
- π¨ Colour-Coded: Uses official TfL line colours for quick identification
- π Configurable: Choose which modes of transport to display
- π Simple Codebase: Easy to extend or modify
- A modern web browser
- Internet connection
You can use the hosted version at https://tfl-status.cynexia.com or run your own:
- Clone the repository:
git clone https://github.com/mnbf9rca/super_simple_tfl_status.git - Open
index.htmlin your web browser.
mode: Choose the mode of transportation. Default is "tube,elizabeth-line". Example:?mode=tube,dlr. Options are any accepted by the TfL API, although some, likebusare obviously less useful. You can see all available options by using the TfL API Portal to query for 'all valid modes'.names: Display the names of the lines. Default is false. Example:?names=true. See below for more info.
Combine parameters like this: ?mode=tube&names=true
Understand how the names parameter changes the display when there are disruptions or no disruptions:
| Scenario | names=true |
names=false |
|---|---|---|
| No Disruptions | Shows "Good service on all lines". | Shows "Good service on all lines". |
| Some Disruptions | Shows disrupted lines with their names, followed by "Good service on all other lines." | Shows only the colours of disrupted lines. |
| All Lines Disrupted | Shows all lines with disruptions and their names. | Shows only the colours of all disrupted lines. |
This project requires Node.js 24.x (future LTS).
# Clone the repository
git clone https://github.com/mnbf9rca/super_simple_tfl_status.git
cd super_simple_tfl_status
# Install dependencies
npm install
# Run tests
npm test
# Run tests with coverage
npm test -- --coverage
# Check code style
npm run lint
npm run format:checkThe application is built with vanilla JavaScript for maximum compatibility and minimal dependencies:
site/tflStatus.js- Core application logic with exported functions for testingsite/tflStatus.test.js- Comprehensive test suite (51 tests, >94% coverage)site/index.html- Minimal HTML page that loads the scriptsite/style.css- CSS for status block styling and line colours
Tests use Jest with jsdom environment:
- Coverage target: >90% for all metrics
- Environment detection: Handles both Node.js and browser environments
- API mocking: Mocks fetch and setTimeout for reliable testing
- Hostname detection: Tests localhost, 127.0.0.1, and 0.0.0.0 detection
The app calls the TfL Unified API directly:
- Endpoint:
https://api.tfl.gov.uk/Line/Mode/{modes}/Status - Caching: Respects Cache-Control headers for intelligent refreshing
- Error handling: Graceful degradation when API is unavailable
We welcome contributions! Please see our Contributing Guide for detailed information about:
- Development setup and prerequisites
- Code style guidelines (ESLint + Prettier)
- Testing requirements and patterns
- Pull request process
- Troubleshooting common issues
- Tests pass:
npm test - Code style:
npm run lintandnpm run format:check - Coverage maintained: >90%
- JSDoc comments for new functions
- Update documentation if needed
- Check browser console for JavaScript errors
- Verify internet connection - the app calls TfL API directly
- Check TfL API status at api-portal.tfl.gov.uk
- Try different modes - some transport modes may be temporarily unavailable
The app automatically refreshes based on TfL API Cache-Control headers (typically 5 minutes):
- Manual refresh: Reload the page
- Check cache: Look for "cache_ttl" in browser console logs
- Development mode: Console logs appear when hostname is localhost/127.0.0.1/0.0.0.0
Ensure proper URL format:
- β
Correct:
?mode=tube&names=true - β Incorrect:
?mode = tube & names = true
Valid modes include: tube, elizabeth-line, dlr, overground, tram, river-bus
For embedding in home automation dashboards:
- Use the hosted version:
https://tfl-status.cynexia.com/ - Add your preferred parameters:
?mode=tube,elizabeth-line&names=true - Frame or embed the URL in your dashboard
- Status updates automatically without iframe refresh
- Bundle size: ~8KB (unminified JavaScript)
- Load time: Typically <2 seconds including API call
- Memory usage: Minimal - no heavy frameworks
- Browser support: Modern browsers (ES6+ required)
This project is licensed under the MIT License. TfL API subject to TfL's terms.
