feat: Initial project setup with clean architecture#1
Conversation
WalkthroughInitial project scaffolding for a .NET 8 solution is added with three layers (Domain, Application, Infrastructure) and a Web API. It introduces CQRS, MediatR pipeline behaviors (logging, performance, auth, validation, caching, transactions, domain events), domain entities/aggregates/events/specifications, DI wiring, API controllers, error handling middleware, and extensive documentation/configuration. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant API as Web.Api AuthController
participant Med as MediatR Pipeline
participant Beh as Behaviors (Logging→Performance→Authorization→Validation→Caching→Transaction→DomainEvent)
participant H as LoginCommandHandler
participant Repo as IUserRepository
participant Sec as IPasswordHasher/ITokenService
U->>API: POST /api/v1/Auth/login (LoginCommand)
API->>Med: mediator.Send(LoginCommand)
Med->>Beh: Execute pipeline
Beh->>H: Handle(LoginCommand)
H->>Repo: GetByEmailAsync(email)
Repo-->>H: User?
H->>Sec: VerifyPassword / GenerateTokens
Sec-->>H: Tokens
H-->>Med: Result<LoginResponse>
Med-->>API: Result
API-->>U: 200 OK ApiResponse<LoginResponse> or 400/401
sequenceDiagram
autonumber
actor Admin as Admin
participant API as Web.Api UsersController
participant Med as MediatR Pipeline
participant Beh as Behaviors (Auth + Tx + DomainEvent ...)
participant H as CreateUserCommandHandler
participant Repo as IUserRepository
participant Dom as Domain (UserAggregate)
participant DED as DomainEventDispatcher
Admin->>API: POST /api/v1/Users (CreateUserCommand)
API->>Med: mediator.Send(CreateUserCommand)
Med->>Beh: Authorization check (Admin + users.create)
Beh->>H: Handle(command) within transaction
H->>Repo: GetByEmailAsync
H->>Dom: UserAggregate.Create(...)
Dom-->>H: Aggregate with UserCreatedEvent
H->>Repo: CreateAsync(user)
H-->>Beh: Result<CreateUserResponse>
Beh->>DED: Dispatch domain events (UserCreatedEvent)
DED-->>Beh: Done
Beh-->>Med: Result
Med-->>API: Result
API-->>Admin: 201 Created ApiResponse<CreateUserResponse>
sequenceDiagram
autonumber
participant API as Web.Api UsersController
participant Med as MediatR Pipeline
participant Beh as Behaviors (Caching + Auth + Validation ...)
participant H as GetUsersQueryHandler (future)
participant Cache as IMemoryCache
API->>Med: mediator.Send(GetUsersQuery)
Med->>Beh: Check cache key
alt Cache hit
Beh->>Cache: Get(key)
Cache-->>Beh: PaginatedResult
Beh-->>Med: Cached result
else Cache miss
Beh->>H: Handle(query)
H-->>Beh: Result
Beh->>Cache: Set(key, result, ttl)
Beh-->>Med: Result
end
Med-->>API: Result
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Free 📒 Files selected for processing (107)
⛔ Files not processed due to max files limit (2)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login. Comment |
…n-architecture feat: Initial project setup with clean architecture
Summary by CodeRabbit
New Features
Documentation
Chores