How gabrielcornejob/spring-tasks-api-rest works
Main Components
• Frontend/API Entry-Point: Although there isn’t a separate frontend UI, the REST API layer serves as the entry/interface for client interactions.
• Application/Service Layer: Represented by the “applications/app-service” which contains the MainApplication class and configuration classes (such as ExceptionsConfig and UseCasesConfig). This acts as the Spring Boot application starting point.
• Domain Layer: Split between “domain/model” for the entities (like Task, exceptions, task constants) and “domain/usecase” for the business rules and logic (like TaskUseCase).
• Infrastructure Layer: Which includes two primary parts:
• Driven Adapters: Found under “infrastructure/driven-adapters/task,” which connect to external systems (e.g., data persistence or other services) via repository adapters.
• Entry Points: Under “infrastructure/entry-points/api-rest,” which contains the REST controllers (such as TaskController) and DTOs for handling incoming HTTP requests.
Relationships & Interactions
• The API entry point (TaskController) receives HTTP requests and routes them to the appropriate use cases.
• The Application layer (MainApplication with associated configurations) initializes the system, wiring the controllers, use cases, and adapters.
• Use Cases (TaskUseCase) encapsulate business logic that primarily interacts with the domain entities and is independent of how data is stored or exposed.
• Driven Adapters (TaskRepositoryAdapter) implement gateway interfaces defined in the domain (e.g., TaskRepository) and provide concrete methods for persistence or external communication.
Architectural Patterns and Design Principles
• Clean Architecture: Clearly separate the business logic (domain and use cases) from the infrastructure and framework concerns. Mark the internal layers (domain/usecase and domain/model) as independent from external concerns.
• Layering: Use concentric layers or aligned horizontal layers that indicate inward dependency (i.e., controllers and adapters depend on use cases and domain interfaces, but the domain does not depend on any outer layers).
• Dependency Inversion: Illustrate interfaces in the domain that are implemented by the adapters, emphasizing that the high-level business logic does not depend on low-level details.
Relevant Technologies and Frameworks
• Spring Boot: Implied from the MainApplication and configuration files.
• Gradle: The build system, as evidenced by multiple build.gradle files.
• REST: The API endpoints defined in the README, showing HTTP routes.
• Logging: Mention log4j2.properties for logging configuration.
• Testing: Highlight the presence of test directories within each module (e.g., tests under "applications/app-service/src/test" and tests in other layers).