
AIdeas: MotionMatch AI
A privacy-first, serverless "Virtual Spotter" that uses edge-compute computer vision and Amazon Bedrock to provide real-time biomechanical fitness coaching directly in your phone or Web browser.
App category
Daily Life Enhancement
My vision
My vision is to democratize access to safe, professional-grade biomechanical training. I built MotionMatch AI, a browser-based, serverless "Virtual Spotter" that uses real-time computer vision and generative AI to coach users through physical movements.
Currently, AI fitness applications gatekeep their technology behind expensive proprietary hardware or hefty subscriptions. I wanted to build a platform that requires nothing but a standard smartphone or laptop webcam. While the MVP focuses on Gym & Fitness (Squats, Push-ups, Planks, Deadlifts), the application uses a "Painted Door" Hub-and-Spoke architecture designed to eventually support Sports Performance and Dance.
Why this matters
Lifting weights or performing bodyweight exercises with improper form is a fast track to chronic injury. For millions of beginners, personal trainers are too expensive, and working out alone is intimidating.
MotionMatch AI matters because it removes both the financial and safety barriers to physical wellness with a 100% Privacy-First approach. Because the computer vision processes locally on the edge, the user's video feed never leaves their device. We aren't just telling people that their form is wrong; we are using empathetic AWS Generative AI to tell them exactly how to fix it in real-time.
How I built this
To balance zero-latency tracking with strict AWS Free Tier cost optimization, I engineered a hybrid Edge-Cloud architecture.
The Edge Frontend (Privacy & Latency): I built the client using React and Vite. The core engine uses Google's MediaPipe Pose Landmarker (WebAssembly), which runs entirely in the browser at an adaptive 15-30fps based on the user's device capabilities. It extracts 33 pose landmarks per frame. By calculating the joint angles client-side using 3D vector math, I achieved sub-30ms latency. The UI renders the skeleton and angle annotations on a canvas overlay using
requestAnimationFrame for 60fps visual smoothness.The Biomechanics State Machines: Instead of generic pose classification, I built exercise-specific validators:
- Squats (Dynamic): Utilizes a 5-state Finite State Machine (FSM). To prevent noise and false positives, the logic requires 5 consecutive frames in a target angle range before transitioning states and counting a rep.
- Push-ups (Side-Profile): I wrote a custom algorithm that calculates the average visibility of the left vs. right joints (Shoulder-Elbow-Wrist). It dynamically selects the side with the higher visibility score (>0.5) to track, re-evaluating every 30 frames to handle mid-workout user rotation.
- Planks (Isometric): Uses a frame-based accumulator timer. The timer increments only when the Core Alignment Angle (Shoulder-Hip-Ankle) is ≥ 165°. If the angle drops, the timer pauses and the UI flashes yellow until the user corrects their form.
The AWS Backend (The "Brain"): Zero video data is transmitted to the backend. The app only pings the cloud via Amazon API Gateway when a mathematical "Danger Zone" threshold is breached.
- AWS Lambda receives these lightweight text-based issue descriptions.
- Amazon Bedrock (Amazon Nova Lite) is invoked to generate personalized coaching cues. I specifically chose Nova Lite to drastically reduce token costs while maintaining lightning-fast inference.
- Amazon DynamoDB stores the "Golden Reference" thresholds and maps form issues to curated tutorial videos.
How Kiro Accelerated Development: AWS's Kiro assistant was instrumental. I used highly structured prompt engineering to have Kiro generate the React state machines and MediaPipe visibility logic. Kiro was specifically utilized to build the dynamic UI that automatically swaps our dynamic "Rep Counter" component into an isometric "Hold Timer" when the user selects a Plank.
Demo

What I learned: Overcoming Technical Hurdles
Building a real-time computer vision app in React introduced intense performance challenges that forced me to level up my architecture skills.
- React Render Thrashing vs. 60fps Animation: The biggest hurdle was syncing the Plank Validator's internal accumulator (running in a 60fps animation loop) with React's UI state without causing massive render thrashing. I learned to implement a polling pattern in my
usePoseDetectionhook. It reads the elapsed time every frame but uses a comparator to only triggersetStatewhen the actual integer changes, keeping UI latency under 16ms with zero performance degradation.
- The "Black Screen" Race Condition: When navigating between the Dashboard and the Workout screens, the webcam would occasionally fail to load. I learned how to debug asynchronous browser APIs, eventually building a multi-layered fix that ensures
cleanupWebcam()fully releases the stream beforegetUserMedia()re-initializes, alongside a ResizeObserver to prevent 0x0 canvas errors.
- Frame-Based Accumulators for Edge Cases: Users often do "half-rep" pushups. Single-frame validation couldn't tell if a user was descending or just stopping early. I learned to build frame accumulators that track incomplete depth (100°-130°) for consecutive frames, successfully filtering out noise and reducing false-positive warnings by 87%.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article