CrediSys — Building an AI-Powered Loan Management System in Python
I recently completed and submitted CrediSys, an AI-powered, terminal-based Loan Management System, to the Hack The Limit hackathon on Devpost.
This project started with a simple idea:
What if I built a real software system instead of another small Python practice project?
That question eventually turned into CrediSys — a system designed around the workflow of a small lending business, from registering customers and issuing loans to tracking repayments, detecting overdue installments, and analyzing business performance.
🚀 What is CrediSys?
CrediSys is a Python-based Loan Management System that manages the complete loan lifecycle from a single terminal application.
The system includes:
- Customer management
- Loan plan management
- Loan creation and validation
- Reducing-balance EMI calculations
- Automatic repayment schedules
- Installment payment tracking
- Overdue detection
- Grace-period handling
- Loan status management
- Business analytics
- Monthly data snapshots
- AI-powered staff assistance through CrediAI
The goal wasn't to build a banking application with hundreds of features.
Instead, I wanted to build a focused system where the core workflow actually makes sense from beginning to end.
🧑💻 Customer Management
The first part of CrediSys is customer management.
Users can:
- Register customers
- Validate customer information
- View customer records
- Update customer information
- Prevent deletion of customers with unresolved loans
- Soft-delete eligible completed customers
The system is designed around the Pakistani context, including validation for Pakistani CNIC and phone-number formats.
One important design decision was using soft deletion for eligible customers instead of permanently removing their records.
This means historical information can remain available for analytics and record keeping.
💰 Loan Management
Once a customer exists, a loan can be created using predefined loan plans.
Each plan defines rules such as:
- Minimum loan amount
- Maximum loan amount
- Interest rate
- Loan duration
- Interest calculation method
- Grace period
When creating a loan, CrediSys validates the requested amount against the selected plan before continuing.
The system then calculates:
- Monthly EMI
- Total interest
- Total payable amount
- Number of installments
- Repayment schedule
📐 Reducing-Balance EMI Calculation
One of the most challenging parts of the project was implementing the reducing-balance EMI calculation correctly.
Instead of calculating interest on the original principal throughout the entire loan, the interest is calculated based on the remaining principal.
The standard EMI formula is:
EMI = P × r × (1 + r)^n / ((1 + r)^n − 1)
Where:
-
P= Principal amount -
r= Monthly interest rate -
n= Number of monthly installments
For an annual interest rate, the monthly rate is calculated as:
monthly_rate = annual_rate / 100 / 12
I didn't want the application to simply produce an EMI number.
The loan engine also generates a complete repayment schedule so that every installment contains information about its expected payment and status.
This was an important learning experience because I had to understand the mathematics behind the calculation instead of treating it as a black box.
📅 Repayment Schedules
After creating a loan, CrediSys generates a month-by-month repayment schedule.
Each installment contains information such as:
- Installment number
- Due date
- Amount
- Payment status
The schedule allows the application to track the loan throughout its lifecycle.
This became especially useful when implementing payment recording and overdue detection.
💳 Payment Management
CrediSys allows staff to record individual installment payments.
The system includes validation to prevent things such as:
- Invalid installment payments
- Duplicate payments
- Paying multiple installments when the workflow expects an individual installment
Payment history can also be viewed for individual loans.
This helped me understand that financial software isn't simply about storing numbers.
Every action needs rules.
⚠️ Overdue Detection & Grace Periods
Another interesting part of the project was implementing overdue detection.
An installment isn't immediately considered overdue after its due date.
CrediSys supports a configurable grace period.
The basic logic is:
Due Date
↓
Grace Period
↓
Still unpaid?
↓
Mark as overdue
This allows the system to distinguish between an installment that is simply past its due date and one that has actually exceeded the allowed grace period.
This was one of the areas where testing different dates and payment states became particularly important.
📊 Business Analytics
CrediSys also includes basic business analytics.
The system can track information such as:
- Customer statistics
- Loan statuses
- Total amount lent
- Total amount recovered
- Outstanding amounts
- Expected interest
I also implemented monthly snapshots so historical business data can be compared over time.
The idea is to eventually make this layer much more sophisticated, but for this version I focused on building a reliable foundation first.
🤖 CrediAI
One of the most exciting parts of the project is CrediAI.
CrediAI is an AI assistant integrated into CrediSys using Google's Gemini API.
It can help staff with tasks such as:
- Answering questions about the system
- Looking up relevant loan information
- Explaining business data in plain English
- Helping users navigate the application
- Generating useful staff-oriented responses and reports
However, there is an important architectural decision behind CrediAI.
AI does NOT control the financial logic.
Calculations such as:
- EMI
- Interest
- Payments
- Repayment schedules
- Overdue detection
- Loan rules
remain controlled by the application's Python logic.
The AI acts as an intelligence and assistance layer, rather than becoming the source of truth for financial calculations.
I wanted to keep that separation clear.
🏗️ How I Built It
I built CrediSys incrementally rather than trying to implement everything at once.
The development process roughly looked like this:
Customer Management
↓
Loan Plans
↓
Loan Engine
↓
EMI Calculation
↓
Repayment Schedules
↓
Payment Management
↓
Overdue Detection
↓
Analytics
↓
CrediAI
↓
Main Application Integration
This approach made it easier to test each part before connecting everything together.
It also helped me understand how individual modules should communicate with each other.
🗄️ Why JSON Instead of a Database?
The current version uses JSON files for persistent storage.
I know that a relational database would be more appropriate for a larger production system.
But I deliberately chose JSON for this version.
Why?
Because I wanted to understand file-based persistence and data management before introducing additional infrastructure.
For me, this project was also a learning project.
I didn't want to hide complexity behind tools that I didn't understand yet.
The next logical step would be migrating the system to something like SQLite or another relational database.
😵 Challenges I Faced
This project came with quite a few.
1. Financial calculations
Getting reducing-balance EMI calculations and repayment schedules right required understanding the actual mathematics behind them.
2. Payment states
A payment isn't just:
paid = True
There are different states and conditions that need to be handled correctly.
3. Overdue detection
The grace-period logic required careful date handling and testing.
4. Data integrity
Deleting customers, modifying loans, and recording payments can affect historical information.
I had to think about what should and shouldn't be allowed.
5. AI integration
Connecting an external AI model was relatively easy compared with figuring out how it should interact with the existing application without taking control of the core business logic.
6. Keeping the project manageable
There were always more features I could add.
At some point I had to stop thinking:
"What else can I add?"
and start thinking:
"What does the system actually need to work properly?"
That was probably one of the most important lessons from this project.
🧠 What I Learned
CrediSys taught me much more than just Python syntax.
I learned how important it is to divide a large problem into smaller modules with clear responsibilities.
I also learned about:
- Data validation
- File handling
- JSON persistence
- Date manipulation
- Financial calculations
- API integration
- Error handling
- Software architecture
- Testing real scenarios
- Debugging
- Git and GitHub
- Designing around business rules
But probably the biggest lesson was this:
Building software is mostly about solving problems and making decisions, not just writing code.
There were many times when the code technically worked but the design didn't make sense.
I had to repeatedly test, break things, rethink the approach, and improve it.
🏆 The Biggest Thing I'm Proud Of
I'm most proud that CrediSys became a complete working workflow instead of a collection of unrelated features.
A typical flow can look like:
Register Customer
↓
Create Loan
↓
Calculate EMI
↓
Generate Schedule
↓
Record Payments
↓
Detect Overdue Installments
↓
Update Loan Status
↓
Analyze Business Data
↓
Ask CrediAI for Assistance
Everything is connected.
That was the real goal of the project.
🔮 What's Next?
CrediSys is only the first version.
Some improvements I'd like to implement in the future include:
- Automated unit tests
- More comprehensive financial validation
- PDF loan statements
- Graphical user interface
- Role-based staff authentication
- Migration from JSON to a relational database
- More advanced analytics
- Better reporting
- Multi-turn conversational memory for CrediAI
I don't expect to implement all of these immediately.
The project is meant to evolve alongside my own learning.
🎥 Demo
I also created a short demo showing the main functionality of CrediSys.
Demo:
https://youtu.be/deCN5ALLtwk
🔗 Project Links
Devpost:
https://devpost.com/software/credisys-ai-powered-loan-management-system
GitHub:
https://github.com/bilal-dev-0x/CrediSys-Loan-Management-System
Final Thoughts
CrediSys started as an idea for a serious Python project and became my first hackathon submission.
It isn't a perfect production banking platform, and I don't claim that it is.
But that's not what I was trying to build.
I wanted to understand what it actually feels like to take a real-world problem, break it into smaller problems, turn those problems into software, debug the inevitable mess, and eventually ship something.
CrediSys is my first version of that journey.
And I'm looking forward to building the next one.
Top comments (0)