Home Pump Frontend
This frontend is a small React + TypeScript app (Vite) that connects to the backend via REST and SSE.
Development:
- cd frontend
- npm install
- npm run dev
The dev server proxies /api and /sse to the backend. Override the backend URL/port used by the dev server with VITE_BACKEND_URL in a .env file (for example see .env.example). Default: http://localhost:7000.
Dev mode tip: If your development environment does not have a Modbus device available, set "useMock": true in src/main/resources/registryMapping.json (or your deployed configuration). The backend will use a MockRepository that serves realistic fake values and accepts writes.
Build for production:
- npm run build
- Serve the
dist/folder by any static server, or copy it into the backendsrc/main/resources/static/for integrated deployment.
Integrated deployment (option B):
- After
npm run build, copyfrontend/distintosrc/main/resources/static(or configure your CI to do that) so that the backend serves the static frontend files from the JAR.
Integrated deployment (option B):
- After
npm run build, copyfrontend/distintosrc/main/resources/static(or configure your CI to do that) so that the backend serves the static frontend files from the JAR.
SSE endpoint: /sse/live (server sends arrays of points: [{registry,ts,value}, ...])
API endpoints used by the frontend:
- GET /api/registries
- GET /api/live
- POST /api/registry/:id/write { value }