Vega B2B is a gamified, adaptive language learning platform. The backend is built on .NET 8 following Clean Architecture, CQRS (Command Query Responsibility Segregation), and Domain-Driven Design (DDD) principles to provide a scalable, secure, and performant service.
The system strictly adheres to Clean Architecture, keeping the core business logic independent of external frameworks, databases, and UI layers.
graph TD
API[API Layer: CleanArc.Web.Api] --> Application[Application Layer: CleanArc.Application]
Infrastructure[Infrastructure Layer: Identity, Persistence, CrossCutting] --> Application
Infrastructure --> Domain[Domain Layer: CleanArc.Domain]
Application --> Domain
The project code is organized as follows:
vega-backend/src/
βββ Core/
β βββ CleanArc.Domain/ # Core Domain Entities (no external dependencies)
β β βββ Common/BaseEntity.cs # Audit logs, BaseEntity, IEntity
β β βββ Entities/ # Bounded contexts: User, Adaptive, Quiz, Institution
β βββ CleanArc.Application/ # Business Logic & CQRS Pipelines
β βββ Features/ # Mediator Handlers organized by Bounded Context
β βββ Contracts/ # Interfaces (IUnitOfWork, IRepository, AI services)
β βββ Models/Common/ # OperationResult Result Monad
β βββ Profiles/ # AutoMapper Profile mapping
βββ Infrastructure/
β βββ CleanArc.Infrastructure.Persistence/ # Entity Framework Core and Data Stores
β β βββ ApplicationDbContext.cs # Database Context & SQL configurations
β β βββ Repositories/ # Database Repository Implementations
β β βββ Services/ # Adaptive Challenge engines & AI pipeline services
β βββ CleanArc.Infrastructure.Identity/ # Identity Server configuration
β βββ Identity/ # ASP.NET Identity (Roles, Claims, Seeding)
β βββ Jwt/ # JWT Token Service
βββ API/
βββ CleanArc.Web.Api/ # Carter Routing Modules & Controllers
βββ Modules/ # Carter ICarterModule Endpoint Modules (REST endpoints)
βββ Scripts/SchemaRepairs/ # Custom SQLite Schema Repair Scripts
βββ Program.cs # Application Bootstrapper
Every database modification or data fetch operation runs through a pipeline using Mediator. Handlers are defined in the same file as their commands to keep features cohesive and maintainable.
public sealed record objects.internal sealed class implementations.ApplicationDbContext directly; they always interact through IUnitOfWork.To avoid throwing custom exceptions for expected domain errors (e.g. resource not found, forbidden operations), handlers return OperationResult.
SuccessResult(value) $\rightarrow$ maps to 200 OKFailureResult(message) $\rightarrow$ maps to 400 Bad RequestUnauthorizedResult(message) $\rightarrow$ maps to 401 UnauthorizedForbiddenResult(message) $\rightarrow$ maps to 403 ForbiddenNotFoundResult(message) $\rightarrow$ maps to 404 Not FoundInstead of traditional bloated controllers, route mapping is handled using ICarterModule configurations in CleanArc.Web.Api/Modules/. Endpoints are lightweight and versioned explicitly.
Roles are defined in the RoleNames static class (student, teacher, and institution_admin).
admin and institution_admin roles dynamically to each other.Generates and assigns learning challenges based on individual student performance.
translation, targetWord, text keys automatically to word).student role.MaxSeats).AiUsageLog / AiAuditLog).Compile the projects to verify code cleanliness:
dotnet build
The project includes a robust suite of unit and integration tests covering security, AI generation, and database limits:
dotnet test
We use Entity Framework Core for persistence migrations. Additionally, dynamic SQL schema scripts (such as 20260630_RemoveLegacyClassroomMetadataColumns.sql) run automatically at startup to repair legacy columns.
dotnet ef migrations add <MigrationName> -p src/Infrastructure/CleanArc.Infrastructure.Persistence -s src/API/CleanArc.Web.Api
dotnet ef database update -p src/Infrastructure/CleanArc.Infrastructure.Persistence -s src/API/CleanArc.Web.Api
cd src/API/CleanArc.Web.Api
dotnet run
C#
99.2%
Vega B2B is a gamified, adaptive language learning platform. The backend is built on .NET 8 following Clean Architecture, CQRS (Command Query Responsibility Segregation), and Domain-Driven Design (DDD) principles to provide a scalable, secure, and performant service.
The system strictly adheres to Clean Architecture, keeping the core business logic independent of external frameworks, databases, and UI layers.
graph TD
API[API Layer: CleanArc.Web.Api] --> Application[Application Layer: CleanArc.Application]
Infrastructure[Infrastructure Layer: Identity, Persistence, CrossCutting] --> Application
Infrastructure --> Domain[Domain Layer: CleanArc.Domain]
Application --> Domain
The project code is organized as follows:
vega-backend/src/
βββ Core/
β βββ CleanArc.Domain/ # Core Domain Entities (no external dependencies)
β β βββ Common/BaseEntity.cs # Audit logs, BaseEntity, IEntity
β β βββ Entities/ # Bounded contexts: User, Adaptive, Quiz, Institution
β βββ CleanArc.Application/ # Business Logic & CQRS Pipelines
β βββ Features/ # Mediator Handlers organized by Bounded Context
β βββ Contracts/ # Interfaces (IUnitOfWork, IRepository, AI services)
β βββ Models/Common/ # OperationResult Result Monad
β βββ Profiles/ # AutoMapper Profile mapping
βββ Infrastructure/
β βββ CleanArc.Infrastructure.Persistence/ # Entity Framework Core and Data Stores
β β βββ ApplicationDbContext.cs # Database Context & SQL configurations
β β βββ Repositories/ # Database Repository Implementations
β β βββ Services/ # Adaptive Challenge engines & AI pipeline services
β βββ CleanArc.Infrastructure.Identity/ # Identity Server configuration
β βββ Identity/ # ASP.NET Identity (Roles, Claims, Seeding)
β βββ Jwt/ # JWT Token Service
βββ API/
βββ CleanArc.Web.Api/ # Carter Routing Modules & Controllers
βββ Modules/ # Carter ICarterModule Endpoint Modules (REST endpoints)
βββ Scripts/SchemaRepairs/ # Custom SQLite Schema Repair Scripts
βββ Program.cs # Application Bootstrapper
Every database modification or data fetch operation runs through a pipeline using Mediator. Handlers are defined in the same file as their commands to keep features cohesive and maintainable.
public sealed record objects.internal sealed class implementations.ApplicationDbContext directly; they always interact through IUnitOfWork.To avoid throwing custom exceptions for expected domain errors (e.g. resource not found, forbidden operations), handlers return OperationResult.
SuccessResult(value) $\rightarrow$ maps to 200 OKFailureResult(message) $\rightarrow$ maps to 400 Bad RequestUnauthorizedResult(message) $\rightarrow$ maps to 401 UnauthorizedForbiddenResult(message) $\rightarrow$ maps to 403 ForbiddenNotFoundResult(message) $\rightarrow$ maps to 404 Not FoundInstead of traditional bloated controllers, route mapping is handled using ICarterModule configurations in CleanArc.Web.Api/Modules/. Endpoints are lightweight and versioned explicitly.
Roles are defined in the RoleNames static class (student, teacher, and institution_admin).
admin and institution_admin roles dynamically to each other.Generates and assigns learning challenges based on individual student performance.
translation, targetWord, text keys automatically to word).student role.MaxSeats).AiUsageLog / AiAuditLog).Compile the projects to verify code cleanliness:
dotnet build
The project includes a robust suite of unit and integration tests covering security, AI generation, and database limits:
dotnet test
We use Entity Framework Core for persistence migrations. Additionally, dynamic SQL schema scripts (such as 20260630_RemoveLegacyClassroomMetadataColumns.sql) run automatically at startup to repair legacy columns.
dotnet ef migrations add <MigrationName> -p src/Infrastructure/CleanArc.Infrastructure.Persistence -s src/API/CleanArc.Web.Api
dotnet ef database update -p src/Infrastructure/CleanArc.Infrastructure.Persistence -s src/API/CleanArc.Web.Api
cd src/API/CleanArc.Web.Api
dotnet run
C#
99.2%