The Clean Architecture (in a nutshell)

The layers of the clean architecture

The objective of this architecture is the separation of concerns by dividing the software into layers.

The main idea is to separate concerns and dependencies in such a way that the core business logic remains isolated to external technologies. This separation makes the system more modular, maintainable, and adaptable to change over time.

The layers in detail : 


  • Encapsulate Enterprise wide business rules and logic
  • They encapsulate the most general and high-level rules.
  • They are the least likely to change when something external changes 

Use Cases

  • Contains application-specific business rules and logic
  • Coordinates the execution of tasks and interacts with entities.
  • Encapsulates and implements all of the use cases of the system.
  • The changes in this layer do not affect the entities.
  • This layer is not affected by any changes to externalities such as the database, the UI, or any of the common frameworks

Interface Adapters

  • Converts data between the format used by the use cases and the format used by entities.
  • Maps data between the inner and outer layers.
  • Helps in maintaining separation of concerns.

Frameworks and Drivers

  • Encompasses external technical details, such as frameworks, libraries, databases, etc.
  • Kept at the outermost layer to ensure that the core of the software remains independent of these details.