ModernAPI Clean Architecture
Explore the four-layer Clean Architecture implementation powering this .NET 9 template
API Layer (ModernAPI.API)
HTTP concerns, Controllers, Middleware - The entry point of your application
Application Layer (ModernAPI.Application)
Business logic orchestration, Services, DTOs, Use Cases
Infrastructure Layer (ModernAPI.Infrastructure)
Data access, External services, Technical implementations
Domain Layer (ModernAPI.Domain)
Pure business logic, Entities, Value Objects, Domain Events
API Layer (ModernAPI.API) Details
HTTP concerns, Controllers, Middleware - The entry point of your application
Technologies
Responsibilities
- HTTP request/response handling with proper status codes
- Global exception handling with RFC 7807 Problem Details
- JWT authentication middleware and cookie extraction
Key Files
- Controllers/AuthController.cs - JWT authentication endpoints
- Controllers/UsersController.cs - User management CRUD operations
- Middleware/ExceptionMiddleware.cs - Global error handling
- Program.cs - Dependency injection and middleware configuration
API Endpoints
12+
Auth + Users + Health
Application Services
5
Auth, JWT, User, Password
Repositories
3
User, RefreshToken, UoW
Domain Entities
2
User, RefreshToken
Complete Test Coverage
Business logic completely isolated and testable. Domain tests run without databases or external dependencies.
Database Flexibility
Switch from PostgreSQL to SQL Server or SQLite by changing one line in configuration.
Framework Independence
Business rules don't depend on ASP.NET Core, Entity Framework, or any external library.
Clear Dependencies
Dependencies point inward. Infrastructure depends on Domain, never the reverse.