Module
Description
π Authentication
JWT-based register / login with BCrypt password hashing
π€ User Profile
Age, height, weight, gender, fitness goal & activity level
ποΈ Workout Tracker
Log sessions with type, duration, calories, and exercise details
π₯ Nutrition Logger
Track meals with full macro breakdown (protein / carbs / fats)
π Progress Tracker
Log weight entries, auto-calculate BMI, view historical trends
π€ AI Coach
GPT-4o generates personalised 7-day workout plans and daily meal plans via Spring AI
π Exercise Library
Searchable and filterable exercise database seeded at startup
π Swagger UI
Full interactive API documentation at /swagger-ui.html
Layer
Technology
Framework
Spring Boot 3.2 Β· Java 17
AI Integration
Spring AI 1.0.0-M6 Β· OpenAI GPT-4o
Security
Spring Security Β· JJWT 0.12.3 (JWT) Β· BCrypt
Persistence
Spring Data JPA Β· Hibernate Β· MySQL 8
Validation
Jakarta Bean Validation
Documentation
SpringDoc OpenAPI 2.3 (Swagger UI)
Utilities
Lombok Β· MapStruct
Build
Maven 3.9
Layer
Technology
Framework
React 18.2 (Create React App)
Styling
CSS-in-JS with centralised design token system
Charts
Pure SVG (no external chart library)
Fonts
Syne (display) Β· DM Sans (body) via Google Fonts
State
React useState / useReducer hooks
Tool
Version
Java
17+
Maven
3.9+
Node.js
18+
npm
9+
MySQL
8.0+
OpenAI API Key
Get one here
1 Β· Clone the repository
git clone https://github.com/gajendra-ingle/Fitness-Application.git
cd fitnessai
CREATE DATABASE fitness_ai_db ;
Hibernate's ddl-auto: update will create all tables automatically on first run. To seed the exercise library, run:
mysql -u root -p fitness_ai_db < backend/database/schema.sql
cd backend
# 1. Copy and fill in the environment file
cp .env.example .env
# β Set DB_PASSWORD, SPRING_AI_OPENAI_API_KEY, JWT_SECRET
# 2. Build and run
mvn clean install -DskipTests
mvn spring-boot:run
API starts at http://localhost:8080
Swagger UI: http://localhost:8080/swagger-ui.html
cd frontend
# 1. Copy and fill in the environment file
cp .env.example .env
# β REACT_APP_API_BASE_URL is already set to http://localhost:8080/api
# 2. Install and start
npm install
npm start
Opens at http://localhost:3000
fitnessai/
βββ backend/ Spring Boot API
β βββ database/
β β βββ schema.sql DDL + seed data
β βββ .env.example Environment variable template
β βββ src/main/
β βββ resources/
β β βββ application.yml Config (reads from .env)
β βββ java/com/fitnessai/
β βββ FitnessAiApplication.java
β βββ ai/
β β βββ AiFitnessRecommendationService.java GPT-4o via Spring AI
β β βββ WorkoutPlanResponse.java
β β βββ DietPlanResponse.java
β βββ config/
β β βββ ChatClientConfig.java Spring AI ChatClient bean
β β βββ OpenApiConfig.java Swagger JWT config
β βββ controller/
β β βββ AuthController.java
β β βββ ProfileController.java
β β βββ WorkoutController.java
β β βββ NutritionController.java
β β βββ ProgressController.java
β β βββ AiController.java
β βββ dto/
β β βββ request/ RegisterRequest, LoginRequest,
β β β ProfileRequest, WorkoutRequest,
β β β NutritionLogRequest, ProgressRequest
β β βββ response/ AuthResponse, ProfileResponse,
β β WorkoutResponse, NutritionResponse,
β β ProgressResponse
β βββ entity/
β β βββ User.java
β β βββ UserProfile.java FitnessGoal, ActivityLevel, Gender enums
β β βββ Workout.java WorkoutType enum
β β βββ WorkoutExercise.java
β β βββ Exercise.java Difficulty enum
β β βββ NutritionLog.java MealType enum
β β βββ Progress.java
β βββ exception/
β β βββ ResourceNotFoundException.java
β β βββ BadRequestException.java
β β βββ GlobalExceptionHandler.java
β βββ repository/
β β βββ UserRepository.java
β β βββ UserProfileRepository.java
β β βββ WorkoutRepository.java
β β βββ ExerciseRepository.java
β β βββ NutritionLogRepository.java
β β βββ ProgressRepository.java
β βββ security/
β β βββ JwtUtils.java
β β βββ JwtAuthFilter.java
β β βββ UserDetailsServiceImpl.java
β β βββ SecurityConfig.java
β βββ service/
β βββ AuthService.java (+ impl)
β βββ ProfileService.java (+ impl)
β βββ WorkoutService.java (+ impl)
β βββ NutritionService.java (+ impl)
β βββ ProgressService.java (+ impl)
β
βββ frontend/ React SPA
βββ .env.example Environment variable template
βββ public/
β βββ index.html
βββ src/
βββ App.js Root β router + layout
βββ index.js
βββ styles/
β βββ globals.css Reset, animations, scrollbar
βββ constants/
β βββ theme.js Design tokens (colors, fonts, radiusβ¦)
β βββ navigation.js Nav config & page metadata
βββ utils/
β βββ formatters.js Pure helper functions (BMI, durationβ¦)
βββ hooks/
β βββ useLocalStorage.js
β βββ useToggle.js
βββ components/
β βββ Sidebar/ Collapsible nav + streak badge
β βββ Topbar/ Fixed header, search, notifications
β βββ charts/
β β βββ SparkLine/ SVG sparkline
β β βββ DonutChart/ SVG donut
β β βββ BarChart/ SVG grouped bar chart
β β βββ MacroBar/ Horizontal macro progress bar
β βββ ui/
β βββ StatCard/ KPI metric card
β βββ Badge/ Pill label
β βββ Button/ primary / secondary / ghost / danger
β βββ FormField/ input / select / textarea wrapper
β βββ Modal/ Accessible overlay (ESC + backdrop)
β βββ PageCard/ Section card wrapper
βββ pages/
βββ Dashboard/ (components/ + data/)
βββ Workouts/ (components/ + data/)
βββ Nutrition/ (components/ + data/)
βββ Progress/ (components/ + data/)
βββ AICoach/ (components/ + data/)
βββ Exercises/ (components/ + data/)
All endpoints except /api/auth/** require the header:
Authorization: Bearer <your_jwt_token>
Method
Endpoint
Description
POST
/api/auth/register
Register a new user
POST
/api/auth/login
Login β returns JWT token
Method
Endpoint
Description
GET
/api/profile
Get current user's profile
PUT
/api/profile/update
Update profile (goal, weight, heightβ¦)
Method
Endpoint
Description
GET
/api/workouts/user/{userId}
Get all workouts for a user
GET
/api/workouts/{id}
Get a single workout
POST
/api/workouts
Log a new workout
PUT
/api/workouts/{id}
Update a workout
DELETE
/api/workouts/{id}
Delete a workout
Method
Endpoint
Description
POST
/api/nutrition/log
Log a food entry
GET
/api/nutrition/history
All nutrition entries
GET
/api/nutrition/today
Today's entries
DELETE
/api/nutrition/{id}
Delete a log entry
Method
Endpoint
Description
POST
/api/progress/log
Log weight / body metrics (BMI auto-calculated)
GET
/api/progress/history
All progress entries
Method
Endpoint
Description
GET
/api/ai/my-workout-plan
GPT-4o personalised 7-day workout plan
GET
/api/ai/my-diet-plan
GPT-4o personalised daily meal plan
π Full interactive docs with request/response schemas at http://localhost:8080/swagger-ui.html