A Java-based fitness management application that lets users track their workouts, exercises, and progress, and create personalized workout plans. The system provides both a graphical interface (Swing) and a command-line interface for flexibility.
| Name | Student ID | Section | Contribution |
|---|---|---|---|
| Muhammad Arham | 023-25-0020 | E | Overall project setup, architecture, database integration, UI flow, and coordination |
| Luksh Arija | 023-25-0057 | E | Workout logging module |
| Ubaid | 023-25-0113 | E | Workout plans module |
| Uzair Khan | 023-25-0136 | E | Progress tracking module |
Problem Solved: Fitness enthusiasts and gym-goers often lack an integrated system to track their workouts, monitor progress over time, and manage personalized workout plans.
Target Users: Individual fitness enthusiasts, gym members, personal trainers, and anyone tracking fitness goals.
Motivation: This project applies core OOP principles to build a real-world fitness tracking application, demonstrating proper database design, layered architecture, user authentication, and both GUI and CLI interfaces.
The project follows a layered architecture with clear separation of concerns:
Entity classes representing core domain objects:
User.java— User profile with fitness goals and metricsExercise.java— Exercise definitions with categories (Strength, Cardio, Flexibility)Workout.java— Individual workout log entriesWorkoutPlan.java— Personalized workout plansWorkoutPlanItem.java— Individual exercises within a workout planProgressEntry.java— Body measurements and progress trackingCategory.java— Exercise category enumeration
Data access objects (DAOs) implementing CRUD operations:
DBConnection.java— MySQL connection management (reads password fromDB_PASSWORDenvironment variable)UserDAO.java— User registration, login, profile updatesExerciseDAO.java— Exercise catalog managementWorkoutDAO.java— Workout logging and retrievalWorkoutPlanDAO.java— Workout plan CRUD operationsWorkoutPlanItemDAO.java— Workout plan items managementProgressEntryDAO.java— Progress tracking data persistence
Business logic layer:
AuthService.java— User authentication and registrationWorkoutService.java— Workout logging and retrievalWorkoutPlanService.java— Workout plan creation and managementProgressService.java— Progress trackingServiceResult.java— Standardized result wrapper for service operations
Swing-based presentation layer:
FitnessSwingApp.java— Main GUI application and window managementLoginPanel.java— User authentication UIRegisterPanel.java— New user registration UIDashboardPanel.java— Main dashboard with workout trackingWorkoutDialog.java— Dialog for logging workoutsMenuHandler.java— CLI menu interfaceAppTheme.java— Centralized styling and color scheme
- Encapsulation — Private fields with public getters/setters; business logic in service classes; DB details hidden in
DBConnection - Inheritance — Entity classes share common patterns; DAO classes share common methods
- Polymorphism — Multiple UI components implementing common interfaces
- Abstraction — Abstract data access patterns in DAOs; service interfaces defining contracts
- Collections —
ArrayList/HashMapfor exercises, workout plans, and progress entries - Exception Handling — Database and SQL exceptions with error messages; input validation
- Database Usage — MySQL with proper relational schema, foreign keys, and transaction management
- User authentication — secure login and registration
- Workout logging — log completed workouts with sets, reps, and weight
- Exercise catalog — pre-defined exercise library organized by category
- Workout plans — create and follow custom workout plans
- Progress tracking — monitor weight, body measurements, and fitness metrics
- Dual interface — both GUI (Swing) and CLI modes
- Data persistence — MySQL database with proper relational schema
- Java Development Kit (JDK): Version 11 or higher
- MySQL Server: Version 5.7 or higher
- MySQL Connector/J: Already included in the
lib/folder
Start your MySQL server, then run the schema script:
# Linux / Mac
mysql -u root -p < src/schema.sql
# Windows (Command Prompt)
mysql -u root -p < src\schema.sqlEnter your MySQL root password when prompted. This creates the FitnessMS database, all tables, and inserts sample exercise data.
DBConnection.java reads your MySQL password from an environment variable to avoid hardcoding credentials.
# Linux / Mac (add to ~/.bashrc or ~/.zshrc to make it permanent)
export DB_PASSWORD=your_mysql_password
# Windows (Command Prompt)
set DB_PASSWORD=your_mysql_password
# Windows (PowerShell)
$env:DB_PASSWORD="your_mysql_password"If your MySQL username is not root, also update DB_USER in src/database/DBConnection.java.
From the project root directory:
# Linux / Mac
find src -name "*.java" > sources.txt
javac -d bin -cp "lib/*" @sources.txt
# Windows (Command Prompt)
dir /s /b src\*.java > sources.txt
javac -d bin -cp "lib/*" @sources.txt
# Windows (PowerShell)
Get-ChildItem -Recurse -Filter *.java src | ForEach-Object { $_.FullName } | Set-Content sources.txt
javac -d bin -cp "lib/*" @sources.txtMake sure the bin/ directory exists before compiling:
mkdir bin # Linux / Mac
mkdir bin # WindowsGUI Mode (default):
# Linux / Mac
java -cp "bin:lib/*" Main
# Windows
java -cp "bin;lib/*" MainCLI Mode:
# Linux / Mac
java -cp "bin:lib/*" Main cli
# Windows
java -cp "bin;lib/*" Main cliForce GUI even on a headless system:
# Linux / Mac
java -cp "bin:lib/*" Main gui
# Windows
java -cp "bin;lib/*" Main gui- First-time users: Click "Register" to create an account
- Returning users: Login with your credentials
- From the dashboard you can log workouts, manage workout plans, and track progress
| Table | Purpose |
|---|---|
| users | User profiles and credentials |
| exercises | Exercise library (Strength, Cardio, Flexibility) |
| workout_logs | Individual workout sessions |
| workout_plans | Custom workout plans per user |
| workout_plan_items | Exercises within each plan |
| progress_entries | Body metrics and measurement tracking |
fitness-management-system/
├── src/
│ ├── Main.java # Application entry point
│ ├── schema.sql # Database schema and sample data
│ ├── models/ # Entity classes
│ ├── database/ # Data access objects (DAOs)
│ ├── services/ # Business logic
│ └── ui/ # Swing GUI components
├── bin/ # Compiled .class files (create before compiling)
├── lib/ # MySQL Connector/J (included)
└── README.md
Video Demo: https://youtu.be/Lkay6qZZ4DA
5-minute walkthrough covering project purpose, architecture, main features, and member contributions.
GitHub Repository: https://github.com/ArhamTheDeveloper/fitness-management-system