This directory contains the standalone web service for moonhub.
It provides a complete unified web interface, acting as a dashboard, configuration center, and interactive console (channel client) for the core moonhub engine.
The service is structured as a monorepo containing both the backend and frontend code to ensure high cohesion and simplify deployment.
backend/: The Go-based web server. It provides RESTful APIs, manages WebSocket connections for chat, and handles the lifecycle of themoonhubprocess. It eventually embeds the compiled frontend assets into a single executable.frontend/: The Vite + React + TanStack Router single-page application (SPA). It provides the interactive user interface.
Edge-style WiFi provisioning (hotspot, scan/connect, recovery, auth code, factory reset) is implemented in pkg/provisioning/ and exposed by the launcher when MOONHUB_PROVISIONING_ENABLED=1. This enables zero-config setup for headless devices — no terminal or SSH required.
| Area | Location |
|---|---|
| Go API + SSE | web/backend/api/provisioning.go, web/backend/middleware/provisioning_auth.go |
| Wiring + env | web/backend/main.go (SetProvisioningHandler before RegisterRoutes) |
| React UI | web/frontend/src/routes/provisioning/, web/frontend/src/components/provisioning/ |
| PWA / offline (provisioning scope) | web/frontend/public/sw.js, site.webmanifest |
Documentation flow (same pattern as other subsystems in the repo): pkg/provisioning/docs/README.md → CONFIG.md → docs/implementation/provisioning-status.md.
The installable MoonHub-PWA client (separate repository; often checked out beside this repo as MoonHub-PWA/) talks to the device over LAN using the Go API under backend/api/. Operator-facing endpoint tables (mDNS GET /api/discover, paired list GET /api/devices, channel CRUD, dynamic tools /api/dynamic-tools, auth, config, chat, gateway) live in backend/api/README.md. Package-level design: pkg/dynamictools/docs/README.md.
- Go 1.25+
- Node.js 20+ with pnpm
Run both the frontend dev server and the Go backend simultaneously:
make devOr run them separately:
make dev-frontend # Vite dev server
make dev-backend # Go backendBuild the frontend and embed it into a single Go binary:
make buildThe output binary is backend/moonhub-web.
make test # Run backend tests and frontend lint
make lint # Run go vet and prettier/eslint
make clean # Remove all build artifacts