Skip to content

Adripoblado/gymtracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏋️‍♂️ Gym Tracker API

Java Spring Boot Spring Security JWT

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.


🚀 Core Features

  • 🛡️ 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.

🛠️ Technology Stack

  • Backend: Java 17, Spring Boot 3.5.10.
  • Security: Spring Security, JWT (jjwt).
  • Persistence: Spring Data JPA, Hibernate.
  • Productivity: Lombok, MapStruct.
  • Dependency Management: Maven.

📋 Prerequisites

Before running the project, ensure you have the following installed:

  1. JDK 17 or higher.
  2. Maven 3.8+.
  3. Database: (Configured in your application.properties). If using MySQL, ensure the service is running.

⚙️ Setup and Installation

  1. Clone the repository:
    git clone [https://github.com/Adripoblado/gymtracker.git](https://github.com/Adripoblado/gymtracker.git)
  2. Configure Environment Variables: Create a src/main/resources/application.properties file (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
  3. Run the application:
    mvn spring-boot:run

🛣️ API Documentation

🔐 Authentication (/auth)

Method Endpoint Description
POST /auth/register User registration. Requires rolecode for ADMIN privileges.
POST /auth/login Login with username/email. Returns the Bearer Token.

👤 Users (/users)

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.

🏃 Exercises (/exercises)

Method Endpoint Privileges Description
POST /create/global ADMIN Creates an official system exercise.
GET /list/global User Lists all available official exercises.

🧪 Testing with Postman

  1. Login: Execute the login endpoint and copy the returned token.
  2. Environment Variables: In Postman, create a variable named jwt_token.
  3. Test Scripts: In the Tests tab of the login request, paste:
    pm.environment.set("jwt_token", pm.response.text());
  4. Auth: In all other endpoints, select Auth -> Bearer Token and use {{jwt_token}}.

🗺️ Roadmap & Future Features

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.

✒️ Author


About

Spring web for gym progress tracking, live training and social networking (in progress)

Resources

Stars

Watchers

Forks

Releases

No releases published

Contributors