Clean Architecture centres on the Dependency Rule: dependencies always point inward. Domain (innermost) has no dependencies. Application depends only on Domain. Infrastructure implements Application interfaces. Presentation (API) calls Application. This is the ports-and-adapters (Hexagonal) pattern. NetArchTest enforces the rules automatically. Overusing it on CRUD APIs adds cost; Vertical Slice Architecture is often a better fit.
Each stage in order — click any step to read what it does.
Clean Architecture rings: dependencies point inward only.
The trade-offs worth knowing before you build this.
Domain knows nothing. Application knows Domain. Infrastructure implements Application interfaces. Presentation calls Application. That's it.
Domain entities and Application handlers can be unit-tested with no EF Core or external services. This is the key payoff of Clean Architecture.
Clean Architecture shines for complex domains. For CRUD APIs, Vertical Slice Architecture (feature folders) is faster with less boilerplate.
Sign in to share your feedback and join the discussion.