FitWise

A workout assistant that builds routines in chat and corrects form from the webcam using MediaPipe pose tracking, local LLMs, and RAG.

Warpspeed 2025

🎓 WeWork Galaxy

📌 Bengaluru, Karnataka

🚀 24 hours Hackathon Project

What it is

FitWise is a web app that creates workout plans through a chat assistant and then watches you perform them through a webcam. It counts repetitions, scores each one, and gives short feedback as text or Bengali speech. The language models run locally through LM Studio. Only the optional voice feedback calls a hosted API.

The problem

Workout apps usually separate planning from execution. A chat tool can write a routine, but it cannot see whether you squat deep enough. A pose tracker can see you, but it only supports the exercises its authors hard-coded.

FitWise connects the two. The assistant that writes the routine also generates the tracking configuration for each exercise in it, so the camera side is not limited to a fixed list.

How it works

The app is a SvelteKit project with server routes under src/routes/api/. Three flows share one Postgres database (through Prisma) and one vector store (Qdrant).

FlowEntry pointWhat happens
Chat and planningapi/chat/+server.tsStreams a reply with the Vercel AI SDK. The model can call three tools: createWorkout, saveWorkout, and generateExerciseConfig.
Exercise configurationapi/exercise-config/+server.tsAsks the model for a structured config (Zod schema) and saves it in the ExerciseConfig table.
Form feedbackapi/feedback/+server.tsTakes per-rep measurements and returns a score, a class (good, okay, bad), and a short comment.

Retrieval (RAG)

RAG (retrieval-augmented generation) means the app fetches relevant text and adds it to the prompt before the model answers. A Python script in embedding/ scrapes RP Strength hypertrophy articles, splits them into chunks of up to 2,000 characters, embeds them, and stores them in a Qdrant collection named rp_exercises.

The chat route only searches that collection when the message contains a fitness keyword. It keeps results with a similarity score of at least 0.7. The feedback route uses a lower cut-off of 0.6 and only runs retrieval when the user enables it.

Pose tracking

The browser runs MediaPipe's pose landmarker (@mediapipe/tasks-vision) on the webcam stream. src/lib/workout-utils.ts turns the 33 landmarks into joint angles and processes them in four steps:

  1. Combine the configured joint angles into one weighted signal.
  2. Smooth the signal with a moving average.
  3. Detect peaks and valleys, with a minimum distance between peaks, to split the signal into repetitions.
  4. Send each finished repetition (duration, angle range, range of motion) to the feedback route.

Exercise configurations

A generated configuration lists the landmark triples that define each tracked angle, a weight, a target low and high angle, whether to invert the signal, the starting direction, and the minimum peak distance. The ExerciseConfig table stores it as JSON next to metadata such as movement pattern and key joints. Workout exercises link to a config by foreign key. The client also keeps an in-memory cache.

What I built

I built the whole project alone. That covers the pose tracking and rep segmentation, workout chat and management, the Qdrant retrieval pipeline, the local-model feedback and the Sarvam voice output.

Design decisions

Structured output instead of free text. The config and feedback routes call generateObject with a Zod schema. A small local model can still return malformed JSON, but the schema gives a clear validation point. The config schema also bounds values, such as 5 to 20 frames for peak distance.

Generated tracking configs instead of a fixed exercise list. An earlier version tracked only bicep curls, squats, and push-ups (docs/DYNAMIC_EXERCISE_CONFIG.md). Generating configs removes that limit. The cost is that a model can choose wrong joints, and the app has no automatic check for that. The repo includes pages to view and test saved configs.

Local models. The app uses qwen/qwen3-4b for chat and a DeepSeek R1 distilled Qwen3 8B model for feedback, both served by LM Studio over an OpenAI-compatible API. This keeps prompts and workout data on the machine, apart from the optional speech request. The trade-off is lower answer quality than hosted models and a hardware requirement.

Separate toggles for retrieval and voice. Each feedback request carries enableRAG and enableVoice flags. Retrieval and speech add latency, so the user can pick fast text feedback or slower, richer feedback. Speech comes from the Sarvam AI text-to-speech API.

Challenges I ran into

These notes are mine, from building the app during the hackathon.

Turning pose landmarks into usable angles. Raw MediaPipe output is noisy. I combined several joint angles into one weighted signal, smoothed it with a moving average, and used a peak detector that adapts to each exercise. Normalizing the angles also made them easier for the model to interpret.

Latency with several models running. Embedding, vector search, and generation each add delay, and the local models compete for RAM with the pose tracker. I raised the relevance threshold for retrieval and cached exercise configs so the app skips repeated generation.

Getting a clean knowledge base. The retrieval quality depends on the scraped text. I limited the sources to RP Strength articles rather than general fitness blogs.

Local model quality. Small models give less nuanced feedback than large hosted ones. I picked qwen3-4b for its instruction following and tuned prompts for it.

Run it locally

You need Node.js, pnpm, Docker, a PostgreSQL database, LM Studio, and a webcam.

  1. Clone the repository and install dependencies.

    git clone https://github.com/WhyAsh5114/fit-wise
    cd fit-wise
    pnpm install
    
  2. Start Qdrant.

    docker run -p 6333:6333 -v $(pwd)/qdrant_storage:/qdrant/storage qdrant/qdrant
    
  3. In LM Studio, load a chat model (qwen/qwen3-4b) and an embedding model (text-embedding-nomic-embed-text-v1.5). Start the local server on port 1234.

  4. Fill the vector store from the embedding/ directory.

    cd embedding
    uv sync
    uv run main.py
    cd ..
    
  5. Create a .env file with these variables. SARVAM_API_KEY is read by the feedback route for voice output.

    DATABASE_URL="postgresql://user:password@localhost:5432/fitwise"
    LM_STUDIO_URL="http://localhost:1234"
    EMBEDDING_MODEL="text-embedding-nomic-embed-text-v1.5"
    QDRANT_URL="http://localhost:6333"
    BETTER_AUTH_SECRET="your-secret-key"
    BETTER_AUTH_URL="http://localhost:5173"
    SARVAM_API_KEY="your-sarvam-key"
    
  6. Apply the database migrations and start the dev server.

    pnpm prisma migrate dev
    pnpm dev
    

The feedback route also hard-codes http://172.21.96.1:1234 as the LM Studio address for its chat model. Change it in src/routes/api/feedback/+server.ts if your server runs elsewhere.

Reference

AreaChoiceUsed for
FrameworkSvelteKit, Svelte 5, TypeScriptUI and server routes
UITailwind CSS 4, shadcn-svelte componentsStyling and components
AI orchestrationVercel AI SDK (ai), ZodStreaming chat, tool calls, structured output
ModelsLM Studio (OpenAI-compatible API)Chat, feedback, embeddings
Vector storeQdrantExercise-science chunks for RAG
Pose trackingMediaPipe Tasks VisionIn-browser landmark detection
DatabasePostgreSQL with PrismaUsers, workouts, exercises, exercise configs
AuthenticationBetter Auth (anonymous plugin)Sessions
SpeechSarvam AI text-to-speechSpoken feedback in Bengali

Main database models: Workout, WorkoutExercise, and ExerciseConfig, plus the Better Auth tables.

Outcome

I built FitWise alone at Warpspeed 2025, a 24-hour Devfolio hackathon in Bengaluru on 21 June 2025. The hackathon page records no placement. The repository's commits run from 21 June to 22 June 2025, and the repo has no later activity.

Liked FitWise? Here's my background.

Full-stack TypeScript, shipped to real users.