Files
home-pump/frontend

Home Pump Frontend

This frontend is a small React + TypeScript app (Vite) that connects to the backend via REST and SSE.

Development:

  1. cd frontend
  2. npm install
  3. 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:

  1. npm run build
  2. Serve the dist/ folder by any static server, or copy it into the backend src/main/resources/static/ for integrated deployment.

Integrated deployment (option B):

  • After npm run build, copy frontend/dist into src/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, copy frontend/dist into src/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 }