Based on the template by Milan Jovanović, see Master The Clean Architecture or get the base clean-architecture template here Free Clean Architecture Template.
Clean Architecture is a software design pattern that helps organize and structure applications in a way that separates business logic from implementation details. This approach ensures that the core functionality of the application remains independent of external factors like frameworks, databases, or user interfaces.
- Entities:
- Represent the core business objects within the application.
- Contain the most fundamental business rules and are independent of any external systems.
- Use Cases:
- Define the application-specific business rules.
- Contain the logic for specific operations and interact with entities to execute business processes.
- Ensure that the application behaves correctly and meets the requirements.
- Interface Adapters:
- Act as a bridge between the use cases and the external world.
- Convert data from the format most convenient for the use cases and entities to the format required by the external systems (e.g., UI, database).
- Include controllers, presenters, and gateways.
- Infrastructure:
- Represents the outermost layer of the architecture.
- Contains implementation details such as frameworks, databases, and external services.
- Provides the necessary tools and technologies to support the application but does not contain business logic.
- Maintainability: By keeping business logic separate from implementation details, the codebase is easier to understand and modify.
- Testability: Business logic can be tested independently of external systems, leading to more reliable and faster tests.
- Scalability: The modular structure allows for easy addition of new features and components without affecting existing functionality.
- Flexibility: The architecture can adapt to changes in technology or requirements without significant rewrites.
- Decoupling: Ensure that the core of the application (entities and use cases) is free of dependencies on external systems.
- SOLID Principles: Apply the SOLID principles to create a flexible and extensible codebase.
- Asynchronous Operations: Implement use cases asynchronously to improve scalability and performance.
- Layered Approach: Clearly define and separate the responsibilities of each layer to maintain a clean and organized structure.
By following these principles and practices, Clean Architecture helps create robust, scalable, and maintainable software applications.
- Using .NET9
- SharedKernel project with:
- Domain-Driven Design abstractions, including:
- Entity
- Error & ErrorType
- Result matching
- Validation
- Domain-Driven Design abstractions, including:
- Domain layer with:
- sample entities
- Application layer with abstractions for:
- CQRS, see CQRS Pattern and Apply simplified CQRS and DDD patterns in a microservice.
- Cross-cutting concerns
- Logging
- Validation
- Infrastructure layer with:
- Authentication
- Claims Principals
- Password hashing
- Token provider (JWT)
- User Context
- Authorization
- Permission authorization
- Policy provider
- EF Core with SQL Server
- Migrations
- Entity type configuration
- Authentication
- Presentation Layer (API) with:
- Docker Support
- MicroService architecture, see .net Microservices
- Testing projects
- Architecture testing
This is a list of general topics that we aim to include/implement:
- Add YARP (Reverse Proxy)
- Add Rate limiting (by user authorization)
- Add Resilience to the DB, see Application resiliency patterns
- Add multi-tenancy, by using a Discriminator, see: Supporting multi-tenancy and Multi-Tenant Applications With EF Core
- Add WebSocket's support, see WebSockets support in ASP.NET Core
- Integration into .net Aspire