PowerLog is a Spring MVC web application designed to help strength training enthusiasts track their workouts, monitor progress, and manage their training schedules.
- Introduction
- Features
- Technologies Used
- Installation
- API Endpoints
- Database Schema
- Security
- Validation and Error Handling
- Internationalization (i18n)
- Contact Management
- Events and Scheduling
- Apache Kafka
- Mapping
- Testing
- Front-end Design
- Usage
- Contact
PowerLog was developed as part of the Spring Advanced Course @ SoftUni. It provide a comprehensive strength training tracking system.
- Home, About, and Contact pages: Accessible to unauthenticated users.
- Authentication: Login and register options.
- Workout Management:
- Create, update, and delete workouts.
- Use routines as templates for new workouts.
- Create custom exercises.
- View exercise progress with graphs using Chart.js.
- Tools:
- Log daily weight and view progress graphs.
- Store and view progress photos.
- Account Management:
- View and edit profile information (email, password).
- Admin Dashboard:
- View all users.
- View all contacts.
- Access to app interface settings and usage statistics.
- Role-based access control with user and admin roles.
- Backend: Spring Framework, Spring Boot
- Frontend: JavaScript, jQuery, AJAX, HTML, Bootstrap, Thymeleaf, Thymeleaf Layout Dialect, Chart.js, DataTables
- Database: MySQL, Hibernate (JPA provider)
- Messaging: Apache Kafka
- Storage Cloud: Cloudinary
- Security: Spring Security, JWT authentication with refresh tokens
- Other Libraries: MapStruct, Lombok
- JDK 17+
- Gradle
- MySQL
- Clone the repository:
git clone https://github.com/hyuseinlesho/power-log.git
- Set up environment variables.
DB_USERNAME= DB_PASSWORD= SECRET_KEY= ACCESS_TOKEN_EXPIRATION= REFRESH_TOKEN_EXPIRATION= REMEMBER_ME_REFRESH_TOKEN_EXPIRATION= ACCESS_TOKEN_COOKIE_MAX_AGE= REFRESH_TOKEN_COOKIE_MAX_AGE= REMEMBER_ME_REFRESH_TOKEN_COOKIE_MAX_AGE= MAIL_USERNAME= MAIL_PASSWORD= ADMIN_EMAIL= CLOUDINARY_CLOUD_NAME= CLOUDINARY_API_KEY= CLOUDINARY_API_SECRET=
- Set up used Cloudinary for storing progress pictures, install and run Apache Kafka server for messages from ContactService or uncomment this property in
application.yaml
:
- Run the application and enjoy it!
GET /auth/login
POST /auth/login
GET /auth/register
POST /auth/register
POST /auth/logout
GET /contact
POST /contact
GET /exercises
GET /exercises/graph
GET /
GET /about
GET /home
GET /progress-photos
GET /progress-photos/upload
GET /workouts/routines
GET /workouts/routines/create
POST /workouts/routines/create
POST /workouts/routines/{id}/delete
GET /workouts/routines/{id}/details
GET /workouts/routines/{id}/edit
POST /workouts/routines/{id}/edit
-
GET /users/profile
-
GET /weight-logs
-
POST /weight-logs/graph
GET /workouts/create
POST /workouts/create
GET /workouts/history
GET /workouts/history/search
POST /workouts/{id}/delete
GET /workouts/{id}/details
GET /workouts/{id}/edit
POST /workouts/{id}/edit
GET /api/exercise-logs
POST /api/exercies/create
PUT /api/exercies/{id}
DELETE /api/exercies/{id}
POST /users/profile/change-email
POST /users/profile/change-password
GET /api/weight-logs
POST /api/weight-logs/create
PUT /api/weight-logs/{id}
DELETE /api/weight-logs/{id}
- The database schema for the PowerLog application is designed to support the functionalities required for tracking strength training workouts, user authentication, and role-based access control. Below is a detailed description of each table and its relationships.
- This schema ensures that each user can have multiple roles, workouts, exercises, routines, weight logs, and progress photos, providing a comprehensive structure for the application's functionality.
- Custom JWT authentication with refresh tokens based on this tutorial.
- Role-based authentication with user and admin roles.
- Security features including CSRF protection and password hashing.
- Client-side and server-side validation.
- Supported languages: English, Bulgarian, and German.
Utilizes a separate REST service, ContactService, for saving new contacts and fetching contacts based on date.
- Event which send welcome email after a new user registers.
- Event which send notification email after users create now contact.
- Consume new messages from ContactService producer through Kafka
- Scheduler to send a weekly contact summary email to the admin with new contacts created.
- Ensure Apache Kafka is installed and running to test it locally.
- Consumes messages from the Kafka topic
contact-topic
and ContactService as producer. - Parses the consumed message and processes the contact data.
- Configured consumer settings, including bootstrap servers, key and value deserializers, and group ID in
application.yaml
file.
- Processes the contact data after consumption from Kafka.
- Sends notification email to the admin when a new contact is created.
- Ensure that Kafka server is installed and running when testing the integration.
- Use MapStruct for DTO conversions.
- Unit tests for service layer.
- Integration tests for REST controllers.
- Achieved ~60% line coverage.
The PowerLog application uses modern web technologies to ensure a responsive and user-friendly interface. Key technologies include:
- Thymeleaf: Used as the template engine to generate dynamic HTML content on the server side.
- Layout Dialect: Provides tools to create reusable layouts, components, and fragments, ensuring consistency across the application.
- Security Integration: Manages user authentication and authorization within templates using Spring Security.
- Bootstrap 5: Utilized for responsive CSS styling and layout design, offering a library of pre-designed components like forms, buttons, and navigation bars.
- Modals: Used for creating dialog boxes and forms for user interactions without navigating away from the current page.
- JavaScript: Enhances user interactions and provides dynamic functionality on the client side, including form validation and event handling.
- AJAX: Enables asynchronous communication with the server, allowing data to be sent and received without reloading the page, thus improving user experience.
- Chart.js: Utilized for creating responsive and interactive charts, helping to visualize workout progress and other data in a clear and engaging manner.
- DataTables: Provides advanced interaction controls for HTML tables, such as sorting, filtering, and pagination, making it easier to manage and analyze tabular data.
Here is a demonstration video of PowerLog application:
- Author: Hyusein Lesho