How jagtap13/multi-coach-ai-trainer works
This is a multi-coach AI fitness platform. Users authenticate, choose a coach, and send profile-aware questions through chat; the backend retrieves coach-scoped fitness knowledge, generates and safety-checks an answer, then may translate it and attach exercise videos before saving the conversation. The product also supports account/profile management, progress tracking, saved-plan PDF export, feedback, and knowledge-base administration. Edges reflect shown imports/calls or README-documented behavior; several secondary route and frontend details are represented at subsystem level because their implementation was not excerpted.
Main entry points: App.jsx App shell · database.py Database session · main.py FastAPI routes · rag_pipeline.py RAG and safety pipeline
Components 32
Web experience
- App shell
frontend/src/App.jsx - Chat interface
frontend/src/ChatWindow.jsx - Chat history UI
frontend/src/HistoryPanel.jsx - Video cards
frontend/src/VideoCards.jsx - Auth form
frontend/src/AuthForm.jsx - Profile form
frontend/src/ProfileForm.jsx - Progress tracker
frontend/src/ProgressTracker.jsx - Plan viewer
frontend/src/PlanViewer.jsx - Feedback dashboard
frontend/src/FeedbackDashboard.jsx - KB admin UI
frontend/src/KnowledgeBaseAdmin.jsx
Coaching pipeline
- FastAPI routes
backend/app/main.py - RAG and safety pipeline
backend/app/services/rag_pipeline.py - Coach prompts
backend/app/coaches/coach_prompts.py - Ollama inference
backend/app/llm/ollama_client.py
Accounts and tracking
- Auth routes
backend/app/api/auth_routes.py - Reset email
backend/app/api/email_utils.py - Profile routes
backend/app/api/profile_routes.py - Progress routes
backend/app/api/progress_routes.py - Workout plan routes
backend/app/api/workout_plan_routes.py - PDF export
backend/app/services/plan_pdf.py - Feedback routes
backend/app/api/feedback_routes.py
Knowledge and media
- Coach-scoped retriever
backend/app/rag/retriever.py - Knowledge ingestion
backend/app/rag/ingest.py - Video lookup
backend/app/services/youtube_service.py - Nutrition videos
backend/app/services/nutrition_videos.py - KB admin routes
backend/app/api/kb_admin_routes.py
Persistence
- Database session
backend/app/core/database.py - Chat history model
backend/app/models/chat_history.py - User model
backend/app/models/user.py - Exercise video model
backend/app/models/exercise_video.py
Other components
- User
- PostgreSQL
Connections 37
- User → App shell: uses
README.md - App shell → Chat interface: renders
frontend/src/App.jsx - App shell → Auth form: renders
frontend/src/App.jsx - App shell → Profile form: renders
frontend/src/App.jsx - App shell → Progress tracker: renders
frontend/src/App.jsx - App shell → Plan viewer: renders
frontend/src/App.jsx - App shell → Feedback dashboard: renders
frontend/src/App.jsx - App shell → KB admin UI: renders
frontend/src/App.jsx - Chat interface → FastAPI routes: requests chat
README.md - Chat interface → Chat history UI: renders
frontend/src/ChatWindow.jsx - Chat interface → Video cards: renders
frontend/src/ChatWindow.jsx - FastAPI routes → RAG and safety pipeline: requests answer
backend/app/main.py - RAG and safety pipeline → Coach-scoped retriever: retrieves chunks
backend/app/services/rag_pipeline.py - RAG and safety pipeline → Coach prompts: gets persona
backend/app/services/rag_pipeline.py - RAG and safety pipeline → Ollama inference: generates text
backend/app/services/rag_pipeline.py - FastAPI routes → Video lookup: looks up videos
backend/app/main.py - FastAPI routes → Nutrition videos: gets nutrition videos
backend/app/main.py - Knowledge ingestion → Coach-scoped retriever: builds knowledge index
README.md - Auth form → Auth routes: authenticates
README.md - Auth routes → Reset email: sends reset email
backend/app/api/auth_routes.py - App shell → Profile routes: loads profile
- App shell → Progress routes: manages progress
- App shell → Workout plan routes: manages plans
- Workout plan routes → RAG and safety pipeline: structures plan
backend/app/api/workout_plan_routes.py - Workout plan routes → PDF export: builds PDF
backend/app/api/workout_plan_routes.py - App shell → Feedback routes: manages feedback
- App shell → KB admin routes: administers knowledge
- FastAPI routes → Chat history model: saves conversations
backend/app/main.py - Auth routes → User model: reads and writes users
backend/app/api/auth_routes.py - Video lookup → Exercise video model: caches videos
backend/app/services/youtube_service.py - Database session → PostgreSQL: connects
backend/app/core/database.py - Chat history model → Database session: uses base
backend/app/models/chat_history.py - User model → Database session: uses base
backend/app/models/user.py - Progress routes → Database session: queries entries
backend/app/api/progress_routes.py - Workout plan routes → Database session: stores plans
backend/app/api/workout_plan_routes.py - Feedback routes → Database session: stores feedback
backend/app/api/feedback_routes.py - KB admin routes → User model: checks admin
backend/app/api/kb_admin_routes.py