How burstcode/simracingschedule works
1. Overall architecture
This is a .NET backend solution organized as a layered/Clean Architecture style system: API for HTTP entry points, Application for use-case models, Core for domain rules and abstractions, and Infrastructure for persistence and repository implementations.
2. Domain/Core boundary
SimracingSchedule.Core contains the business model and contracts only: entities (Employee, Shift, ShiftExchangeRequest), domain enums (EmployeeRole, ExchangeRequestStatus, ShiftSource, ShiftStatus, ShiftType), a DomainException, and repository interfaces. This layer is the dependency root for the rest of the system.
3. Use-case layer
SimRacingSchedule.Application is focused on shift-exchange workflows. It defines command/query models for creating an exchange, responding to an exchange, and retrieving pending exchanges, plus request/response DTOs and AutoMapper profiles. This layer shapes data for the API and coordinates application-level operations.
4. HTTP/API layer
SimRacingSchedule.Api exposes the system through controllers, currently EmployeeController and ShiftExchangeController. Program.cs wires the app together, and the API project is the only surface that external clients talk to.
5. Persistence layer
SimRacingSchedule.Infrastructure provides EF Core persistence via ApplicationDbContext, entity configurations, migrations, and repository implementations. It bridges the domain repository interfaces from Core to a relational database model.
6. Repository pattern usage
The core defines repository abstractions such as IEmployeeRepository, IShiftRepository, IShiftExchangeRepository, and a generic IRepository. Infrastructure implements them with concrete classes like EmployeeRepository, ShiftRepository, ShiftExchangeRepository, and a shared base repository.
7. Data model and relational mapping
EF Core configurations exist for all main entities: EmployeeConfiguration, ShiftConfiguration, and ShiftExchangeRequestConfiguration. That indicates the domain model is persisted as a relational schema, with migrations already checked in under Infrastructure/Migrations.
8. Primary business flow
The clearest end-to-end flow is the shift exchange use case: an API request enters ShiftExchangeController, becomes an application command/query or DTO, is processed through domain/repository abstractions, and is persisted or read through ApplicationDbContext.
9. Business rules and state
Most domain state is encoded as enums, especially for shift lifecycle and exchange request lifecycle. DomainException suggests invariant enforcement lives in the domain/core boundary rather than in controllers.
10. Composition and dependency injection
Infrastructure/DependencyInjection.cs likely registers EF Core, repositories, and related services, while the API project composes those registrations at startup. This keeps the API thin and makes Infrastructure replaceable behind interfaces.
11. Runtime and deployment shape
The repository includes Dockerfile for the API, docker-compose.yml, .env.dist, and environment-specific appsettings. That means the service is designed to run containerized, with configuration externalized from code.
12. Diagram takeaway
For an architecture diagram, the key boundaries are: Client -> API controllers -> Application use cases -> Core domain abstractions -> Infrastructure repositories/DbContext -> database. The core domain stays isolated, and all persistence concerns are pushed into Infrastructure.
Main entry points: ShiftExchangeController.cs Shift Exchange · ShiftExchangeRequest.cs Exchange Request · IRepository.cs Contracts · MappingProfile.cs Mapping
Components 19
API
HTTP entrypoints and app startup
- Startup · Composes the API and dependency injection
SimRacingSchedule.Api/Program.cs - Employees · HTTP endpoints for employees
SimRacingSchedule.Api/Controllers/EmployeeController.cs - Shift Exchange · HTTP endpoints for exchange workflows
SimRacingSchedule.Api/Controllers/ShiftExchangeController.cs
Application
Use-case orchestration and DTO mapping
- Create Exchange · Command model for creating an exchange request
SimRacingSchedule.Application/Commands/ShiftExchange/CreateShiftExchangeCommand.cs - Respond Exchange · Command model for approving or rejecting an exchange
SimRacingSchedule.Application/Commands/ShiftExchange/RespondToShiftExchangeCommand.cs - Pending Query · Query model for retrieving pending exchanges
SimRacingSchedule.Application/Queries/ShiftExchange/GetPendingExchangesQuery.cs - DTOs · Request and response shapes shared with controllers
SimRacingSchedule.Application/DTOs/ShiftExchangeRequestDto.cs - Mapping · AutoMapper configuration between domain and DTOs
SimRacingSchedule.Application/Mapping/MappingProfile.cs
Core
Domain model and repository contracts
- Employee · Employee aggregate/data model
SimracingSchedule.Core/Entities/Employee.cs - Shift · Shift aggregate/data model
SimracingSchedule.Core/Entities/Shift.cs - Exchange Request · Shift exchange workflow entity
SimracingSchedule.Core/Entities/ShiftExchangeRequest.cs - Contracts · Repository abstractions used by the application
SimracingSchedule.Core/Interfaces/IRepository.cs - Rules · Domain exception and enum-based state model
SimracingSchedule.Core/Exceptions/DomainException.cs
Infrastructure
EF Core persistence and repository implementations
- DbContext · Primary persistence session and unit of work
SimRacingSchedule.Infrastructure/Data/ApplicationDbContext.cs - Mappings · Entity-to-table configuration classes
SimRacingSchedule.Infrastructure/Data/Configurations/ShiftExchangeConfiguration.cs - Repos · Concrete repository implementations
SimRacingSchedule.Infrastructure/Repositories/Repository.cs - Migrations · Checked-in database schema evolution
SimRacingSchedule.Infrastructure/Migrations/20260404092900_InitialCreate.cs - DI Setup · Registers infrastructure services for the host
SimRacingSchedule.Infrastructure/DependencyInjection.cs
Other components
- Client · Calls the HTTP API
Connections 28
- Client → Employees: HTTP · External requests reach employee endpoints
- Client → Shift Exchange: HTTP · External requests reach shift exchange endpoints
- Startup → Employees: maps routes · Startup hosts the controllers
- Startup → Shift Exchange: maps routes · Startup hosts the controllers
- Startup → DI Setup: registers · Composes infrastructure services at startup
- Employees → Contracts: uses · Controller depends on application/domain abstractions
- Shift Exchange → Create Exchange: creates · Request payload becomes application command
- Shift Exchange → Respond Exchange: creates · Request payload becomes application command
- Shift Exchange → Pending Query: runs · Controller issues query for pending exchanges
- Create Exchange → Exchange Request: updates · Use case targets the exchange request model
- Respond Exchange → Exchange Request: updates · Use case changes exchange request state
- Pending Query → Exchange Request: reads · Query reads exchange request data
- DTOs → Mapping: mapped by · DTOs are translated through AutoMapper
- Mapping → Employee: maps · Profiles include domain-to-DTO mapping
- Mapping → Shift: maps · Profiles include domain-to-DTO mapping
- Mapping → Exchange Request: maps · Profiles include domain-to-DTO mapping
- Contracts → Employee: abstracts · Repository interface for employees
- Contracts → Shift: abstracts · Repository interface for shifts
- Contracts → Exchange Request: abstracts · Repository interface for exchange requests
- Repos → DbContext: uses · Repositories execute persistence operations through EF Core
- DbContext → Mappings: applies · Context applies entity configurations
- DbContext → Migrations: evolves via · Schema history is maintained by migrations
- Repos → Contracts: implements · Concrete repositories fulfill core contracts
- DI Setup → DbContext: registers · Dependency injection wires the EF Core context
- DI Setup → Repos: registers · Dependency injection wires repository implementations
- Rules → Exchange Request: constrains · Domain invariants and lifecycle states apply to entities
- Rules → Shift: constrains · Domain invariants and lifecycle states apply to entities
- Shift Exchange → DTOs: binds · Controller input and output use shared DTOs