How arii/hrm works
HRM Dashboard is a real-time workout application: users connect a Bluetooth heart-rate monitor, view live heart-rate zones, control a Tabata or stopwatch timer, and optionally control Spotify. Its stateful custom server hosts WebSockets and background services; the browser dashboard and control pages consume those capabilities. Separate branches cover workout-plan display, Spotify playlists and settings, and experimental session analytics. Evidence is limited to the README and the supplied source index/excerpts, so unverified wiring is omitted or marked dashed.
Main entry points: DashboardClient.tsx Live dashboard · socketManager.ts WebSocket routing · services.ts Background services · route.ts Spotify API routes
Components 22
Dashboard and controls
- Live dashboard
components/DashboardClient.tsx - App shell
app/main.tsx - Timer and Spotify controls
app/client/control/ControlPanel.tsx - Workout phase grid
components/WorkoutPhaseGrid.tsx
Heart-rate workflow
- Bluetooth HRM connection
hooks/useBluetoothHRM/useGattConnect.ts - Workout session tracking
hooks/useWorkoutSessionManager.ts - Heart-rate zones
lib/shared/hr-zones.ts
Stateful runtime
- WebSocket client state
context/WebSocketContext.tsx - WebSocket routing
utils/socketManager.ts - Live HRM sessions
lib/hrm/HrmSessionManager.ts - Background services
lib/services.ts - Tabata timer
services/tabataTimer.ts - Workout plan API
app/api/workout/route.ts - Workout document parser
services/googleDocParser.ts
Spotify integration
- Spotify playback UI
components/SpotifyDisplay.tsx - Spotify API routes
app/api/spotify/devices/route.ts - Spotify token manager
services/spotifyTokenManager.ts - Spotify player service
services/spotifyPlayerManager.ts - Playlist services
services/spotifyPlaylistService.ts
Workout records
- Session analytics
app/client/experimental/components/useSessionList.ts - Browser session storage
lib/workout-session-storage.ts
Other components
- Workout participant
Connections 19
- Workout participant → Live dashboard: views live data
README.md - Workout participant → Bluetooth HRM connection: connects sensor
README.md - Workout participant → Timer and Spotify controls: controls workout
README.md - App shell → Live dashboard: renders
app/main.tsx - Live dashboard → WebSocket client state: uses live state
components/DashboardClient.tsx - Live dashboard → Workout phase grid: renders
components/DashboardClient.tsx - Bluetooth HRM connection → WebSocket routing: streams HR data
- WebSocket routing → Live HRM sessions: stores HR data
utils/socketManager.ts - Background services → Tabata timer: starts service
lib/services.ts - Background services → WebSocket routing: coordinates WebSockets
utils/socketManager.ts - WebSocket client state → WebSocket routing: exchanges messages
- Workout session tracking → Heart-rate zones: calculates zones
hooks/useWorkoutSessionManager.ts - Workout session tracking → Browser session storage: persists sessions
hooks/useWorkoutSessionManager.ts - Session analytics → Browser session storage: reads sessions
app/client/experimental/components/useSessionList.ts - Workout plan API → Workout document parser: loads workout plan
app/api/workout/route.ts - Timer and Spotify controls → Spotify API routes: requests playback
- Spotify playback UI → Spotify API routes: controls playback
- Spotify API routes → Spotify token manager: gets access token
app/api/spotify/devices/route.ts - Background services → Spotify player service: starts polling
lib/services.ts