Skip to content
OBEGRÄNSAD LED

Frontend

The Web GUI lives in frontend/. It is built with SolidJS, Vite and Tailwind CSS. The build is compressed and embedded into the firmware as src/webgui.cpp, so the device serves it without a file system.

Requirements

  • Node.js (current LTS)
  • pnpm. The version is pinned in frontend/package.json (packageManager), so corepack enable picks the right one.

Develop against a device

Install dependencies

cd frontend
pnpm install

Point the dev server at your device

Set the device address in frontend/.env:

VITE_BASE_URL=http://192.168.1.50/
VITE_WS_URL=ws://192.168.1.50/

Start the dev server

pnpm dev

Open http://localhost:3000. Changes reload in the browser, and all API and WebSocket calls go to the device.

Build into the firmware

cd frontend
pnpm build

pnpm build runs vite build and then compress.mjs. The script gzips the output and writes it as a byte array to src/webgui.cpp. Flash the firmware afterwards to see the new GUI on the device. Commit src/webgui.cpp together with your frontend changes.

Build with Docker

If you do not want to install Node.js, build with Docker from the repository root:

docker compose run node

The container installs the dependencies and runs pnpm run build.

Scripts

ScriptDescription
pnpm devDev server on port 3000.
pnpm buildProduction build and src/webgui.cpp.
pnpm servePreview the production build.

Linting and formatting run from the repository root, see Contributing.

Structure

PathContent
src/app.tsxDisplay page with the LED matrix and sidebar.
src/creator.tsx, src/creator/Animation Creator.
src/scheduler.tsxPlugin scheduler.
src/settings.tsxSettings page.
src/contexts/store.tsxWebSocket connection and shared state.
src/types.tsTypes of the device messages.

The GUI uses the WebSocket for live state and the HTTP API for the scheduler and settings.