Backend REST API for OboxSTEAM, a Vietnamese STEAM education platform. It runs experiential learning programs end to end: curriculum design with expert review, cohort classes with live and offline sessions, assessments, payments, and a student portfolio built from certificates, skills, and AI-processed media.
This repository is the .NET backend only. The Next.js frontend lives in a separate repository.
| Role | What they do |
|---|---|
| Admin | Platform administration |
| Manager | Programs, classes, question banks, assignments, mentor assignment approval |
| Expert | Program frameworks and rubrics, advisory chat, curriculum approval, offline co-teaching |
| Mentor | Teaches courses and classes, grades work, manages skill profile |
| Student | Enrolls and pays, attends sessions, completes activities and assessments, owns a portfolio |
| Parent | Linked to students; sees progress, approves and pays |
Roles are enforced with JWT role claims. Details: docs/product/permissions.md.
Curriculum and expert review
Program -> Module (Theory | Experiential | Research) -> Course -> Activity (SelfPaced | LiveOnline | Offline), with materials, assignments, and research milestones.- Expert program frameworks (blueprints and rubric criteria), advisory discussion with attachments and mentions, curriculum versioning with a change log, and approval before publishing.
- Skill catalog linked to programs; student and mentor skill snapshots backed by evidence.
Classes and sessions
- Classes (cohorts) with mentors, capacity, schedules, and automatic start of open classes.
- Class sessions for live online (embedded 8x8 JaaS meetings) and offline work, with QR/code check-in, attendance, session evidence, and expert co-teach invitations.
- Per-class assignment windows, session reminders, and automatic session start/completion.
- Mentors request to teach a class and managers approve or reject.
- Class continuity (redelivery): a student picks another eligible class and pays 50% of the program price.
Enrollment and payments
- Program and module enrollment with prerequisites, seat holds during checkout, and Stripe payments.
- Fail and drop close a purchase; continuing is a windowed rebuy into another eligible cohort.
- An invoice per payment (also emailed); parent payment requests with checkout links.
Assessment
- Bank-drawn and direct quizzes (with per-class question sets), file-upload assignments, retrospectives, and research milestone submissions.
- Attempt limits by module type; assessment recovery requests let mentors grant extra attempts.
Portfolio, certificates, and media
- Automatic PDF certificates when a program is completed.
- Student portfolios with sections and galleries, published on per-student subdomains.
- Media upload with AWS Rekognition face tagging; class highlight videos and personal highlight reels (AWS MediaConvert), optionally filtered to a student's strength using AWS Bedrock.
Notifications and dashboards
- Inbox notifications with real-time delivery over SignalR (
/hubs/notifications) and email for priority events. - Role dashboards and a personal schedule.
Full product contract: docs/product/overview.md.
| Concern | Technology |
|---|---|
| Runtime | .NET 8, ASP.NET Core 8 |
| Database | PostgreSQL (EF Core 8 + Npgsql) |
| Auth | JWT Bearer with refresh tokens |
| Real-time | SignalR |
| Storage and media | AWS S3, Rekognition, MediaConvert (SNS webhooks) |
| AI | AWS Bedrock (Mantle, OpenAI-compatible client) |
| Payments | Stripe |
| Resend (Vietnamese templates) | |
| Meetings | 8x8 JaaS (Jitsi as a Service) |
| QuestPDF (certificates) | |
| Observability | OpenTelemetry exported to Traceway Cloud |
| API docs | Swagger (Swashbuckle) |
| Tests | xUnit, Moq, EF Core InMemory, Coverlet |
| Delivery | Docker, Docker Hub, GitHub Actions |
Clean architecture: inner layers never depend on outer ones.
OboxSTEAM.API/
├── OboxSteam.Domain/ # Entities, enums, repository interfaces
├── OboxSteam.Application/ # Services, DTOs, validators, notifications, business rules
├── OboxSteam.Infrastructure/ # EF Core, migrations, repositories, AWS/Stripe/email, background jobs
├── OboxSteam.API/ # Controllers, SignalR hub, DI, middleware, observability
├── OboxSteam.Test/ # Unit tests
├── docs/ # Product contract, architecture, decisions, plans
└── scripts/ # Coverage and tooling scripts
More detail: docs/ARCHITECTURE.md.
| Job | Interval | Purpose |
|---|---|---|
ClassSeatHoldCleanupService |
1 min | Release expired checkout seat holds |
SessionReminderService |
5 min | Send "session starting soon" notifications |
SessionLifecycleService |
5 min | Start due sessions, complete elapsed ones |
AssignmentWindowCloseService |
5 min | Grade timed-out quiz attempts, close elapsed assignment windows |
OpenClassAutoStartService |
Adaptive (up to 30 min) | Move eligible open classes to in progress |
PendingEnrollmentCleanupService |
1 h | Remove unpaid enrollments older than one day |
DiscussionAttachmentPurgeService |
1 h | Purge unsent advisory discussion attachments |
PersonalVideoGenerationWorker |
Queue | Build personal highlight reels |
- .NET 8 SDK
- Docker Desktop (for PostgreSQL, or to run the whole stack)
Copy .env.example to .env at the solution root and fill in values. The API
loads it at startup. .env is gitignored; never commit it.
- Required to boot: connection string,
JWT__*,APP_BASE_URL,CORS_ALLOWED_ORIGINS,POSTGRES_*,API_PORT. - Needed for full features: AWS (S3, Rekognition, MediaConvert, SNS), Bedrock, Stripe, Resend, and JaaS keys.
- Telemetry:
OTEL_EXPORTER_OTLP_ENDPOINTandTRACEWAY_BACKEND_TOKENare production only. Leave them unset locally and nothing is exported.
The example connection string uses the Docker host oboxsteam.database. When
running the API with dotnet run against the Docker database, use
Host=localhost;Port=5433 (the POSTGRES_PORT mapping) instead.
docker compose up -dStarts PostgreSQL and the API. EF Core migrations are applied on startup.
docker compose up -d oboxsteam.database
dotnet run --project OboxSteam.APISwagger UI is served at the root URL (http://localhost:5000/).
POST /api/seed/allPopulates programs, classes, curriculum, and test users for development.
DELETE /api/seed/clear wipes all data, so never call it against production.
dotnet build OboxSteam.API/OboxSteam.API.csproj
dotnet test OboxSteam.Test/OboxSteam.Test.csprojUnit tests with Application-layer coverage:
.\scripts\run-coverage.ps1
.\scripts\run-coverage.ps1 -Filter "FullyQualifiedName~ClassServiceTests"Generate migrations with the EF CLI. Never hand-write migration files or edit the model snapshot.
dotnet tool restore
dotnet ef migrations add <MigrationName> --project OboxSteam.Infrastructure/OboxSteam.Infrastructure.csproj --startup-project OboxSteam.API/OboxSteam.API.csprojAll routes live under /api. Every response uses the ApiResult envelope
(docs/product/api-conventions.md).
| Area | Route prefixes |
|---|---|
| Auth and account | /auth, /account, /me, /parent |
| Curriculum | /programs, /programs/{id}/curriculum/changes, /program-frameworks, /modules, /courses, /activities, /materials, /skills |
| People | /experts, /mentors |
| Classes | /classes, /classes/{classId}/sessions, .../attendance, /class-sessions (check-in, meetings, evidence), /class-session-experts, /class-enrollments, /class-mentor-requests, /class-redelivery-requests, /schedules |
| Enrollment and payments | /program-enrollments, /module-enrollments, /activity-progresses, /payments, /invoices |
| Assessment | /assignments, /assignments/{id}/classes/{classId}/quiz-set, /question-banks, quiz, retrospective, submission, and research milestone routes, /assessment-recovery-requests |
| Portfolio and media | /portfolios, /certificates, /media, /highlight-video, /programs/{id}/reviews |
| Platform | /notifications, /dashboard, /webhooks/aws, /seed |
- Responses:
ApiResult/ApiResult<T>. Business errors go throughErrorHelperandGlobalExceptionMiddleware. - JSON: camelCase, enums as strings. Dates are stored in UTC; user wall-clock time is
Asia/Ho_Chi_Minh. - Persistence:
IUnitOfWork+GenericRepository, soft delete through global query filters, enums stored as text. - Code style: manual DTO mapping, no
Asyncsuffix on controller actions. See.cursor/rules/coding-style-csharp.mdc. - Uploads: up to 3 GB per request.
- Deploy: every push to
mainruns.github/workflows/deploy.yml. It builds the image fromOboxSteam.API/Dockerfile, pushes it to Docker Hub, then connects to the VPS over SSH to pull it and recreate theobox-backendcontainer. The VPS keeps its owndocker-compose.ymland.env, and the workflow only updates the image tag. New environment variables have to be added on the VPS by hand. - Monitoring: production exports traces, logs, runtime metrics, background-job runs, and Bedrock calls to Traceway Cloud through OpenTelemetry. Exported logs have emails masked, and idle background-job runs are not exported. A Traceway agent on the VPS reports host metrics. Details: the Observability Contract in
docs/ARCHITECTURE.md.
| Topic | Location |
|---|---|
| Product overview and capability map | docs/product/overview.md |
| Curriculum, enrollment, assessment, notifications | docs/product/ |
| Architecture and layering | docs/ARCHITECTURE.md |
| Architecture decisions | docs/decisions/ |
| Test coverage by epic | docs/TEST_MATRIX.md |
| Contributor and agent workflow | docs/WORKFLOW.md, AGENTS.md |
Private — Semester 9 project.