Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FormLens Fitness Coach

Version

This repository is currently on the v2.0.0 black and red liquid-glass release.

Mobile-first fitness app that scans a gym machine photo and returns technique coaching with an animated video lesson, audio cues, haptic feedback, scan history, and payment method capture.

What is included

  • React mobile UI served from public/app.js
  • Node.js API in server/index.js
  • SQLite database using Node's built-in node:sqlite
  • Seeded machine technique library with coaching steps and safety cues
  • Photo upload API with recognition service in server/recognition.js
  • Audio coaching through the browser Speech Synthesis API
  • Haptics through the mobile Vibration API
  • Demo-safe payment method storage and membership plans
  • Optional Stripe SetupIntent endpoint if STRIPE_SECRET_KEY is configured
  • PWA manifest and service worker
  • Free browser-side CLIP vision assist through Hugging Face Transformers.js

Run

This project uses no installed npm packages because this environment has Node but no package manager on PATH. The browser loads React, Babel, and Lucide icons from CDN, so the first frontend load needs internet access.

node server/index.js

Then open:

http://localhost:4173

API

GET  /api/health
GET  /api/equipment
GET  /api/equipment/:id
GET  /api/equipment/:id/audio
POST /api/scan
GET  /api/scans
GET  /api/payments/methods
POST /api/payments/methods
POST /api/payments/setup-intent
POST /api/memberships

POST /api/scan expects JSON:

{
  "image": "data:image/jpeg;base64,...",
  "filename": "leg-press.jpg",
  "hint": "leg press"
}

Payment notes

The local payment form is intentionally demo-safe. It does not store full card numbers. It stores brand, last 4, expiry, provider, and a demo token in SQLite.

For production payments, use Stripe Elements on the frontend and configure STRIPE_SECRET_KEY on the server. The included /api/payments/setup-intent endpoint is ready for that backend flow.

Vision model upgrade path

The app now includes a free browser-side zero-shot image classifier adapter using Hugging Face Transformers.js and Xenova/clip-vit-base-patch32. It compares the uploaded photo against the seeded gym machine labels, then uses the backend scanner as a reliable fallback if the model download is slow or unavailable.

For production-grade recognition, train or fine-tune a gym-machine classifier and replace the adapter/fallback path:

  1. Upload the photo to the backend exactly as the app does now.
  2. Send the image buffer to a vision provider or custom model.
  3. Return the detected machine slug and confidence.
  4. Keep the existing equipment database response shape so the frontend does not need to change.

About

FormLens v1.0.0 🏋️‍♂️ is a mobile-first fitness technique coach built to help users scan gym machines, learn correct form, and train with clearer confidence through animated guidance, audio cues, haptics, and a real Node.js backend.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages