How maleknoureddine/schoolprojectcleanarchitecture works
High-Level Architecture Components
┌─ API Layer (Presentation)
• Core Layer (Application)
• Service Layer (Business)
• Infrastructure Layer
• Data Layer
Detailed Component Breakdown
a) API Layer (Top):
• Middleware components (ErrorHandler)
• Base controller setup
b) Core Layer:
• Create sections for:
• Features (Commands/Queries)
• Behaviors (Validation)
• Mapping profiles
• Response handlers
• Shared resources
c) Service Layer:
• Service interfaces and implementations
• CurrentUserService
• Email service
d) Infrastructure Layer:
• DbContext
• Repositories
• Configurations
• Data seeders
e) Data Layer (Bottom):
• Entity models
• DTOs/Requests/Responses
• Enums
• Helper classes
Component Relationships
→ Direct dependencies
⇢ Data flow
⇄ Two-way communication
Special Elements
Create dedicated sections for:
┌─ Authentication/Authorization Flow
• CQRS Pattern Implementation
• MediatR Request Handling
• Entity Relationships
Implementation Details
┌─ Technologies
• .NET 7
• Entity Framework Core
• JWT Authentication
• MediatR
• Fluent Validation
• SQL Server
Key Patterns
Architectural patterns:
• CQRS separation
• Repository pattern
• Mediator pattern
• Unit of Work
Cross-Cutting Concerns
Horizontal layers for:
• Validation
• Authentication
• Authorization
• Error handling
• Localization
Data Flow
Typical request flow:
Client → API → MediatR → Handler → Service → Repository → Database