Skip to content

Latest commit

Β 

History

History
44 lines (31 loc) Β· 2.11 KB

File metadata and controls

44 lines (31 loc) Β· 2.11 KB

Application Layer

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.

Structure

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.

Usage

The components in the Application Layer are responsible for:

  1. Orchestrating use-cases.
  2. Handling user input validation.
  3. Mapping between domain models and DTOs.
  4. Coordinating with the Infrastructure Layer to interact with external systems and services.

Best Practices

When working with the Application Layer, follow these best practices:

  1. Keep the Application Layer decoupled from the Domain and Infrastructure Layers.
  2. Use DTOs to enforce a clear boundary between input and output data formats.
  3. Encapsulate business logic in use-case classes, and ensure they don't contain infrastructure-specific code.
  4. Leverage interfaces (ports) to enable dependency inversion and easier testing.

Contributing

When adding new functionality to the Application Layer, ensure that you:

  1. Follow the existing project structure and organization.
  2. Update this README.md file if needed.
  3. Write tests for new components and functionality.
  4. Adhere to the project's coding style and best practices.