A modern web application for controlling split-flap displays via MQTT. This project consists of a React frontend and Node.js backend that work together to provide various display modes including:
- Text input mode
- Train timetable display
- Scene sequence playback
- Clock display
- Stopwatch functionality
- Timer functionality
/frontend- React TypeScript application built with Vite/backend- Node.js server with Socket.IO and MQTT integration/backend/scenes- YAML files defining scene sequences for playback
- Node.js (v16+)
- npm or yarn
- MQTT broker (for physical display control)
- National Rail Enquiries API token (optional, for train timetable functionality)
-
Copy the environment template file and configure it:
cp .env.template .envEdit
.envto set:SPLITFLAP_DISPLAY_LENGTH- Number of characters in your physical displayPORT- Backend server portNODE_ENV- Environment (development/production)NRE_API_TOKEN- National Rail Enquiries API token (for train mode)- MQTT broker details for your physical display:
DISPLAY_MQTT_BROKER_URLDISPLAY_MQTT_PUBLISH_TOPICDISPLAY_MQTT_SUBSCRIBE_TOPICDISPLAY_MQTT_USERNAME(if required)DISPLAY_MQTT_PASSWORD(if required)
The single
.envfile is used by both frontend and backend containers.
- Clone the repository
- Install dependencies:
# Backend cd backend npm install # Frontend cd frontend npm install - Start the development servers:
# Backend cd backend npm run dev # Frontend cd frontend npm run dev
The project includes Docker configuration for easy deployment:
docker-compose up -d
This will:
- Build and start both frontend and backend containers
- Make the frontend available at http://localhost:2001
- Connect the backend to the frontend via an internal Docker network
- Mount the
backend/scenesdirectory for persistence - Restart containers automatically unless explicitly stopped
- Text Mode: Directly input and send text to the display
- Train Timetable: Show real-time train departure information
- Sequence Mode: Create, edit and play sequences of text with timing
- Clock Mode: Display the current time
- Stopwatch Mode: Count up from zero
- Timer Mode: Count down from a set time
The application connects to an MQTT broker to control physical split-flap displays. Configure the connection settings in the .env file.
The backend automatically publishes MQTT discovery configuration for Home Assistant, allowing you to control the display modes and settings directly from your Home Assistant dashboard.
Scene sequences are stored as YAML files in the backend/scenes directory. When using Docker, this directory is mounted as a volume for persistence.
The application uses a single .env file in the project root for both frontend and backend configuration. This ensures consistency between the services and simplifies deployment.
Key environment variables:
SPLITFLAP_DISPLAY_LENGTH: Number of characters in your physical displayDISPLAY_MQTT_BROKER_URL: URL of your MQTT brokerDISPLAY_MQTT_PUBLISH_TOPIC: Topic to publish display commands toDISPLAY_MQTT_SUBSCRIBE_TOPIC: Topic to subscribe for status updatesNRE_API_TOKEN: National Rail Enquiries API token (for train timetable functionality)
See .env.template for a complete list of available configuration options.