Back to feed
Dev.to
Dev.to
6/22/2026
Clean Architecture in .NET 8: A 2026 Starter Template with 4 Projects, EF Core, and JWT Auth

Clean Architecture in .NET 8: A 2026 Starter Template with 4 Projects, EF Core, and JWT Auth

Short summary

Experienced developer shares a .NET 8 starter template implementing Clean Architecture across four projects—API, Application, Infrastructure, and Domain—with strict dependency direction. The template includes JWT auth, EF Core, Docker, xUnit tests, and CI integration. Key insight: business logic belongs on domain entities themselves, not in services, enabling unit testing without database dependencies and enforcing invariants at the class level.

  • Four-project structure (API → Application → Infrastructure → Domain) with compiler-enforced dependency direction
  • Domain entities encapsulate business logic and invariants—DecreaseStock() validates on the object, not in services
  • MIT-licensed GitHub template includes JWT, EF Core, Docker, xUnit, and CI; no database required for unit tests

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more