This folder contains the components of the Application Layer of the project. The Application Layer is responsible for coordinating the application's activity, acting as a bridge between the Domain Layer and the Infrastructure Layer.
The Application Layer is organized into the following sub-folders:
decorators
: Contains custom decorators used throughout the application.dtos
: Contains Data Transfer Objects (DTOs) used for data input and output in the application.enums
: Contains enums used in the application.errors
: Contains custom error classes for handling specific exceptions.mappers
: Contains mapper classes for mapping between different data models or entities.ports
: Contains the interface definitions for application components that interact with external systems, such as controllers and repositories.use-cases
: Contains the use-case classes, which encapsulate the application's business logic.utils
: Contains utility classes and functions used in the application.validators
: Contains validator classes responsible for validating data input.
The components in the Application Layer are responsible for:
- Orchestrating use-cases.
- Handling user input validation.
- Mapping between domain models and DTOs.
- Coordinating with the Infrastructure Layer to interact with external systems and services.
When working with the Application Layer, follow these best practices:
- Keep the Application Layer decoupled from the Domain and Infrastructure Layers.
- Use DTOs to enforce a clear boundary between input and output data formats.
- Encapsulate business logic in use-case classes, and ensure they don't contain infrastructure-specific code.
- Leverage interfaces (ports) to enable dependency inversion and easier testing.
When adding new functionality to the Application Layer, ensure that you:
- Follow the existing project structure and organization.
- Update this README.md file if needed.
- Write tests for new components and functionality.
- Adhere to the project's coding style and best practices.