GymManagerApp is an API designed for managing gym training sessions, training types, and users!
Report Bug
Table of Contents
This is a small-scale project demonstrating Clean Architecture, adhering to SOLID principles, and drawing inspiration from Domain-Driven Design (DDD). It also incorporates the CQRS pattern with MediatR to showcase a structured, testable, and maintainable approach to modern software development.
This project requires the following tools installed on your machine:
.NET 9 SDK
PostgreSQL
-
Clone the repository
git clone https://github.com/natasakasikovic/gym-manager-app-backend.git cd gym-manager-app-backend
-
Set up database credentials. Edit the appsettings.json file in the Presentation project:
"ConnectionStrings": { "DefaultConnection": "Host=HOST;Database=DATABASE;Username=USERNAME;Password=PASSWORD" }
-
Apply migrations and create the database
dotnet ef database update --project Infrastructure --startup-project Presentation
-
Run the application
dotnet run --project Presentation
-
Domain
This layer contains entities and enums. Business logic is encapsulated within the entities themselves. It is entirely independent of any frameworks, which ensures maximum flexibility, maintainability, and reusability.
-
Application
Like the domain layer, this one is also independent of the UI and database. It communicates with the infrastructure through interfaces, making it easily testable and adaptable. It follows the CQRS pattern using MediatR, allowing separation of read and write logic, and simplifying the handling of cross-cutting concerns. Two important MediatR behaviors are implemented in this layer:
-
Logging behavior – used to track and log request execution for better monitoring and debugging.
-
Validation behavior – used to enforce validation rules before the handler logic is executed, based on FluentValidation.
The IDateTime interface is introduced to avoid direct dependency on system DateTime, and also to allow easy mocking during unit testing, which significantly improves testability.
-
-
Infrastructure
This layer handles external concerns such as persistence, identity, and other integrations. It provides the concrete implementations for the interfaces defined in the application layer. If there is a need to switch to a different database or identity provider, only this layer needs to change, while Domain and Application layers remain untouched.
-
Presentation
This is the entry point of the application. It contains API controllers, endpoints, and handles centralized error management via BaseApiController. It interacts with the application layer to execute commands and queries, serving as the interface between the user and the core logic.
-
User Authentication
- User registration and login functionality.
- Secured with JWT tokens.
-
Training Management
- Create, update, fetch training sessions
- Sign up for trainings
-
Training Type Management
- Create, update, fetch training types