This README is the entry point for AI agents working in this repository.
Use it to quickly answer:
- What component am I changing?
- Which files are the source of truth?
- Which other components must be updated for compatibility?
Grouploop connects ESP32-based devices to browser applications via a Python WebSocket relay.
Main components:
- Client Hub (Flask): serves browser apps from
client-hub/app/static/apps/* - Socket Server (Python
websockets): relays frames and routes commands - Firmware (PlatformIO / Arduino): device-side processes for BLE, IMU, LEDs, vibration, Wi‑Fi, WebSocket
- Documentation (MkDocs): architecture, deployment, extension guides
Runtime orchestration is in docker-compose.yml.
Defined in docker-compose.yml:
socket→ host5003(container5000)
Code: socket-server/app/app.pyclient_hub→ host5004(container5000)
Code: client-hub/app/app.pydocs→ host5006(container5000)
Code/config: documentation/mkdocs.yml
Important env vars:
WS_DEFAULT_URL,CDN_BASE_URL,DEFAULT_APP(used by Client Hub)WS_HOST,WS_PORT(used by Socket Server)
When information conflicts, trust in this order:
- Runtime code + compose
- Component docs/pages
- Legacy/historical files (may be stale; verify before editing)
Current browser/device flow assumes a 20-char hex frame:
id(4) + ax(2) + ay(2) + az(2) + dNW(2) + dNE(2) + dSE(2) + dSW(2) + tap(2)
If you change this format, update all of:
- Firmware producer: grouploop-firmware/ble-scanner/include/processes/PublishProcess.h
- Server relay assumptions: socket-server/app/app.py
- Browser parser: client-hub/app/static/vendor/js/HitloopDevice.js
- Browser manager validation: client-hub/app/static/vendor/js/HitloopDeviceManager.js
- Simulated producers: client-hub/app/static/apps/device-simulator/device.js, client-hub/app/static/apps/device-emulator/client.js
- Relevant docs pages in documentation/docs/
Commands originate in browser apps as:
cmd:<target>:<command>:<parameters>
Command changes usually require updates in:
- Browser command validation/sending: client-hub/app/static/vendor/js/HitloopDevice.js
- Socket routing: socket-server/app/app.py
- Firmware command handlers: grouploop-firmware/ble-scanner/include/processes/, grouploop-firmware/ble-scanner/src/main.cpp
- External command registry (
commands.jsonviaCDN_BASE_URL) and/or fallback in socket-server/app/app.py
- Canonical firmware project in this repo: grouploop-firmware/ble-scanner/
- Build config: grouploop-firmware/ble-scanner/platformio.ini
- Many firmware implementations are in headers under grouploop-firmware/ble-scanner/include/processes/ (not separate
.cppfiles).
Start here for architecture and extension context:
- documentation/docs/architecture/overview.md
- documentation/docs/deployment/structure.md
- documentation/docs/development/extending-system.md
- documentation/docs/development/api-reference.md
- documentation/docs/firmware/architecture.md
MkDocs nav/source: documentation/mkdocs.yml
These files exist but should be treated carefully:
- socket-server/README.md describes Flask-SocketIO patterns, while runtime server code is currently in socket-server/app/app.py using
websockets. - documentation/docs/index.md contains mixed historical content and references not fully aligned with current
docker-compose.yml. - .github/workflows/deploy-socket-demo.yml references a
socket-demoartifact path not represented in current compose services. - Test files in socket-server/app/test.py and parts of grouploop-firmware/ble-scanner/test/ appear legacy and are not strong indicators of current behavior.
- Identify task type in Section 4 and open those files first.
- Cross-check assumptions with Section 3 (source of truth order).
- If changing protocol/commands, follow Section 5 checklist before finishing.
- Update docs under documentation/docs/ when behavior changes.