A Spring Boot REST API for managing gym customers and tracking their workout sessions. This project demonstrates a One-to-Many relationship where a single Customer can have multiple Workout records.
- Customer Management: Create and view customers.
- Workout Tracking: Log workouts (sets, reps, day) linked specifically to a customer.
- Relational Data: Uses JPA/Hibernate to link Workouts to Customers via a Foreign Key (
worker_id). - CRUD Operations: Full support for Creating, Reading, Updating, and Deleting workouts.
- Language: Java
- Framework: Spring Boot (Web, JPA)
- Database: MySQL (configured via
application.properties) - Build Tool: Maven
Manage the people using the gym.
| Method | URL | Description |
|---|---|---|
GET |
/customers |
Get a list of all customers |
POST |
/customers |
Register a new customer |
Since this is a backend application, you will use Postman to send requests.
- Open Postman and create a new request.
- Set the method to POST.
- URL:
http://localhost:8080/customers - Go to Body tab → Select raw → Select JSON (from the dropdown).
- Paste this JSON:
{ "firstName": "Samik", "lastName": "Coder" }
To log a workout, you must link it to an existing Customer ID.
- Open Postman and create a new request.
- Set the request method to
POST. - Enter the URL:
http://localhost:8080/workouts - Go to the Body tab → Select raw → Choose JSON from the dropdown list.
- Paste the following JSON payload:
{
"customerId": 1,
"exerciseName": "Bench Press",
"day": 1,
"sets": 3,
"reps": 12
}