Interactive 3D exercise demonstrations with a conversational coach.
Translation pending
Sports & fitnessGitHub @selim-baOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
Repository information has not been collected yet.
No updates detected yet. GitHub releases will appear here.
The maker's introduction consists of the line above. Read the repository README for more details. Repository README ↗
Loading the full README.
Read the full README ↗3D exercise demos you can steer by talking to an AI coach.
An experiment, not a product. Gym3DBeta is a personal side project built to test OpenAI's latest model, GPT-6.1 Sol, on a concrete job. The model doesn't only chat: it drives a live 3D scene through strict tool calls (pick an exercise, turn the camera, slow down, stop at the hardest point, show form cues) and explains what you're looking at. The interesting question was how much of an app a model can steer reliably once it is given a small, validated set of actions. Everything here is a work in progress: expect rough edges, and don't take it as fitness or medical advice.
The model interprets what you want; the app decides what is allowed and does it. GPT-6.1 Sol never touches the animation directly.
You ─▶ "Slow it down and pause at the bottom"
│
▼
POST /api/coach (Next.js route, server only)
├─ system prompt + exercise catalog + current scene state
├─ OpenAI Responses API, one strict tool: control_scene(commands[])
└─ Zod validation: unknown exercises, phases or cues are rejected
│
▼
{ message: "Here's the bottom, at half speed…",
commands: [ set_speed 0.5, seek_phase bottom, pause, show_cues [...] ] }
│
▼
Browser: validates again in the scene reducer, then plays it in three.js
The command set is deliberately small: select_exercise, play, pause, set_speed, set_view, seek_phase, reset, show_cues and clear_cues. Coaching text comes from a hand-written catalog of cues for each exercise, so the model explains the cues the app can draw instead of inventing thresholds. When you ask for an exercise that isn't in the catalog, the coach says so and offers a supported one.
What the experiment showed so far:
npm run coach:eval), every live response produced valid commands, with a median round trip of about 3.4 s on the deployed site.npm run dev:mock) powers offline rehearsal and the end-to-end tests.The bodies use Meta's MHR parametric body model. Python scripts in research/avatar-pipeline/ generate the motions offline. No motion-capture data is used.
The built-in bodies (public/models/mhr-generic*.glb) are committed. Photo avatars are built on demand by an optional service (services/avatar/, on Modal) and are never stored in this repository. The app hides avatar creation when the service isn't configured, so you don't need it to run Gym3DBeta locally.
| Area | Tools |
|---|---|
| App | Next.js 16 (App Router), React 19, TypeScript, Tailwind CSS v4, Zustand |
| 3D | three.js, React Three Fiber, drei |
| AI | OpenAI Responses API (GPT-6.1 Sol) with strict function calling, Zod |
| Avatars | MHR (TorchScript), SAM 3D Body, NumPy, OpenCV, custom IK and GLB writer |
| Quality | Vitest (unit and API tests with a fake OpenAI client), Playwright (iPhone 13 viewport), ESLint, asset validation |
| Hosting | Vercel (app), Modal (optional avatar service) |
Prerequisites: Node.js 20.9+ and npm. For the real coach, you need an OpenAI API key with access to gpt-6.1-sol.
git clone https://github.com/selim-ba/forma-ai-coach.git
cd forma-ai-coach
npm install
cp .env.example .env.local # then add your OpenAI key, or set COACH_MODE=mock
npm run dev # http://localhost:3000
No key? npm run dev:mock runs the keyword coach, and everything else works the same.
To try it on your phone over the same Wi-Fi, run npm run dev -- -H 0.0.0.0 and open http://<your-computer's-ip>:3000. To install it on the home screen, deploy over HTTPS (for example on Vercel, framework preset Next.js) and set the OpenAI variables as server environment variables. Keys stay on the server: never prefix them with NEXT_PUBLIC_ and never commit .env.local.
| Command | What it does |
|---|---|
npm run dev | Development server |
npm run dev:mock | Development server with the offline keyword coach |
npm run check | Typecheck, lint, unit tests and asset validation |
npm test | Vitest: scene reducer, catalog and clip markers, cue anchors, /api/coach tool loop |
npm run test:e2e | Playwright at the iPhone 13 viewport (needs npm run build and npx playwright install first) |
npm run coach:eval | Sends the test prompts to a running app and checks the commands, validity and latency |
npm run assets:validate | Checks the GLB files: rig, clips, durations and floor contact |
src/
app/ pages, icons, manifest, API routes (/api/coach, /api/avatar)
components/
viewer/ 3D canvas, avatar playback, camera, form-cue overlays
controls/ playback bar, phase buttons, exercise picker
coach/ chat panel and Actions log
avatar/ avatar menu and photo capture flow
layout/ app shell and welcome screen
lib/
exercises/ exercise catalog (clips, phase markers, cues): the source of truth
scene/ command schema, reducer and store
openai/ client, tool definition, system prompt
coach/ coach handler (live and mock)
cues/ 3D cue definitions per exercise
public/models/ generic man and woman bodies, legacy mannequin
research/avatar-pipeline/ MHR bake: poses, IK, clothes, texture, GLB export
services/avatar/ optional photo-to-avatar service (Modal)
tests/ Vitest suites and Playwright end-to-end test
research/.More detail: ASSETS.md (asset sources and licences), IMPLEMENTATION_PLAN.md (the original 20-hour plan), research/avatar-pipeline/README.md (avatar pipeline).