Skip to content

A full-stack fitness tracking PWA with AI meal analysis, offline support, and a clean mobile-first UI. Built with FastAPI, React, and service workers.

License

Notifications You must be signed in to change notification settings

rohan2107/gym-bro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Gym Bro

License Build Python FastAPI

🚀 Live Demo: https://gym-ba2oz8etc-rohan-anthonys-projects-a86489a8.vercel.app

A modern fitness Progressive Web App (PWA) for tracking nutrition and training. Features mobile-first design, offline support, and full CRUD operations for daily check-ins, meals, and workouts.

Stack: React + Vite + Tailwind (frontend) | FastAPI + SQLModel (backend) | PostgreSQL on Neon | Deployed on Vercel

Next Phase: Google OAuth 2.0 authentication for multi-user support

Features

  • ✅ Mobile-first PWA with offline support
  • ✅ Daily check-ins (weight, steps, training status)
  • ✅ Food logging with calorie/macro tracking
  • ✅ Workout tracking with exercise sets
  • ⏳ Google OAuth authentication (Phase 2)
  • ⏳ AI meal photo analysis (Phase 3)
  • ⏳ Analytics dashboard with trends (Phase 3)

Monorepo Structure

  • gymbro-api/: FastAPI backend with SQLModel for persistence.
  • gymbro-web/: Frontend PWA (React + Vite + Tailwind).
  • gymbro-analytics/: Data analysis and reporting (to be added after MVP).
  • infra/: Deployment, IaC, and environment configuration (future work).

Backend (API)

The API is a FastAPI service using SQLModel/SQLAlchemy for the database layer and Pydantic v2 for settings/models.

  • Entry: gymbro-api/app/main.py
  • Config: gymbro-api/app/config.py (defaults to SQLite; .env supported)
  • DB: gymbro-api/app/db.py (creates engine, initializes tables, provides sessions)
  • Routers: gymbro-api/app/routers (health, daily check-ins, food logs, weight entries, workouts, exercise sets)
  • Models: gymbro-api/app/models.py

Quick Start (Windows CMD)

Run the API locally with SQLite (default). Postgres can be used later by setting DATABASE_URL in .env.

cd gymbro-api
python -m venv .venv
.\.venv\Scripts\activate
pip install -r requirements.txt
uvicorn app.main:app --reload

Then visit http://localhost:8000/docs for interactive API docs. The health endpoint will be added soon.

Quick API Examples

Create a food log (once tables are initialized):

curl -X POST http://127.0.0.1:8000/food-logs/ \
	-H "Content-Type: application/json" \
	-d "{\"user_id\":1,\"description\":\"Chicken bowl\",\"calories\":650,\"protein_g\":45,\"carbs_g\":60,\"fat_g\":20}"

List food logs:

curl http://127.0.0.1:8000/food-logs/

Configuration

  • Default dev DB: sqlite:///./gymbro.db
  • Override via .env in gymbro-api/:
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/gymbro

Local Dev Quickstart (Windows, PowerShell)

From repo root:

python -m venv gymbro-api/.venv
./gymbro-api/.venv/Scripts/activate
pip install -r gymbro-api/requirements.txt

# Frontend env
Set-Content -Path gymbro-web/.env.local -Value "VITE_USER_ID=1"

# Start backend + frontend (opens two terminals)
powershell -ExecutionPolicy Bypass -File scripts/start-all.ps1
  • Backend only: powershell -ExecutionPolicy Bypass -File scripts/start-backend.ps1 -ApiHost 127.0.0.1 -Port 8000
  • Frontend only: powershell -ExecutionPolicy Bypass -File scripts/start-frontend.ps1 (add -Build to run npm run build).
  • Vite dev server proxies /apihttp://127.0.0.1:8000.
  • If schema changes cause sqlite errors, stop services, delete gymbro-api/gymbro.db, and restart to regenerate tables.

Frontend (gymbro-web)

  • React 18 + Vite 5 + TypeScript + Tailwind.
  • Env: VITE_USER_ID is required to set the X-User-Id header (defaults to 1 if not set).
  • UI flows: daily check-in (weight/steps/trained/protein/notes), meal logging (description + optional calories), workouts (name + optional note). Lists show newest first.

Data Model (current)

  • User, DailyCheckIn, FoodLog, WeightEntry, Workout, ExerciseSet, NutrientEntry.

Deployment

Live: https://gym-ba2oz8etc-rohan-anthonys-projects-a86489a8.vercel.app
Status: ✅ Production (Frontend + Backend + PostgreSQL)
Guide: DEPLOYMENT_GUIDE.md

Documentation

Contributing

License

MIT — see LICENSE.

About

A full-stack fitness tracking PWA with AI meal analysis, offline support, and a clean mobile-first UI. Built with FastAPI, React, and service workers.

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •