# CLAUDE.md ASP.NET Core 8 Web API with Clean Architecture (CQRS + MediatR). ## Project map - `src/Api/` - ASP.NET Core controllers, middleware, DI setup - `src/Application/` - MediatR handlers, validators, DTOs - `src/Domain/` - Entities, value objects, domain events - `src/Infrastructure/` - EF Core, external services, file storage - `tests/` - Unit and integration tests ## Commands | Command | What it does | |---|---| | `dotnet build` | Build solution | | `dotnet test` | Run all tests | | `dotnet run --project src/Api` | Start API locally | | `dotnet ef migrations add -p src/Infrastructure` | Create EF migration | | `dotnet ef database update -p src/Infrastructure` | Apply migrations | - Add controller in `Api/Controllers/` inheriting `BaseApiController` - Add command/query + handler + validator in `Application/Features/` - See `Application/Features/Orders/Commands/CreateOrder/` for the pattern - Entities configured via `IEntityTypeConfiguration` in `Infrastructure/Persistence/Configurations/` - Always create a migration after schema changes — never modify existing migrations - Unit tests: xUnit + NSubstitute, one test class per handler - Integration tests: `WebApplicationFactory` with test database - See `tests/Application.IntegrationTests/TestBase.cs` for setup