Skip to content

Commit 837aaab

Browse files
committed
readme
1 parent aa4ac13 commit 837aaab

File tree

1 file changed

+109
-52
lines changed

1 file changed

+109
-52
lines changed

README.md

Lines changed: 109 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,111 @@
1-
# React + TypeScript + Vite
2-
3-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4-
5-
Currently, two official plugins are available:
6-
7-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
8-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9-
10-
## Expanding the ESLint configuration
11-
12-
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
13-
14-
```js
15-
export default tseslint.config({
16-
extends: [
17-
// Remove ...tseslint.configs.recommended and replace with this
18-
...tseslint.configs.recommendedTypeChecked,
19-
// Alternatively, use this for stricter rules
20-
...tseslint.configs.strictTypeChecked,
21-
// Optionally, add this for stylistic rules
22-
...tseslint.configs.stylisticTypeChecked,
23-
],
24-
languageOptions: {
25-
// other options...
26-
parserOptions: {
27-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
28-
tsconfigRootDir: import.meta.dirname,
29-
},
30-
},
31-
})
32-
```
1+
# Split-Flap Display Controller
2+
3+
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:
4+
5+
- Text input mode
6+
- Train timetable display
7+
- Scene sequence playback
8+
- Clock display
9+
- Stopwatch functionality
10+
- Timer functionality
11+
12+
## Project Structure
13+
14+
- `/frontend` - React TypeScript application built with Vite
15+
- `/backend` - Node.js server with Socket.IO and MQTT integration
16+
- `/backend/scenes` - YAML files defining scene sequences for playback
17+
18+
## Getting Started
19+
20+
### Prerequisites
21+
22+
- Node.js (v16+)
23+
- npm or yarn
24+
- MQTT broker (for physical display control)
25+
- National Rail Enquiries API token (optional, for train timetable functionality)
26+
27+
### Configuration
28+
29+
1. Copy environment template files and configure them:
30+
31+
**For the frontend:**
32+
```
33+
cp .env.template .env
34+
```
35+
36+
Edit `.env` to set:
37+
- `VITE_API_BASE_URL` - URL of your backend server
38+
- `VITE_OIDC_ENABLED` - Authentication flag (if applicable)
39+
40+
**For the backend:**
41+
```
42+
cp backend/.env.template backend/.env
43+
```
44+
45+
Edit `backend/.env` to set:
46+
- `PORT` - Backend server port
47+
- `NODE_ENV` - Environment (development/production)
48+
- `NRE_API_TOKEN` - National Rail Enquiries API token (for train mode)
49+
- MQTT broker details for your physical display:
50+
- `DISPLAY_MQTT_BROKER_URL`
51+
- `DISPLAY_MQTT_TOPIC`
52+
- `DISPLAY_MQTT_USERNAME` (if required)
53+
- `DISPLAY_MQTT_PASSWORD` (if required)
54+
55+
### Development Setup
3356

34-
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
35-
36-
```js
37-
// eslint.config.js
38-
import reactX from 'eslint-plugin-react-x'
39-
import reactDom from 'eslint-plugin-react-dom'
40-
41-
export default tseslint.config({
42-
plugins: {
43-
// Add the react-x and react-dom plugins
44-
'react-x': reactX,
45-
'react-dom': reactDom,
46-
},
47-
rules: {
48-
// other rules...
49-
// Enable its recommended typescript rules
50-
...reactX.configs['recommended-typescript'].rules,
51-
...reactDom.configs.recommended.rules,
52-
},
53-
})
57+
1. Clone the repository
58+
2. Install dependencies:
59+
```
60+
# Backend
61+
cd backend
62+
npm install
63+
64+
# Frontend
65+
cd frontend
66+
npm install
67+
```
68+
3. Start the development servers:
69+
```
70+
# Backend
71+
cd backend
72+
npm run dev
73+
74+
# Frontend
75+
cd frontend
76+
npm run dev
77+
```
78+
79+
### Docker Deployment
80+
81+
The project includes Docker configuration for easy deployment:
82+
83+
```
84+
docker-compose up -d
5485
```
86+
87+
This will:
88+
- Build and start both frontend and backend containers
89+
- Make the frontend available at http://localhost:8080
90+
- Connect the backend to the frontend via an internal Docker network
91+
- Mount the `backend/scenes` directory for persistence
92+
- Restart containers automatically unless explicitly stopped
93+
94+
## Features
95+
96+
### Display Modes
97+
98+
- **Text Mode**: Directly input and send text to the display
99+
- **Train Timetable**: Show real-time train departure information
100+
- **Sequence Mode**: Create, edit and play sequences of text with timing
101+
- **Clock Mode**: Display the current time
102+
- **Stopwatch Mode**: Count up from zero
103+
- **Timer Mode**: Count down from a set time
104+
105+
### MQTT Integration
106+
107+
The application connects to an MQTT broker to control physical split-flap displays. Configure the connection settings in the Settings panel of the application or via environment variables.
108+
109+
## Scene Files
110+
111+
Scene sequences are stored as YAML files in the `backend/scenes` directory. When using Docker, this directory is mounted as a volume for persistence.

0 commit comments

Comments
 (0)