Skip to content

abhiFSD/TrackFitt-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‹οΈ TrackFitt API

FastAPI backend for TrackFitt β€” AI-powered workout recommendations, real-time tracking, token gamification.

FastAPI Python PostgreSQL Docker

Frontend β†’ TrackFitt


Architecture

graph TD
    A[React Client] -->|REST API| B[FastAPI]
    A -->|WebSocket| C[WS Manager]
    B --> D{AI Layer}
    D -->|Exercises| E[DeepSeek API]
    D -->|Suggestions| F[Google AI Studio]
    B --> G[(PostgreSQL)]
    G --> H[17 Tables<br/>SQLAlchemy + Alembic]
    B --> I[S3<br/>Profile Images]
Loading

What's Inside

57 REST Endpoints + WebSocket

AI Features:

  • Exercise recommendations based on fitness level and goals
  • Smart workout plan generation
  • AI-powered exercise categorization

Core API:

  • Full auth flow (JWT + role-based access)
  • Exercise CRUD with 200+ pre-loaded exercises (CSV seed data)
  • Workout creation, scheduling, and active tracking
  • Workout history with detailed set/rep/weight logging
  • Token economy (earn β†’ request β†’ distribute)
  • User profiles with fitness/health/goal data
  • Real-time WebSocket notifications

Admin API:

  • User management (roles, activation)
  • Exercise library management
  • Token request approval/rejection

Data Models (17 Tables)

Model Purpose
User Auth + roles (user/admin)
UserProfile Physical metrics, fitness level, goals
Exercise 200+ exercises with categories
ExerciseCategory Cardio, HIIT, Pilates, Flexibility, Strength
Workout Custom workout templates
WorkoutExercise + Set Exercises within workouts with sets
ScheduledWorkout Planned future workouts
WorkoutHistory Completed workout logs
Token + TokenRequest Gamification currency
Notification Real-time alerts
AITracking AI interaction logs

Quick Start

Docker (recommended)

git clone https://github.com/abhiFSD/TrackFitt-API.git
cd TrackFitt-API
cp .env.example .env    # Add your API keys
docker-compose up -d    # Starts API + PostgreSQL

API available at http://localhost:8000

Manual

pip install -r requirements.txt

# Setup database
alembic upgrade head
python init-db.py

# Run
uvicorn app.main:app --reload --port 8000

Tech Stack

Component Technology
Framework FastAPI
Database PostgreSQL 15
ORM SQLAlchemy 2.0
Migrations Alembic
AI DeepSeek API + Google AI Studio
Auth JWT (python-jose) + bcrypt (passlib)
Storage AWS S3 (boto3)
Real-time WebSockets
Deployment Docker + Docker Compose
Data CSV seed files (200+ exercises)

Project Structure

β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ main.py                # FastAPI app + CORS + WebSocket
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ endpoints.py       # 57 route handlers
β”‚   β”‚   └── auth.py            # JWT auth + password hashing
β”‚   β”œβ”€β”€ models/models.py       # 17 SQLAlchemy models
β”‚   β”œβ”€β”€ schemas/schemas.py     # Pydantic request/response schemas
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ websocket_service  # Connection manager
β”‚   β”‚   └── notification_*     # Push notification system
β”‚   └── db/database.py         # DB session + engine
β”œβ”€β”€ dataCsv/                   # Exercise seed data
β”‚   β”œβ”€β”€ cardio_exercises.csv
β”‚   β”œβ”€β”€ hiit_exercises.csv
β”‚   β”œβ”€β”€ pilates_exercises.csv
β”‚   └── flexibility_exercises.csv
β”œβ”€β”€ migrations/                # Alembic migrations
β”œβ”€β”€ docker-compose.yml         # API + PostgreSQL
β”œβ”€β”€ Dockerfile
└── requirements.txt

Environment Variables

cp .env.example .env
Variable Required Description
AWS_REGION Yes AWS region for S3
AWS_ACCESS_KEY_ID Yes S3 access key
AWS_SECRET_ACCESS_KEY Yes S3 secret
S3_BUCKET Yes S3 bucket for uploads
DEEPSEEK_API_KEY Yes DeepSeek AI key
GOOGLE_AI_STUDIO_KEY Optional Google AI key

License

MIT

About

πŸ‹οΈ TrackFitt backend β€” FastAPI + PostgreSQL + DeepSeek AI + WebSocket real-time notifications

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages