Learn

Navigate through learn topics

Clean Architecture

Domain-centric rings that separate policy from details

Last updated: 8/15/2025

Clean Architecture

Clean Architecture organises code in concentric rings: entities and use cases in the centre, interfaces and frameworks at the edge. Dependencies point inward, keeping business rules independent of delivery and databases.

When it fits

  • Complex domains where business rules outlive frameworks
  • Long-lived systems that will change infrastructure over time

Risks

  • More layers and abstractions than simple apps need

Real-world examples

  • Enterprise systems that survive multiple UI rewrites and database migrations with minimal change to core use cases
  • SaaS products that share a core domain across CLI, API and web UI adapters

Practical tips

  • Keep use cases pure and side effect free; push I/O to boundaries
  • Make dependencies flow inward via interfaces, not concrete types