About
## The problem it solves
## The problem
Home fitness has two broken options today:
- **Hiring a trainer** costs $50–150/hour, pricing out most people from getting real, personalized feedback on their movement.
- **Fitness apps** (Nike Training Club, generic workout trackers) just play you a demo video and hope you copy it correctly. They count reps from a phone's accelerometer or manual logging — they have no idea if your actual form is safe.
The result: people train with bad form for months without knowing it, plateau, or get hurt. Research on fitness-related injuries found that **73% happen during unsupervised training** — precisely the moment nobody is there to catch a mistake before it becomes an injury.
## What RepCoach does
RepCoach is a real-time AI form coach that runs entirely in your browser using a standard webcam — no wearables, no app install, no subscription.
- **Live pose tracking** — Google MediaPipe's PoseLandmarker tracks 33 body landmarks at 25–30 fps, running client-side via WebAssembly/GPU. No video is ever uploaded; everything is processed and discarded locally.
- **Real biomechanical grading, not just rep counting** — joint angles are calculated every frame to detect specific form errors: knee valgus (caving in) on squats, hip sag on push-ups and planks, incomplete range of motion on jumping jacks. Errors are flagged on the exact rep they happen, not in a summary afterward.
- **Four supported exercises** — squats, push-ups, jumping jacks (rep-based), and plank holds (time-based isometric tracking).
- **AI Coach chatbot** — answers form questions and can read an uploaded workout-plan PDF to answer questions about it.
- **Progress system** — 7-day activity chart, workout streaks, calorie estimates, personal records per exercise, full workout history.
- **Body metrics** — weight/height input with automatic BMI calculation.
- **Gamification** — unlockable achievement badges, daily streaks, confetti on milestones, voice feedback with selectable coach personality (Supportive / Drill Sergeant), light/dark themes.
- **Accounts** — Firebase Authentication (Google + GitHub sign-in) with Firestore sync across devices, plus a fully offline Guest Mode for trying it instantly with zero signup.
- **Installable PWA** — works like a native app on mobile with no app store required.
## Tech stack
**Frontend:** React 19, TypeScript, Vite, Tailwind CSS, Framer Motion **Computer vision:** `@mediapipe/tasks-vision` (PoseLandmarker, GPU-delegated, client-side only) **Backend/data:** Firebase Authentication (Google & GitHub OAuth), Cloud Firestore, `localStorage` for Guest Mode **Other:** Web Speech API (voice feedback), `react-body-highlighter` (muscle engagement diagrams), `canvas-confetti`, `vite-plugin-pwa`
## Challenges we ran into
## 1. Rep counting silently failing on one side of the body
**The bug:** Push-up rep counting was hardcoded to only track the user's left elbow/shoulder/wrist. If the camera angle or the user's position meant the left side wasn't clearly visible, the model's confidence dropped and reps simply stopped incrementing — with no error shown, so it looked like the app was just broken.
**Root cause:** A single boolean flag (`isLeftSide = true`) was passed into the rep-detection function instead of dynamically choosing a side.
**The fix:** We now read MediaPipe's per-landmark `visibility` confidence score (which was previously being discarded before it reached the rep-counting logic) and have the app automatically track whichever side — left or right — has higher confidence on a given frame. This made the squat logic, which already evaluated both sides, the template for fixing push-ups too.
## 2. Camera "switching" that wasn't actually switching cameras
**The bug:** The front/rear camera toggle button changed the UI's mirror state, but on several devices the actual video feed never changed — it just flipped the same camera horizontally with CSS.
**Root cause:** Camera selection relied solely on the `facingMode` constraint in `getUserMedia()`. Many browsers and most laptops/desktops with a single webcam silently ignore this constraint and return whatever camera they were already using.
**The fix:** We switched to enumerating actual physical devices with `navigator.mediaDevices.enumerateDevices()` and requesting a specific camera by its `deviceId`, with `facingMode` kept only as a fallback hint. We also properly stop all tracks on the previous `MediaStream` before requesting a new one to avoid "camera already in use" errors, and persist the user's last-selected camera so it's remembered next session.
## 3. Noisy single-frame pose data causing false or missed reps
**The challenge:** Raw per-frame joint angles are noisy — a single bad frame near a rep's threshold angle could trigger a false rep or cause a real rep to be missed entirely, especially right at the top/bottom of a movement.
**The fix:** We added an exponential moving average (EMA) smoothing pass on joint angles before they reach the rep state machine, plus a minimum-visibility confidence gate so frames where a required joint is occluded or off-screen don't get counted toward a state transition at all.
## 4. Building real auth and sync with zero backend server
**The challenge:** This is a fully static, serverless app (hosted on Surge) — there's no backend to handle authentication or store user data conventionally.
**The fix:** We used Firebase Authentication (Google + GitHub OAuth) and Cloud Firestore entirely from the client, with a parallel `localStorage`-backed Guest Mode so the app is fully usable instantly with zero signup friction — useful both for first-time users and for judges trying the live demo without creating an account.
## 5. Mobile responsiveness and last-minute regression testing
**The challenge:** With most development and testing happening on a desktop browser, the dashboard layout in particular wasn't originally built with small viewports in mind, and a few rapid late-stage feature additions (theme toggle, activity chart, muscle diagram) introduced fresh regressions right before submission.
**The fix:** We ran a dedicated mobile-viewport pass (375px/414px) to fix overflow and tap-target issues, and did a full regression sweep across the recently-touched features — including verifying the muscle-engagement diagram renders correctly for all four exercise types, not just the one most recently edited — before final submission.
Screenshots
Team
From the public Devfolio project page. Votes, swipes and the judge score are hackfeed's own.











