Imported from yellowcooln/meshcore-mqtt-dashboard (
AGENTS.md). Install upstream withnpx skills add yellowcooln/meshcore-mqtt-dashboard. Copyright stays with the author.
Repository Guidelines
Project Structure & Module Organization
backend/app.pyholds the FastAPI server, MQTT ingest, SQLite packet storage, and websocket broadcasting.backend/static/index.htmlis the dashboard UI and client-side rendering.backend/static/traffic.htmlis the retained traffic page UI and chart rendering.backend/static/batteryinfo.htmlis the optional decoded battery telemetry page.backend/requirements.txtdefines Python dependencies.backend/Dockerfilebuilds the service image.docker-compose.yamlruns the service asmqtt-dashboard..github/workflows/docker-publish.ymlpublishesyellowcooln/meshcore-mqtt-dashboard.data/stores the SQLite packet database and optional role overrides..envholds runtime settings;.env.examplemirrors template defaults.
Build, Test, and Development Commands
docker compose up -d --buildrebuilds and restarts the backend (preferred workflow).docker compose logs -f mqtt-dashboardfollows server logs.curl -s http://localhost:8081/snapshotchecks broker + node state.curl -s http://localhost:8081/packets?limit=50inspects recent packets.http://localhost:8081/trafficshows retained traffic history and talkers.http://localhost:8081/batteryinfoshows decoded battery telemetry when enabled.
Coding Style & Naming Conventions
- Python in
backend/app.pyuses 2-space indentation; keep it consistent. - HTML/CSS/JS in
backend/static/index.htmlandbackend/static/traffic.htmluse 2 spaces as well. - Use lowercase, underscore-separated names for Python variables/functions.
- Keep logging concise and avoid dumping full payloads.
Testing Guidelines
- Automated tests are run with
pytestfrom repo root. - Install deps with
pip install -r requirements-dev.txt. - Validate changes manually with
/snapshot,/packets, and/traffic.
Configuration & Operations
- MQTT settings are configured via
.env(MQTT_HOST,MQTT_PORT,MQTT_TRANSPORT, TLS, topics). - The backend prints the running app version on startup.
- Dashboard branding/share metadata is set by
DASH_TITLE. - Optional broker display endpoint override is set by
DASH_BROKER_HOST. - Optional favicon is configured with
DASH_LOGO_URL(.png/.jpg/.jpeg). - Optional header external button is configured with
DASH_EXTERNAL_URLandDASH_EXTERNAL_LABEL. - Packet retention is controlled by
PACKET_RETENTION_SECONDS(clamped to 24h max). - Battery info is controlled by
BATTERYINFO_ENABLED, channel env vars, andBATTERYINFO_RETENTION_SECONDS(default 48h). - Packet DB lives at
PACKET_DB_PATH(default/data/packets.dbin Docker). - Names are cached from the packet DB on startup.
- Traffic history is persisted in SQLite and rebuilt from retained packets when needed.
- Battery history is persisted in SQLite and rebuilt from retained packets when needed.
- Retained
*/internalmessages do not count toward node presence. - Nodes are purged after
NODE_PURGE_SECONDSof inactivity (default 600 seconds).