R3HAB is a hackathon recovery platform for Hydrawav3 workflows. It combines:
- Practitioner-side guided assessment and session tools
- Client-side daily recovery loop with a real-time virtual coach
- ROM tracking, XP/streak gamification, and progress insights
- ElevenLabs voice guidance for coaching cues
R3HAB reduces practitioner overhead by moving daily follow-through to an automated client flow while keeping clinical visibility.
- Dashboard with session and client workflows
- Guided movement assessment (camera + pose landmarks + wireframe)
- Session orchestration and protocol flow
- Session history and summary endpoints
- Recovery Loop page for daily exercise completion
- Virtual Coach that:
- Uses camera pose tracking in real time
- Detects reps and scores quality/correctness
- Requires full-body visibility before starting
- Tracks correct vs wrong reps with visual cues
- Uses voice prompts (ElevenLabs) with throttle logic
- Logs results to daily records and awards XP
- Progress calendar, trend insights, and ROM dashboard (including radar chart)
- Switch-user demo mode (Practitioner + 4 client personas)
Implemented ROM-related movements include:
forward_bendsquattrunk_rotationshoulder_flexion
The client daily coach flow currently uses three guided exercise routines:
- Torso rotations
- Leg swings
- Arm rotations
- Frontend: Next.js 15, React 19, TypeScript, Tailwind
- Pose tracking:
@mediapipe/tasks-vision(browser) + MediaPipe/OpenCV (backend assessment path) - Backend: FastAPI, Pydantic, Uvicorn
- Data layer: InsForge APIs
- Voice: ElevenLabs Text-to-Speech
R3HAB/
├── frontend/ # Next.js app (primary UI)
│ ├── src/app/(practitioner)
│ ├── src/app/(client)
│ └── src/components/client/VirtualCoach.tsx
├── backend/ # FastAPI app
│ └── app/api/v1/endpoints
├── insforge/ # DB/schema assets
├── docker-compose.yml
└── .env.example
- Node.js 20+
- npm 10+
- Python 3.11+
- Working webcam (or mobile phone webcam via system camera bridge)
There are two env contexts: backend server env and frontend Next.js env.
From backend/, create .env:
cd backend
cp ../.env.example .envSet at least:
INSFORGE_BASE_URLINSFORGE_API_KEYHYDRAWAV_BASE_URLHYDRAWAV_USERNAMEHYDRAWAV_PASSWORDHYDRAWAV_DEVICE_MAC(optional override)
Optional:
HUGGINGFACE_API_KEY
From frontend/, create .env.local:
cd frontend
cat > .env.local << 'EOF'
NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1
ELEVENLABS_API_KEY=your_server_side_key_here
ELEVENLABS_VOICE_ID=21m00Tcm4TlvDq8ikWAM
ELEVENLABS_MODEL_ID=eleven_multilingual_v2
EOFImportant:
NEXT_PUBLIC_API_URLmust include/api/v1for this frontend codebase.- Voice route (
/api/tts) expectsELEVENLABS_API_KEYon the Next.js server runtime.
cd backend
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtcd frontend
npm installUse two terminals.
cd backend
source .venv/bin/activate
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000Backend health check:
curl http://localhost:8000/healthcd frontend
npm run devOpen:
http://localhost:3000(redirects to/recovery)- Practitioner view:
http://localhost:3000/dashboard - Client recovery loop:
http://localhost:3000/recovery
- Open
/dashboardfor practitioner-side view. - Use sidebar
Switch Userto move into a client profile. - Open
/recoveryand enable camera in Virtual Coach. - Complete daily exercises to log ROM/XP.
- Review progress charts and insights.
- Use "Reset Today's Coach Data" for repeated demo runs.
Base prefix: /api/v1
- Assessment:
POST /assess/videoPOST /assess/mock- Client loop:
GET /client/{patient_id}/dashboardGET /client/{patient_id}/daily-logsPOST /client/{patient_id}/daily-game/completePOST /client/{patient_id}/daily-game/reset-todayPOST /client/{patient_id}/appointment-request- Session/protocol/summary routes are also available in
backend/app/api/v1/endpoints.
This usually indicates an incompatible or broken MediaPipe install. Reinstall backend deps inside the backend venv:
cd backend
source .venv/bin/activate
pip uninstall -y mediapipe
pip install mediapipe==0.10.33- Confirm backend is running on
:8000 - Confirm
NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1 - Restart
npm run devafter env changes
- Allow browser camera permission
- Ensure no other app is locking the camera
- For phone webcams, confirm the virtual camera appears in browser device list
- Ensure
ELEVENLABS_API_KEYis present infrontend/.env.local - Verify available credits and TTS permission scope on the key
- Check browser console/network for
/api/ttserrors
cd frontend
npx tsc --noEmitcd backend
source .venv/bin/activate
python -m pip check