Gym Tracker is a robust REST API designed to manage workouts and body metrics. It implements a Stateless Architecture using JWT (JSON Web Tokens) to ensure system security and scalability.
- 🛡️ Stateless Security: Authentication based on JWT Tokens.
- 👥 Role Management: Clear distinction between standard Users and Administrators.
- 📊 Body Tracking: Detailed logging of over 15 physical metrics (BMI, Body Fat, Muscle Mass, etc.).
- 🏋️ Exercise Catalog: Management of global exercises curated by administrators.
- ⚡ Clean Architecture: Use of DTOs, Mappers (MapStruct), and decoupled services.
- Backend: Java 17, Spring Boot 3.5.10.
- Security: Spring Security, JWT (jjwt).
- Persistence: Spring Data JPA, Hibernate.
- Productivity: Lombok, MapStruct.
- Dependency Management: Maven.
Before running the project, ensure you have the following installed:
- JDK 17 or higher.
- Maven 3.8+.
- Database: (Configured in your
application.properties). If using MySQL, ensure the service is running.
- Clone the repository:
git clone [https://github.com/Adripoblado/gymtracker.git](https://github.com/Adripoblado/gymtracker.git)
- Configure Environment Variables:
Create a
src/main/resources/application.propertiesfile (not included in the repo) with your credentials:spring.datasource.url=jdbc:mysql://localhost:3306/gym_tracker_db spring.datasource.username=your_username spring.datasource.password=your_password spring.jpa.hibernate.ddl-auto=update # Secret Key for JWT (minimum 64 characters recommended) jwt.secret.key=your_super_secret_64_character_key
- Run the application:
mvn spring-boot:run
| Method | Endpoint | Description |
|---|---|---|
POST |
/auth/register |
User registration. Requires rolecode for ADMIN privileges. |
POST |
/auth/login |
Login with username/email. Returns the Bearer Token. |
| Method | Endpoint | Privileges | Description |
|---|---|---|---|
GET |
/me |
User | Retrieves the authenticated user's profile. |
PUT |
/me/update |
User | Updates bodyMetrics (weight, fat %, etc.). |
DELETE |
/me/delete |
User | Deletes own account (Requires ?confirm=DELETE+ACCOUNT). |
DELETE |
/admin/delete/{username} |
ADMIN | Deletes any user by their username. |
| Method | Endpoint | Privileges | Description |
|---|---|---|---|
POST |
/create/global |
ADMIN | Creates an official system exercise. |
GET |
/list/global |
User | Lists all available official exercises. |
- Login: Execute the login endpoint and copy the returned token.
- Environment Variables: In Postman, create a variable named
jwt_token. - Test Scripts: In the Tests tab of the login request, paste:
pm.environment.set("jwt_token", pm.response.text());
- Auth: In all other endpoints, select Auth -> Bearer Token and use
{{jwt_token}}.
The project is currently under active development. The following core modules are planned for upcoming releases to enhance the user experience and analytical capabilities:
- 💻 Frontend Integration (SPA): Development of a responsive web interface using React.js, featuring secure JWT management (HttpOnly cookies/Memory) and global state handling.
- 🏋️ Live Training & Workout Builder: Implementation of a dynamic routine creator. This will include a "Live Session" mode with real-time tracking, rest timers, and persistent storage of sets/reps.
- 📊 Performance Analytics & Data Visualization: A dedicated dashboard to track progress using interactive charts (Chart.js or D3.js). This will visualize strength gains, body metric evolution, and training volume over time.
- Adrián Cervera - Lead Developer - Adripoblado