Clean Architecture Explained (Part 2)
--
Here is the link to Part-1 which talks about concepts.
In this article, we are going to explore the implementation of Clean Architecture. Here is the GitHub repository that you can refer to. The business logic here is a To-Do application.
If you got here from a link or through search engines, consider there is another part that you should look into it first. Part-1 covers the conceptual and definitions of the Clean Architecture pattern.
Part-1
Table of Contents
- Structure
- Core
- I/O Frameworks
- Entry Points or Drivers
- Configuration
- Conclusion
- References
Structure
To form our scaffolding and project structure we need to categorize different components in the project and then move them to specific architectural hierarchy.
By looking at the above picture we can identify different parts of the application and categorize them into four categories:
- Core
The core includes specific application business rules and it sits in the center of the application. It is the most high-level part of the project. It is also surrounded by Interface Adapters that enable other parts to communicate with the business rules in a pluggable way. - I/O frameworks
Detailed frameworks like databases or services should live here and the concrete implementation is based on the interfaces from Core. - Entry points or drivers
Every detail that enables humans to communicate with the application business logic goes here. This layer opens the door to the outside world. Every REST API implementations or CLI or any driver lives here. - Configuration
This is the most detailed part of the project. All wiring of the project implements here, everything related to instantiating objects passing dependency injections goes here.