Skip to content

wei9072/fitAI

Repository files navigation

title FitAI
emoji 💪
colorFrom blue
colorTo green
sdk docker
app_port 8080

FitAI - AI Fitness Coach PWA

FitAI is a full-stack Progressive Web App that provides personalized fitness coaching powered by Google Gemma AI. Users can log workouts and health metrics, then chat with an AI coach that gives context-aware advice based on their actual recorded data.

Features

  • AI Chat Coach - Conversational fitness coaching powered by Gemma 3 (1B-IT) via Google GenAI, with RAG-based context retrieval from user data
  • Coach Personas - Choose between strict, encouraging, or analytical coaching styles
  • Workout Logging - Track workouts with exercises, sets, reps, weight, and distance
  • Health Metrics - Log weight, sleep hours, and energy levels
  • JWT Authentication - Secure registration and login with hashed passwords
  • Chat History - Conversation continuity with recent message recall

Roadmap & Architecture Evolution

This project is currently undergoing a major architectural refactoring to ensure data precision and system scalability.

  • Phase 1: Deterministic Context (Current) - Implementing strict SQLite querying for structured health metrics to guarantee 100% accuracy in the LLM context window.
  • Phase 2: Unstructured Data Embedding (WIP) - Integrating Qdrant Vector Database for semantic search over unstructured workout notes.
  • Phase 3: Agentic Routing - Deploying an Intent Router to dynamically route queries between standard SQL database (for exact stats) and Qdrant (for semantic advice).

Tech Stack

Layer Technology
Frontend React 19, TypeScript, Tailwind CSS 4, Vite 8, React Router 7
Backend FastAPI, SQLAlchemy, Pydantic, PyJWT, bcrypt
AI Google GenAI SDK (Gemma 3 1B-IT)
Database SQLite
Deployment Docker, Docker Compose, Nginx

Project Structure

.
├── backend/
│   ├── app/
│   │   ├── main.py            # FastAPI app entry point
│   │   ├── auth.py            # JWT & password hashing utilities
│   │   ├── database.py        # SQLAlchemy engine & session
│   │   ├── models.py          # ORM models (User, Workout, Exercise, HealthMetric, ChatHistory)
│   │   ├── schemas.py         # Pydantic request/response schemas
│   │   ├── routers/
│   │   │   ├── auth.py        # /auth - register, login, profile, persona
│   │   │   ├── workouts.py    # /workouts - CRUD
│   │   │   ├── health.py      # /health - CRUD
│   │   │   └── chat.py        # /chat - AI conversation
│   │   └── services/
│   │       └── rag_service.py # Builds user context for AI prompts
│   ├── tests/
│   ├── Dockerfile
│   └── requirements.txt
├── frontend/
│   ├── src/
│   │   ├── pages/             # Login, Register, Dashboard, WorkoutLog, HealthLog, ChatPage
│   │   ├── components/        # Layout
│   │   └── api/               # API client
│   ├── Dockerfile
│   └── package.json
├── docker-compose.yml         # Production multi-container setup
├── Dockerfile.dev             # Development environment image
└── run_dev.sh                 # Dev container launch script

Getting Started

Prerequisites

Environment Variables

Create backend/.env:

GOOGLE_API_KEY=your_google_api_key_here
JWT_SECRET=your_jwt_secret_here

Run with Docker Compose (Production)

docker compose up --build

Local Development

Backend:

cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload

Frontend:

cd frontend
npm install
npm run dev

Development Container

A full dev container with Python 3.14, Node.js 24, and AI CLI tools is provided:

./run_dev.sh
sudo docker exec -it fitai-dev-env /bin/bash

API Endpoints

Method Endpoint Description
POST /auth/register Register a new user
POST /auth/login Login and receive JWT
GET /auth/me Get current user profile
PATCH /auth/me/persona Update coach persona
POST /workouts Create a workout
GET /workouts List user's workouts
POST /health Create a health metric
GET /health List user's health metrics
POST /chat Send a message to the AI coach
GET /health Health check

License

This project is private and not licensed for redistribution.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors