A production-grade, high-concurrency, multi-tenant financial engine built with .NET 9. This backend controls the lifecycle of short-term loans, automated interest/VAT snapshotting, multi-tier audit records, and live system logging.
The system is decoupled into four explicit layout layers to protect domain integrity and enforce the separation of concerns:
Domain: Independent layer holding system core objects (POCOs), Domain Enums (LoanStatus), and structural entity models.Application: Contains structural Data Transfer Objects (DTOs), processing contracts (IAuditService,IExcelService), and security engines.Infrastructure: Holds concrete framework implementations (ApplicationDbContext), multi-tenant token extractors (CurrentTenantService), real-time pipelines, background tasks (ChronosWorker), and reporting dependencies.Api: Web interface, request controllers, middleware processing pipelines, and explicit OpenApi/Scalar mappings.
- Framework: .NET 9.0 (Web API)
- Database Engine: Microsoft SQL Server
- ORM: Entity Framework Core 9.0
- Real-Time Transmission: ASP.NET Core SignalR (WebSockets)
- Cryptographic Hashing: BCrypt.Net-Next
- Reporting Engine: ClosedXML (OpenXML wrapper for Excel generation)
- Interactive API Docs: Microsoft.AspNetCore.OpenApi + Scalar API
- Containerization Engine: Docker & Docker Compose
- Multi-Tenancy (Data Isolation): Automated tenant filtering via EF Core
HasQueryFiltertied to the current user's authenticatedOrganizationIdclaim. Cross-tenant data leaks are structurally blocked at the database execution layer. - Financial Snapshotting: Interest and VAT values are permanently copied from the
Organizationrow settings into theLoanrow at the exact moment of contract creation to insulate historical ledger records against future configuration adjustments. - Soft Delete Integration: Data records are never physically stripped from the persistent storage. Rows are updated with an
IsDeleted = trueflag, stamped with the admin tracking ID (DeletedById), and automatically ignored by active query streams. - Descriptive Auditing: The
IAuditServicerecords explicit "Before" and "After" state data variations into the database rather than system codes, ensuring human-readable, compliant ledger reviews.
- .NET 9.0 SDK
- Docker Desktop or local Microsoft SQL Server instance
- Modern Terminal (PowerShell / Bash)
Update the configuration variables in LoanManagementSystem.Api/appsettings.json to link to your runtime database instance:
{
"ConnectionStrings": {
"DbConnection": "Server=YOUR_SERVER;Database=LMSDB;Trusted_Connection=True;TrustServerCertificate=True;"
},
"Jwt": {
"Key": "PCuLYf7bWtAOvXejfHO5IuIhmWCMyzr7Bz3RKHuYf1d0VChhRIAbSvksszyuJx6H+VHxwp2PosDOgVF2uv3YXg==",
"Issuer": "LoanManagementSystem",
"Audience": "LoanManagementSystemUsers",
"DurationInMinutes": 60
}
}From the root folder containing your .sln file:
1. Restore dependencies and verify compilation:
dotnet restore
dotnet build2. Generate a new database schema migration (if updates are introduced):
dotnet ef migrations add NameOfYourMigration --project LoanManagementSystem.Infrastructure --startup-project LoanManagementSystem.Api3. Directly apply database updates:
dotnet ef database update --project LoanManagementSystem.Infrastructure --startup-project LoanManagementSystem.ApiThe platform is configured with an automated multi-stage build script that orchestrates both the .NET API application and a fresh SQL Server container workspace instantly.
To spin up the entire backend container environment, run the following command inside the root folder:
docker-compose up --build- Scalar API Interactive Panel: Navigate to
http://localhost:5000/scalar/v1inside your browser once compilation completes. - Raw Document Endpoint: Extract your schema mapping data straight from
http://localhost:5000/openapi/v1.json.
##NOTE!!!:Latest API full documentation is on docs/v1.json
POST /api/auth/login- Authenticates administrative or officer profiles. Returns signature JWT Bearer data token.
GET /api/organizations- Yields total master list of branches (Strict Access: System Root Branch Only).POST /api/organizations- Onboards a new operational tenant organization into the cloud ecosystem.PUT /api/organizations/{id}- Updates live baseline settings (VAT/Default Rates) for a branch footprint.
GET /api/users- Extracts active personnel rosters attached to the current company context.POST /api/users- Introduces a new employee context (Passwords run automatic underlying BCrypt salt hashes).PUT /api/users/{id}/reset-password- Overwrites employee access hashes during account lockouts.GET /api/users/export- Compiles a highly formatted, striped Excel list of total company staff profiles.
GET /api/loans- Extracts tenant-isolated, open financial loans.POST /api/loans/auto-issue- Evaluates customer emails, auto-creates profiles if unrecognized, and secures the active loan under one operational transaction.PUT /api/loans/{id}/default- Manually shifts overdue lending assets into a frozen default state for collections tracking.GET /api/loans/export- Streams a polished, board-ready financial report excel spreadsheet down to the local machine.POST /api/payments- Records customer repayments. Automatically moves the master loan state intoPaidif the ledger math clears the currentTotalAmountDue.
-
/hubs/notifications- Broadcasts generalized operational shifts to active staff nodes. -
/hubs/audit- Feeds a highly responsive security dashboard monitor with immediateActivityLogandUserLoginLogdata rows right after they commit to the core tables. AND MORE.PLEASE NOTE: if youre having issues with running the project unzip the LMS folder thats the back-up.