This project demonstrates a Vertical Slice Architecture using .NET 9, with proper separation of concerns, clean architecture principles, and comprehensive testing strategies.
This solution implements Clean Architecture with Vertical Slice Architecture patterns, organized into multiple projects for better maintainability, scalability, and team collaboration.
- Clean Architecture: Dependency inversion with clear layer boundaries
- Vertical Slice Architecture: Feature-based organization within layers
- CQRS Pattern: Separation of read and write operations
- Domain-Driven Design: Rich domain models with business logic
- SOLID Principles: Single responsibility, dependency inversion, etc.
Architecture/
├── VerticalSlices.Api/ # API Layer (Presentation)
│ ├── Controllers/ # HTTP endpoints
│ ├── Program.cs # Application configuration
│ └── appsettings.json # Configuration
├── VerticalSlices.Core/ # Domain Layer
│ ├── Domain/
│ │ ├── Entities/ # Domain entities
│ │ ├── Repositories/ # Repository interfaces
│ │ ├── Events/ # Domain events
│ │ └── Exceptions/ # Domain exceptions
├── VerticalSlices.Application/ # Application Layer
│ ├── Features/
│ │ ├── Tasks/ # Tasks feature
│ │ │ ├── Commands/ # Write operations
│ │ │ ├── Queries/ # Read operations
│ │ │ ├── DTOs/ # Data transfer objects
│ │ │ ├── Mapping/ # AutoMapper profiles
│ │ │ └── Validation/ # FluentValidation rules
│ │ └── Users/ # Users feature
├── VerticalSlices.Infrastructure/ # Infrastructure Layer
│ ├── Data/ # Entity Framework
│ └── Repositories/ # Repository implementations
├── VerticalSlices.Shared/ # Shared Layer
│ └── Common/ # Common utilities
├── VerticalSlices.Tests.Unit/ # Unit Tests
└── VerticalSlices.Tests.Integration/ # Integration Tests
- Purpose: Contains business logic and domain entities
- Dependencies: None (innermost layer)
- Contains: Entities, Repository interfaces, Domain events, Exceptions
- Purpose: Orchestrates business operations
- Dependencies: Core
- Contains: CQRS handlers, DTOs, Validation, Mapping
- Purpose: Implements external concerns (database, external APIs)
- Dependencies: Core, Application
- Contains: Repository implementations, DbContext, External services
- Purpose: Handles HTTP requests and responses
- Dependencies: All other layers
- Contains: Controllers, Middleware, Configuration
- .NET 9 SDK
- SQL Server LocalDB (or SQL Server Express)
- Visual Studio 2022 or Rider or VS Code