OboxSTEAM.API is a .NET 8 ASP.NET Core backend using clean architecture with PostgreSQL and AWS integrations.
| Concern | Choice |
|---|---|
| Runtime | .NET 8 |
| Web framework | ASP.NET Core (Kestrel) |
| ORM | Entity Framework Core + Npgsql |
| Database | PostgreSQL |
| Auth | JWT Bearer + refresh tokens |
| Object storage | AWS S3 |
| Face recognition | AWS Rekognition |
| Video transcoding | AWS MediaConvert + SNS webhooks |
| AI runtime | AWS Bedrock (registered) |
| Resend | |
| Real-time | SignalR (hub configured) |
| API docs | Swagger / Swashbuckle |
Record: docs/decisions/0006-dotnet-clean-architecture-stack.md.
OboxSteam.Domain/
Entities/ # 40+ domain entities
Enums/ # RoleType, ActivityType, AssignmentType, ...
Interfaces/ # IUnitOfWork, IGenericRepository
OboxSteam.Application/
DTOs/ # Request/response shapes per feature area
Interfaces/ # IAuthService, IProgramService, ...
Services/ # Application logic
Validation/ # Fluent validators
Utils/ # ApiResult, ErrorHelper, HashHelper
OboxSteam.Infrastructure/
Persistence/ # OboxSteamDbContext, migrations, factory
Repositories/ # GenericRepository, UnitOfWork
Services/ # AWS, email, CSV parser implementations
OboxSteam.API/
Controllers/ # 19 REST controllers
Architecture/ # IocContainer, migrations, env loading
Middlewares/ # GlobalExceptionMiddleware
Build entrypoint:
dotnet build OboxSteam.API/OboxSteam.API.csprojdomain
<- application
<- infrastructure
<- interface (OboxSteam.API)
| Layer | May depend on | Must not depend on |
|---|---|---|
| domain | pure utilities | framework, database, HTTP, AWS SDK |
| application | domain | EF Core, controllers, AWS concrete types |
| infrastructure | domain, application interfaces | controllers |
| API | all registered services | direct DbContext usage in controllers |
Inner layers must not depend on outer layers. Controllers delegate to application
services; services use IUnitOfWork and domain types.
HTTP request DTOs are parsed at the controller boundary. Services validate business rules and map to domain entities before persistence.
Boundaries include:
- HTTP bodies and route parameters (
OboxSteam.Application/DTOs/). - JWT claims via
IClaimsService. - Environment variables and
appsettings(loaded inIocContainer). - EF entities returned from
GenericRepository. - AWS SNS webhook payloads (
AwsWebhookController). - CSV rows for question bank import.
Target flow:
HTTP request
-> controller + DTO
-> application service
-> domain entity / business rule
-> infrastructure persistence or provider call
-> ApiResult<T> response
Reads and writes are separated at the service level (IProgramService,
IQuizAttemptService, etc.) even though CQRS mediators are not used. Mutating
operations own validation and side effects; queries return DTOs.
| Controller | Route prefix | Domain |
|---|---|---|
| AuthController | /api/auth |
Registration, login, OTP, tokens |
| AccountController | /api/account |
Profile and account settings |
| ProgramController | /api/programs |
Program catalog, admin, advisory workspace, approval / publish |
| ModuleController | /api/modules |
Module CRUD |
| CourseController | /api/courses |
Course CRUD |
| ActivityController | /api/activities |
Activity CRUD |
| MaterialController | /api/materials |
Learning materials |
| AssignmentController | /api/assignments |
Assignments |
| QuestionBankController | /api/question-banks |
Question banks |
| QuizController | /api |
Quiz attempt lifecycle |
| RetrospectiveController | /api |
Retrospective draft and submit |
| ProgramEnrollmentController | /api/program-enrollments |
Program enrollment |
| ModuleEnrollmentController | /api/module-enrollments |
Module enrollment |
| ParentController | /api/parent |
Parent–student linking |
| ExpertController | /api/experts |
Expert profiles |
| ProgramFrameworkController | /api/program-frameworks |
Expert curriculum blueprints and rubric criteria |
| ClassSessionExpertController | /api/class-session-experts |
Offline co-teach invite and private mentor feedback |
| ProgramReviewController | /api/programs/{id}/reviews |
Student reviews |
| MediaController | /api/media |
Media assets |
| HighlightVideoController | /api/highlight-video |
Class-scoped highlight stacks |
| AwsWebhookController | /api/webhooks/aws |
SNS callbacks |
| SeedController | /api/seed |
Dev seed data |
- Load
.envfrom solution root. - Configure CORS, JSON, JWT, Swagger, SignalR, DI.
- Apply EF migrations (fail fast on error).
- Ensure Rekognition collection and S3 bucket exist.
- Map controllers and run on port 5000.
GlobalExceptionMiddleware logs warnings for 4xx business errors and errors
with stack traces for 5xx. Structured request logging per
docs/ARCHITECTURE.md observability template is partially met via middleware
logging; a full canonical JSON request log line is not yet implemented.
Telemetry export (Traceway Cloud, OpenTelemetry over OTLP/HTTP) is wired in
OboxSteam.API/Architecture/ObservabilityExtensions.cs and is active only when
both OTEL_EXPORTER_OTLP_ENDPOINT and TRACEWAY_BACKEND_TOKEN are set
(production VPS). Local runs and tests export nothing.
| Signal | Source |
|---|---|
| Endpoints | ASP.NET Core request spans (Swagger, /hubs, static files filtered); user.id and user.role tags only |
| Child spans | Npgsql SQL, HttpClient, AWS SDK |
| Issues | 5xx exceptions recorded by GlobalExceptionMiddleware; 4xx business errors are not Issues |
| Tasks | CONSUMER spans with stable kebab-case names. Polling jobs use TelemetrySources.RunPollingJobAsync: only ticks that did work or failed are exported, without child spans. The queue-driven personal-video-generation worker uses RunBackgroundJobAsync and exports every job with child spans |
| AI Traces | Bedrock strength-match call: model, tokens, finish reason; no prompt or completion text |
| Logs | ILogger records; TelemetryLogRedactionProcessor masks emails and drops Desc/Body/Raw values in the exported copy only; EF Core command logs below Warning are not exported |
| Metrics | .NET runtime only (endpoint latency comes from request spans); host metrics from the Traceway agent on the VPS |
Plan and rollout: docs/plans/completed/traceway-observability.md.
Audit product records (submissions, attendance, enrollment changes) live in PostgreSQL entities; distinguish them from operational application logs.
| Command | Status |
|---|---|
dotnet build OboxSteam.API/OboxSteam.API.csproj |
Available |
dotnet test OboxSteam.Test/OboxSteam.Test.csproj |
Available (unit) |
| Integration / E2E / platform scripts | Not defined |
Epic-level proof snapshot: docs/TEST_MATRIX.md.