This solution follows Clean Architecture principles with a clear separation of concerns across layers.
PokManagerApi/
├── src/
│ ├── Core/ # Core Business Logic (no external dependencies)
│ │ ├── PokManager.Domain/ # Domain entities, value objects, enums
│ │ │ └── Common/ # Shared domain primitives (Result<T>, etc.)
│ │ └── PokManager.Application/ # Use cases, interfaces, business rules
│ │
│ ├── Infrastructure/ # External concerns implementation
│ │ ├── PokManager.Infrastructure/ # Base infrastructure services
│ │ ├── PokManager.Infrastructure.PokManager/# PokManager-specific implementations
│ │ └── PokManager.Infrastructure.Docker/ # Docker-related implementations
│ │
│ ├── Presentation/ # User interfaces and APIs
│ │ ├── PokManager.Web/ # Blazor web frontend
│ │ └── PokManager.ApiService/ # REST API service
│ │
│ └── Hosting/ # Application hosting
│ ├── PokManager.AppHost/ # .NET Aspire orchestration
│ └── PokManager.ServiceDefaults/ # Shared service configurations
│
├── tests/ # Test projects (TinyBDD)
│ ├── PokManager.Domain.Tests/
│ ├── PokManager.Application.Tests/
│ ├── PokManager.Infrastructure.Tests/
│ └── PokManager.Web.Tests/
│
├── docs/ # Documentation
│ └── architecture/
│
└── samples/ # Sample code and demos
┌─────────────────────────────────────────────────┐
│ Presentation Layer │
│ (Web, ApiService) - User Interface/API │
└────────────────┬────────────────────────────────┘
│ depends on
┌────────────────▼────────────────────────────────┐
│ Infrastructure Layer │
│ (Infrastructure.*) - External Services │
└────────────────┬────────────────────────────────┘
│ depends on
┌────────────────▼────────────────────────────────┐
│ Application Layer │
│ Use Cases, Business Logic, Interfaces │
└────────────────┬────────────────────────────────┘
│ depends on
┌────────────────▼────────────────────────────────┐
│ Domain Layer │
│ Entities, Value Objects (NO DEPENDENCIES) │
└──────────────────────────────────────────────────┘
- Purpose: Core domain entities and business rules
- Dependencies: None (pure domain logic)
- Key Components:
Result<T>monad for error handling- Domain entities
- Value objects
- Domain events
- Purpose: Application use cases and business logic
- Dependencies: Domain
- Packages:
FluentValidation- Input validationMicrosoft.Extensions.DependencyInjection.Abstractions- DI
- Purpose: Base infrastructure services
- Dependencies: Application, Domain
- Packages:
YamlDotNet- YAML parsingMicrosoft.Extensions.LoggingMicrosoft.Extensions.Options
- Purpose: PokManager-specific implementations
- Dependencies: Infrastructure, Application, Domain
- Purpose: Docker-related implementations
- Dependencies: Infrastructure, Application, Domain
- Purpose: Blazor web frontend
- Dependencies: ServiceDefaults
- Purpose: REST API service
- Dependencies: ServiceDefaults
- Packages:
Microsoft.AspNetCore.OpenApi
- Purpose: .NET Aspire orchestration
- SDK:
Aspire.AppHost.Sdk/13.1.0
- Purpose: Shared service configurations
All test projects use TinyBDD for behavior-driven development:
- Packages: TinyBDD, xUnit, FluentAssertions
- Coverage: Domain logic, Result monad (100% covered)
- Packages: TinyBDD, xUnit, FluentAssertions, NSubstitute
- Focus: Use case testing with mocked dependencies
- Packages: TinyBDD, xUnit, FluentAssertions, NSubstitute
- Focus: Infrastructure service testing
- Packages: TinyBDD, xUnit, FluentAssertions, bUnit
- Focus: Blazor component testing
Located in PokManager.Domain.Common.Result<T>, this pattern provides:
- Type-safe error handling
- No exceptions for flow control
- Explicit success/failure states
Unittype for void operations
Example usage:
public Result<User> GetUser(int id)
{
if (id <= 0)
return Result.Failure<User>("Invalid user ID");
var user = FindUser(id);
return user != null
? Result<User>.Success(user)
: Result.Failure<User>("User not found");
}- ✅ Solution builds without errors
- ✅ All Domain tests pass (6/6)
- ✅ Result monad fully tested and covered
- ✅ Clean Architecture layers properly separated
- ✅ Dependency direction respected (inner layers have no knowledge of outer layers)
- Implement domain entities
- Add use case implementations
- Create infrastructure services
- Build API endpoints
- Develop UI components