How lucasnobsob/todolistchallenge works
Purpose and entry points
A .NET 9 REST backend for authenticated to-do task management. The HTTP host starts at src/1 - Presentation/ToDoListChallenge.Presentation.API/Program.cs; API endpoints are in src/1 - Presentation/ToDoListChallenge.Presentation.API/Controllers/TaskController.cs and src/1 - Presentation/ToDoListChallenge.Presentation.API/Controllers/AccountController.cs. It runs locally or as a Docker Compose/container deployment.
Presentation and host composition
The API project owns routing, Swagger, error handling, health checks, authentication, database setup, migrations, and HTTP integrations through startup extensions, notably src/1 - Presentation/ToDoListChallenge.Presentation.API/StartupExtensions/AuthExtension.cs, src/1 - Presentation/ToDoListChallenge.Presentation.API/StartupExtensions/DatabaseExtension.cs, and src/1 - Presentation/ToDoListChallenge.Presentation.API/StartupExtensions/MigrationExtension.cs. Controllers map HTTP DTOs to application services and return standardized result models.
Application query/command facade
src/2 - Application/ToDoListChallenge.Application/Services/TaskAppService.cs implements src/2 - Application/ToDoListChallenge.Application/Interfaces/ITaskAppService.cs. It is the main use-case boundary: maps task view models, paginates/filter queries, and dispatches mutations into the domain command pipeline. Mapping is split between src/2 - Application/ToDoListChallenge.Application/AutoMapper/DomainToViewModelMappingProfile.cs and src/2 - Application/ToDoListChallenge.Application/AutoMapper/ViewModelToDomainMappingProfile.cs.
Domain task lifecycle
Task writes use CQRS-style commands and validation: src/3 - Domain/ToDoListChallenge.Domain/Commands/RegisterNewTaskCommand.cs, src/3 - Domain/ToDoListChallenge.Domain/Commands/UpdateTaskCommand.cs, and src/3 - Domain/ToDoListChallenge.Domain/CommandHandlers/TaskCommandHandler.cs. The handler applies rules over src/3 - Domain/ToDoListChallenge.Domain/Models/TaskItem.cs, persists via repository/unit-of-work abstractions, emits task events, and reports failures through domain notifications rather than leaking domain exceptions directly to HTTP.
Mediation, notifications, and events
The in-process mediator/bus is src/4 - Infra/4.2 - CrossCutting/ToDoListChallenge.CrossCutting.Bus/InMemoryBus.cs, behind core mediator contracts at src/3 - Domain/ToDoListChallenge.Domain.Core/Interfaces/IMediatorHandler.cs. Command handlers publish TaskRegistered, TaskUpdated, and TaskRemoved events; src/3 - Domain/ToDoListChallenge.Domain/EventHandlers/TaskEventHandler.cs is the event-side boundary. src/3 - Domain/ToDoListChallenge.Domain.Core/Notifications/DomainNotificationHandler.cs carries validation/business failures back through the request flow.
Persistence and event history
EF Core SQL Server uses separate operational and event-store contexts: src/4 - Infra/4.1 - Data/ToDoListChallenge.Infra.Data/Context/ApplicationDbContext.cs and src/4 - Infra/4.1 - Data/ToDoListChallenge.Infra.Data/Context/EventStoreSQLContext.cs. Task reads/writes use src/4 - Infra/4.1 - Data/ToDoListChallenge.Infra.Data/Repository/TaskItemRepository.cs with specifications; transaction coordination is src/4 - Infra/4.1 - Data/ToDoListChallenge.Infra.Data/UoW/UnitOfWork.cs. Domain events are stored through src/4 - Infra/4.1 - Data/ToDoListChallenge.Infra.Data/EventSourcing/SqlEventStore.cs and normalized into task history by src/2 - Application/ToDoListChallenge.Application/EventSourcedNormalizers/TaskHistory.cs.
Identity and external boundaries
ASP.NET Identity models and JWT issuance are provided by src/4 - Infra/4.2 - CrossCutting/ToDoListChallenge.CrossCutting.Identity/Services/JwtFactory.cs and authorization requirements in src/4 - Infra/4.2 - CrossCutting/ToDoListChallenge.CrossCutting.Identity/Authorization/ClaimsRequirementHandler.cs. Dependency bindings are centralized in src/4 - Infra/4.2 - CrossCutting/ToDoListChallenge.CrossCutting.IoC/NativeInjectorBootStrapper.cs. The domain also defines HTTP, mail, and typed-client boundaries (src/3 - Domain/ToDoListChallenge.Domain/Services/HttpService.cs, src/3 - Domain/ToDoListChallenge.Domain/Services/IFooClient.cs), with Polly/Refit indicated as integration infrastructure.
Main entry points: TaskCommandHandler.cs Task command handler · TaskAppService.cs Task application facade · InMemoryBus.cs In-memory bus · DatabaseExtension.cs Auth, DB & migrations
Components 21
API Host
- API bootstrap · Composes the HTTP application and startup pipeline.
src/1 - Presentation/ToDoListChallenge.Presentation.API/Program.cs - Auth, DB & migrations · Configures JWT, database access, migrations, health checks, and HTTP integrations.
src/1 - Presentation/ToDoListChallenge.Presentation.API/StartupExtensions/DatabaseExtension.cs - Task endpoints
src/1 - Presentation/ToDoListChallenge.Presentation.API/Controllers/TaskController.cs - Account endpoints
src/1 - Presentation/ToDoListChallenge.Presentation.API/Controllers/AccountController.cs
Application & Domain
- Task application facade · Maps view models and coordinates task queries and mutations.
src/2 - Application/ToDoListChallenge.Application/Services/TaskAppService.cs - Task service contract
src/2 - Application/ToDoListChallenge.Application/Interfaces/ITaskAppService.cs - Task mappings · Maps task domain models and API view models in both directions.
src/2 - Application/ToDoListChallenge.Application/AutoMapper/DomainToViewModelMappingProfile.cs - Mediator contract
src/3 - Domain/ToDoListChallenge.Domain.Core/Interfaces/IMediatorHandler.cs - Task commands · Register and update task mutations.
src/3 - Domain/ToDoListChallenge.Domain/Commands/RegisterNewTaskCommand.cs - Task command handler · Validates task changes, persists them, and emits domain events.
src/3 - Domain/ToDoListChallenge.Domain/CommandHandlers/TaskCommandHandler.cs - Task aggregate
src/3 - Domain/ToDoListChallenge.Domain/Models/TaskItem.cs - Domain notifications · Returns validation and business failures through the request flow.
src/3 - Domain/ToDoListChallenge.Domain.Core/Notifications/DomainNotificationHandler.cs - Task event side · Handles registered, updated, and removed task events.
src/3 - Domain/ToDoListChallenge.Domain/EventHandlers/TaskEventHandler.cs - Task history normalizer
src/2 - Application/ToDoListChallenge.Application/EventSourcedNormalizers/TaskHistory.cs
Persistence & Infrastructure
- In-memory bus
src/4 - Infra/4.2 - CrossCutting/ToDoListChallenge.CrossCutting.Bus/InMemoryBus.cs - Task repository · Applies task specifications for operational reads and writes.
src/4 - Infra/4.1 - Data/ToDoListChallenge.Infra.Data/Repository/TaskItemRepository.cs - Unit of work
src/4 - Infra/4.1 - Data/ToDoListChallenge.Infra.Data/UoW/UnitOfWork.cs - Operational EF context
src/4 - Infra/4.1 - Data/ToDoListChallenge.Infra.Data/Context/ApplicationDbContext.cs - SQL event store · Persists domain events in a dedicated EF Core context.
src/4 - Infra/4.1 - Data/ToDoListChallenge.Infra.Data/EventSourcing/SqlEventStore.cs - JWT identity & claims · Issues JWTs and evaluates authorization requirements.
src/4 - Infra/4.2 - CrossCutting/ToDoListChallenge.CrossCutting.Identity/Services/JwtFactory.cs - Dependency bindings
src/4 - Infra/4.2 - CrossCutting/ToDoListChallenge.CrossCutting.IoC/NativeInjectorBootStrapper.cs
Connections 25
- API bootstrap → Auth, DB & migrations: configures
- API bootstrap → Dependency bindings: registers
- Auth, DB & migrations → Operational EF context: configures
- Auth, DB & migrations → JWT identity & claims: enables JWT
- Task endpoints → Task service contract: uses
- Task service contract → Task application facade: implemented by
- Task application facade → Task mappings: maps DTOs
- Task application facade → Mediator contract: dispatches writes
- Task application facade → Task repository: queries tasks
- Account endpoints → JWT identity & claims: issues tokens
- Mediator contract → In-memory bus: implemented by
- In-memory bus → Task command handler: dispatches commands
- Task commands → Task command handler: handled by
- Task command handler → Task aggregate: applies rules
- Task command handler → Task repository: persists
- Task command handler → Unit of work: commits through
- Task command handler → Domain notifications: reports failures
- Task command handler → In-memory bus: publishes events
- In-memory bus → Task event side: dispatches events
- Task event side → SQL event store: stores events
- SQL event store → Task history normalizer: normalizes history
- Task repository → Operational EF context: uses
- Unit of work → Operational EF context: coordinates
- Dependency bindings → In-memory bus: binds
- Dependency bindings → Task application facade: binds