SmartLoanSystem is a robust, distributed backend architecture designed to handle loan applications through automated workflows and decoupled business rules. This project demonstrates advanced software engineering patterns, including Event-Driven Architecture (EDA), Workflow Orchestration, and the Decision Model and Notation (DMN) standard.
The system is built on SOLID principles to ensure maintainability and extensibility:
-
Event-Driven Communication: Services communicate asynchronously using MassTransit and RabbitMQ, ensuring high availability and loose coupling.
-
Workflow Orchestration: Loan processing is managed by Elsa Workflows 3.0, allowing for long-running processes and complex state management.
-
Externalized Rules (DMN): Loan approval logic is decoupled from the application code using a DMN engine. This allows business analysts to modify rules (e.g., salary thresholds) without redeploying services.
-
Idempotency & Performance: Implements Redis caching to detect and prevent duplicate loan requests, ensuring system reliability.
-
Framework: .NET 10.0 (C#)
-
Orchestration: Elsa Workflows 3.5
-
Messaging: MassTransit with RabbitMQ
-
Business Rules: DMN (Decision Model and Notation)
-
Database: SQL Server (Entity Framework Core)
-
Caching: Redis (StackExchange.Redis)
-
Containerization: Docker Compose
-
Loan.API: The gateway for submitting loan requests via REST endpoints.
-
Loan.Processor: A worker service that consumes messages, executes the
LoanApprovalWorkflow, and evaluates DMN rules. -
Loan.Contracts: Shared library containing records and message schemas to ensure type safety across services.
The system currently uses a DMN table to evaluate loan eligibility based on the applicant's salary:
-
Input:
Salary -
Rule: If
Salary > 1000, the loan is marked asApproved. -
Rule: If
Salary <= 1000, the loan is marked asRejected.
-
Docker Desktop
-
.NET 10 SDK
- Clone the repository:
git clone https://github.com/absamrah/SmartLoanSystem.git- Configure Environment: Create a
.envfile in the root directory (refer to.env.example):
SQL_PASSWORD=YourStrongPassword!
RABBIT_USER=guest
RABBIT_PASS=guest
- Run Infrastructure: Use Docker Compose to spin up SQL Server, RabbitMQ, and Redis:
docker-compose up -d- Run the Services: Start both the API and the Processor via your IDE or CLI.