π Station Overview
A "station" is everything that runs on a single Raspberry Pi: backend (Fastify), frontend (React SPA), Postgres, MQTT broker, plus the native station-agent that manages them. Source lives in the smart-home/ β monorepo.
What a Station Ownsβ
- All ESP32 device data (devices, telemetry, events)
- Local user accounts (synced from Cloud or LAN-only)
- Automations and kits
- Firmware artefacts and OTA distribution
- Wi-Fi network configuration (via station-agent + captive portal)
It works fully offline β Cloud connection is optional and only needed for remote/mobile access.
Topologyβ
Monorepo Layoutβ
smart-home/
βββ packages/
β βββ backend/ β Fastify API + WS + MQTT bridge
β βββ frontend/ β React 18 + Vite SPA
β βββ shared/ β Cross-package TypeScript types + Zod schemas
βββ firmware/
β βββ lib/smart-home-core/ β shared C++ library (Wi-Fi, MQTT, BLE, OTA)
β βββ esp32-climate/ β temperature + humidity + pressure sensor
β βββ esp32-pir/ β motion detector
β βββ esp32-light/ β LED actuator (dimmable)
β βββ esp32-switch-pir/ β wall switch with PIR
βββ station-agent/ β Native Node binary on RPi (SEA, self-managed via systemd)
βββ deployment/ β Docker Compose, install scripts, nginx config
βββ docs/ β Internal design notes (mqtt-protocol, kits, hardware, etc.)
Run Commandsβ
From the monorepo root:
npm run dev # Turbo: backend + frontend in watch mode
npm run build # Turbo: build all packages
npm run lint # eslint across all packages
npm run check-types # tsc --noEmit
npm run format # prettier --write
npm run firmware:build # build ESP32 firmware (scripts/build-firmware.js)
Releaseβ
All releases via scripts/release.sh β β never edit package.json versions or create tags manually.
| Tag | What gets built | Where it lands |
|---|---|---|
v0.2.77 | backend + frontend Docker images | Docker Hub + release.json updated |
backend-v0.2.77 | backend only | Docker Hub + release.json (frontend untouched) |
frontend-v0.2.77 | frontend only | Docker Hub + release.json (backend untouched) |
firmware-v0.1.5 | all firmware variants | Public registry + firmware/manifest.json |
firmware-esp32-climate-v0.1.5 | one firmware variant | Public registry + manifest |
agent-v1.0.1 | station-agent SEA binary | smart-home-updates repo |
See Release Flow.
Conventionsβ
- Default branch:
develop - Jira prefix:
SHS-(e.g.SHS-42 add device pairing) - TS conventions: arrow functions, no classes, enum + Record dispatch β see TypeScript rules β