juniorClean Architecture
How does Clean Architecture handle 'Frameworks and Drivers'?
Updated Apr 28, 2026
Short answer
Frameworks and Drivers are details that reside in the outermost layer and should be easily replaceable.
Deep explanation
The outermost layer is where the tools live: the database, the web framework, the UI, the devices. Clean Architecture treats these as 'details'. The goal is to keep the business logic clean so that you could, in theory, swap MySQL for MongoDB or Express for Fastify without changing a single line of business logic.
Real-world example
Switching from a React web UI to a CLI tool while using the same Use Cases and Entities.
Common mistakes
- Extending framework classes (like BaseController) in the Domain layer.
Follow-up questions
- Why is it dangerous to let frameworks leak into the inner circles?