How juancursed/user_microservice works
Main Components
• UserMicroserviceApplication – The entry point for the Spring Boot application.
• Application Layer – Contains the use cases (e.g., SaveUserUseCase, GetUserByIdUseCase, UpdateUserUseCase, DeleteUserUseCase, GetUserByEmailUseCase) that encapsulate the business logic.
• Delivery Layer – Includes the RESTful controller (UserController) which handles incoming HTTP requests.
• Domain Layer – Consists of the core business models and logic (e.g., User and Role, along with the repository interface UserRepository).
• Infrastructure Layer – Provides persistence implementations (e.g., UserRepositorySpringData under persistence) that integrate with Spring Data and potentially a database.
• Security Component – The SecurityConfig class which configures security settings.
• CI/CD and Deployment Scripts – Not a logical component of the running system, but files like Dockerfile, .github/workflows config indicate containerization and continuous integration practices.
Relationships & Interactions
• The REST API (UserController) receives HTTP requests and directs them to the appropriate Use Case in the Application Layer.
• The Use Case classes interact with the Domain Layer to enforce business rules and then delegate data access tasks to the Infrastructure Layer.
• The Infrastructure Layer (UserRepositorySpringData) implements the domain repository interface (UserRepository) and communicates with the database.
• The SecurityConfig is globally applied to secure the endpoints, influencing the flow at the delivery layer.
• The main application class wires-up and bootstraps the application, integrating all layers.
Architectural Patterns and Principles
• Layered Architecture/Clean Architecture – The code is segmented into delivery, application, domain, and infrastructure layers.
• Domain-Driven Design – Clear separation of domain models and business logic.
• Use of Spring Boot and Spring Data – Indicating dependency injection and repository pattern usage.
• Containerization – The Dockerfile suggests that the microservice is built with containerization in mind.