A modern, high-performance Training Management System (TMS) RESTful Web API built with ASP.NET Core 10 following Clean Architecture principles and CQRS pattern.
This system provides comprehensive management for educational institutions and training centers, supporting Student Profiles, Course Catalogs, Real-time Enrollments, Assessment Grading, Certificate Generation, and Transcript Export Processing.
- Clean Architecture: Decoupled multi-project structure (
Api,Application,Infrastructure,Domain, andTests). - CQRS & MediatR Pattern: Clear separation of command mutations and query operations.
- Decorator Pattern Caching:
CachedCourseServicewrapping data access with high-performanceIMemoryCache. - API Versioning (V1 & V2): Seamless API evolution supported by custom
V1DeprecationMiddlewareproviding standard HTTPDeprecationandSunsetheaders.
- JWT & Cookie Authentication: Secure cookie handling with XSRF-TOKEN antiforgery protection.
- Claim-Based Authorization: Custom policy handlers like
CourseInstructorHandlerfor fine-grained resource security. - Password Hashing: Industry-standard password hashing via BCrypt.
- SignalR Real-Time Hubs:
TmsHubfor live notification dispatches to connected clients. - Background Worker Services:
TranscriptWorkerhosted service for async transcript export jobs. - Resilient Upstream Integration: Circuit-breaker and retry logic simulation for certificate issuance services.
- Scalar OpenAPI Documentation: Modern, interactive API reference available at
/scalar/v1. - Request Tracing Middleware:
RequestLoggingMiddlewarewith customX-Correlation-Idheaders. - Health Check Endpoints:
/health/live(liveness) and/health/ready(readiness) probes. - Automated Data Seeding:
DataSeederservice for instant database population in dev/testing environments.
- Framework: .NET 10 (C# 13)
- Data Access: Entity Framework Core 10, LINQ, In-Memory / SQL Server Context
- Validation: FluentValidation
- Real-Time Communication: ASP.NET Core SignalR
- Documentation: Microsoft.AspNetCore.OpenApi & Scalar.AspNetCore
- Testing: xUnit, Moq, Microsoft.AspNetCore.Mvc.Testing
TmsApi/
├── TmsApi.Api/ # Presentation Layer (Controllers, Middleware, Hubs)
│ ├── Authorization/ # Custom Requirement Handlers
│ ├── Controllers/ # V1 & V2 API Endpoints
│ ├── Middleware/ # Logging & Versioning Middleware
│ ├── Hubs/ # SignalR WebSockets Hub
│ ├── Program.cs # Application Pipeline Configuration
│ └── appsettings.json # System Settings & Database Connection Strings
├── TmsApi.Application/ # Application Layer (Use Cases, CQRS Commands/Queries)
│ ├── Enrollments/ # Enrollment Commands & Validators
│ └── Services/ # Core Business Services & Interfaces
├── TmsApi.Infrastructure/ # Infrastructure Layer (Data Persistence & External Services)
│ ├── Persistence/ # DbContext & DataSeeder
│ ├── Services/ # Cached Services & Decorators
│ └── Workers/ # Background Hosted Workers
├── TmsApi.Domain/ # Domain Layer (Entities, Enums, Interfaces)
│ ├── Entities/ # Student, Course, Enrollment, Assessment models
│ └── Common/ # Shared Value Objects & Domain Exceptions
└── TmsApi.Tests/ # Testing Layer (Unit & Integration Tests)
├── AssessmentsApiTests.cs # End-to-End API Integration Tests
├── GetCourseHandlerTests.cs # CQRS Query Unit Tests
└── EnrollStudentHandlerTests.cs # Command Execution Unit Tests
- .NET 10 SDK or higher
- IDE: Visual Studio 2022 / VS Code / JetBrains Rider
-
Clone the Repository
git clone https://github.com/YourUsername/TMSAPI.git cd TMSAPI -
Restore Dependencies
dotnet restore
-
Run Database Migrations & Seeding The application automatically seeds sample data on startup via
DataSeeder. -
Run the Application
cd TmsApi.Api dotnet run -
Access Interactive API Docs Open your browser and navigate to:
- Scalar API Reference:
http://localhost:5000/scalar/v1 - OpenAPI JSON Spec:
http://localhost:5000/openapi/v1.json
- Scalar API Reference:
Execute the full suite of unit and integration tests:
dotnet test| Category | Method | Endpoint | Description |
|---|---|---|---|
| Auth | POST |
/api/auth/login |
Authenticate user and issue JWT / Cookie |
| Courses | GET |
/api/v1/courses |
List all active courses |
| Courses | GET |
/api/v2/courses |
Paginated course catalog with caching |
| Students | GET |
/api/v1/students |
Retrieve student profiles & GPAs |
| Enrollments | POST |
/api/v1/enrollments |
Enroll student in a course |
| Assessments | GET |
/api/assessments |
Fetch student grades and course assessments |
| Certificates | POST |
/api/v2/certificates |
Request course completion certificate |
| Transcripts | POST |
/api/v2/transcripts |
Trigger background transcript export worker |
| Health | GET |
/health/live |
Liveness health check probe |
| Health | GET |
/health/ready |
Readiness health check probe |
This project is licensed under the MIT License.