The Workout Tracker is a backend system built with Spring Boot that allows users to manage their workouts, track progress, and generate reports. The system features JWT authentication, CRUD operations for workouts, and a data seeder for exercises.
- Data Seeder: Populate the database with a list of exercises.
- Exercise Attributes: Each exercise should have a name, description, and category (e.g., cardio, strength, flexibility) or muscle group (e.g., chest, back, legs).
- Sign-Up: Allow users to create an account.
- Login: Allow users to log in to their account.
- JWT Authentication: Use JSON Web Tokens for authentication and authorization.
- Access Control: Only authenticated users should be able to create, update, and delete workout plans. Users should only be able to access their own workout plans.
- Create Workout: Allow users to create workouts composed of multiple exercises.
- Update Workout: Allow users to update workouts and add comments.
- Delete Workout: Allow users to delete workouts.
- Schedule Workouts: Allow users to schedule workouts for specific dates and times.
- List Workouts: List active or pending workouts sorted by date and time.
- Generate Reports: Generate reports on past workouts and progress.
- Database: Use a relational database to store user data, workout plans, and exercise data.
- API: Develop a RESTful API to interact with the database.
- Security: Implement JWT authentication to secure the API endpoints.
- Java Development Kit (JDK) 11 or later
- Maven or Gradle
- Database (e.g., PostgreSQL, MySQL)
- Git
-
Clone the repository:
git clone https://github.com/EmadHussien/Workout-Tracker.git cd workout-tracker
-
Build the project:
mvn clean install # or gradle build
-
Run the application:
mvn spring-boot:run # or gradle bootRun
- Database Configuration: Update the database connection settings in the
application.properties
orapplication.yml
file. - JWT Configuration: Set the JWT secret and expiration time in the
application.properties
orapplication.yml
file.
Database MySQL Script: https://github.com/EmadHussien/Workout-Tracker/blob/main/Workout-Tracker-%20mysql%20script.sql
For detailed API documentation, please refer to the Postman Docs.
-
Create Workout Plan
- URL:
http://localhost:8080/api/v1/workouts
- Method:
POST
- URL:
-
Update Workout Plan
- URL:
http://localhost:8080/api/v1/workouts/{id}
- Method:
PATCH
- URL:
-
Delete Workout Plan
- URL:
http://localhost:8080/api/v1/workouts/{id}
- Method:
DELETE
- URL:
-
Get Workout Plans
- URL:
http://localhost:8080/api/v1/user/{userId}/workouts
- Method:
GET
- URL:
-
Get a Single Workout Plan
- URL:
http://localhost:8080/api/v1/workouts/{id}
- Method:
GET
- URL:
-
Schedule Workout Session
- URL:
http://localhost:8080/api/v1/workouts/{id}/schedule
- Method:
POST
- URL:
-
Get User Upcoming Sessions
- URL:
http://localhost:8080/api/v1/user/{userId}/upcoming-sessions
- Method:
GET
- URL:
-
Get Report
- URL:
http://localhost:8080/api/v1/reports/workouts
- Method:
GET
- URL:
-
Register
- URL:
http://localhost:8080/api/v1/auth/register
- Method:
POST
- URL:
-
Login
- URL:
http://localhost:8080/api/v1/auth/login
- Method:
POST
- URL:
- JWT Authentication: JSON Web Tokens are used for authentication. Tokens are issued upon login and must be included in the Authorization header for protected routes.
- Password Hashing: Passwords are hashed using a secure hashing algorithm (e.g., bcrypt).