Finverse is a full-stack Django REST application that simulates a simplified banking platform.
It allows customers to create and apply for loans, view amortization schedules, and lets admins approve or reject applications.
The system automatically tracks monthly payments and applies late-payment fees using a scheduled cron job.
- Customers can register and log in securely (Django REST Framework).
- Admin users can review and approve pending loan requests.
- Customers create loan requests with amount and term in years.
- The system computes the amortization schedule automatically using the standard loan formula.
- Admins can approve, reject, or monitor customer loans.
- Each approved loan generates monthly payment records.
- Payments include principal, interest, and total amount.
- Payment status transitions between pending → overdue → paid.
- A monthly cron job (Django management command) runs on the 10th day of each month:
- Marks unpaid payments as overdue.
- Applies configurable late fees using the
BankSettingsmodel.
- Global configuration stored in a single
BankSettingsrecord:annual_interest_ratelate_fee_rategrace_period_days
- Fully editable from Django Admin — no code changes required.
- Customers can download their yearly amortization schedule as a styled sheet file.
| Component | Technology |
|---|---|
| Backend | Django 5.x, Django REST Framework |
| Database | PostgreSQL (or SQLite for local dev) |
| Auth | DRF JWT / Session Authentication |
| Task Scheduler | Django Management Command + Cron |
All endpoints require a JWT Bearer Token in the Authorization header, except for the Auth and Stripe Webhook endpoints.
🔐 AuthApp
- Method:
POST - Endpoint:
/api/auth/login - Description: Authenticates a user and returns a JWT in an HTTP-only cookie.
- Request Body:
{ "username": "userName", "password": "password123" } - Response (
200 OK):{ "access": "token", "refresh": "token", }
- Method:
POST - Endpoint:
/api/auth/register - Description: Registers a new user.
- Request Body:
{ "first_name": "Ahmed", "last_name" : "Hassan", "email" : "ahmed@finverse.com", "userName": "ahmed", "password": "1234" } - Response (
201 CREATED):{ "message": "User registered successfully!", }
🏠 Customer API
- Method:
POST - Endpoint:
/api/loans/customer/create-loan/ - Description: Customer creates a loan draft before applying.
- Request Body:
{ "amount" : 100000, "term_years" : 5 } - Response (
201 CREATED):{ "id": 3, "amount": "100000.00", "term_years": 5 }
- Method:
PATCH - Endpoint:
/api/loans/customer/apply/<loan_id>/ - Description: Customer submits the draft loan for approval.
- Response (
200 OK):{ "id": 3 }
- Method:
GET - Endpoint:
/api/loans/customer/list-loans/ - Description: Retrieve all loans for the logged-in customer.
- Response (
200 OK):[ { "id": 1, "amount": "100000.00", "term_years": 5, "status": "approved", "total_paid": "15000.00" }, { "id": 2, "amount": "50000.00", "term_years": 3, "status": "pending" } ]
- Method:
PATCH - Endpoint:
/api/loans/customer/payments/<payment_id>/ - Description: Mark a monthly payment as paid.
- Response (
200 OK):{ "id": 2, "month_index": 2, "due_date": "2025-10-01", "status": "paid", "total_payment": "1980.12" }
- Method:
GET - Endpoint:
/api/loans/customer/yearly-schedule/export/<loan_id>/ - Description: Download the yearly amortization schedule as a .csv file.
- Response (
200 OK): Triggers a styled sheet file download (e.g., loan_1_yearly_schedule.csv).
📂 Admin Api
- Method:
POST - Endpoint:
/api/loans/admin/list-pending/ - Description: Admin retrieves all pending loan requests.
- Response:
[ { "id": 1, "created_by": "customer1", "amount": "100000.00", "term_years": 5, "status": "pending" } ]
- Method:
PATCH - Endpoint:
/api/loans/admin/approve/<loan_id>/ - Description: Admin approves a pending loan and send an email to customer to inform him.
- Response:
{ "message": "Loan approved successfully.", "status": "approved" }
- Method:
PATCH - Endpoint:
/api/loans/admin/reject/<loan_id>/ - Description: Admin reject a pending loan .
- Request Body:
{ "admin_note" : "low scrore", } - Response:
{ "message": "Loan rejected successfully.", "status": "rejected" }
This project implements a fixed-rate loan amortization system, similar to real banking systems.
It calculates:
- Fixed monthly payment
- Monthly principal vs interest breakdown
- Remaining balance each month
- Accurate due dates based on approval date
The monthly payment for a fixed-rate amortized loan is calculated using the standard formula:
Where:
- (P) = Loan principal
- (r) = Monthly interest rate (= \frac{\text{Annual Rate}}{12 \times 100})
- (n) = Total payments (= \text{Years} \times 12)
- (M) = Monthly payment
If interest rate is 0%:
Decimal precision is used to ensure banking-level accuracy.
Each month:
On the final month, the balance is forced to reach 0.00 to avoid rounding drift.
- First payment = 1st of next month
- If loan approved in last 10 days of month → first payment shifts to following month
- Due date every month after that
This simulates real bank grace periods.
| Parameter | Value |
|---|---|
| Loan Amount | $100,000 |
| Term | 20 Years |
| Rate | 7.00% |
| Total Payments | 240 months |
| Monthly Rate | 0.583% |
| Output | Value |
|---|---|
| Monthly Payment | $775.30 |
| Total Paid | $186,071.74 |
| Total Interest | $86,071.74 |
| Function | Purpose |
|---|---|
calc_monthly_payment() |
Computes monthly payment using PMT formula |
generate_amortization_schedule() |
Generates full payment schedule |
first_of_next_month() |
Gets first due date |
add_months() |
Adds month increments safely |
The application uses PostgreSQL with the following main entities:
- Users: Stores customer and admin accounts, authentication details, and profile information.
- Loans: Represents loan applications submitted by customers, including loan amount, term, interest rate, status, and approval information.
- LoanPaymentSchedule: Stores the generated amortization schedule for each approved loan, including monthly payment breakdown (principal, interest, remaining balance, and due dates).
- BankSettings: Stores configurable bank-wide settings such as default interest rate, payment grace period, and other financial rules.
- asgiref==3.10.0
- Django==5.2.7
- djangorestframework==3.16.1
- djangorestframework_simplejwt==5.5.1
- et_xmlfile==2.0.0
- openpyxl==3.1.5
- psycopg2-binary==2.9.11
- PyJWT==2.10.1
- python-dotenv==1.2.1
- sqlparse==0.5.3
- tzdata==2025.2
This project includes a fully Dockerized setup with PostgreSQL and Django pre-configured. It includes an automation script to handle building, migrations, and initial setup.
- Docker and Docker Compose installed on your machine.
We have provided a startup.sh script that automatically:
- Creates a
.envfile (if missing). - Builds and starts the containers.
- Runs database migrations.
- Creates a default Superuser.
- Collects static files.
Run the following command in your terminal:
# Make the script executable (first time only)
chmod +x startup.sh
# Run the project
./startup.shOnce the script finishes, the server will be live at:
- API Root: http://localhost:8000/
- Admin Panel: http://localhost:8000/admin/
Default Admin Credentials:
- Username:
admin - Password:
admin123(You can change these in your.envfile later)
To stop the containers and remove the networks (your database data will be preserved in the Docker volume):
docker compose downIf you need to wipe the database and start fresh (e.g., if you messed up migrations):
# Stop containers and delete the database volume
docker compose down -v
# Restart fresh
./startup.sh- Integrate real payment gateway (Stripe / PayPal / Fawry / Paymob)
- Allow customers to make monthly loan payments online
- Track real payment history vs amortization schedule
- Auto-update loan status (Active → Finished when loan fully paid)
- Machine learning model to evaluate customer credibility
- Predict default risk based on behavior & financial history
- Detect suspicious loan applications & identity fraud patterns
- AI recommendation engine for loan approval
- Suggest approval or rejection based on:
- Previous payment history
- Income vs loan ratio
- Customer credit score and behavior patterns
- Visual analytics for admins:
- Loan approval rate
- Total disbursed loans
- Revenue & interest earned
- Default / late payment statistics
- Two-factor authentication (2FA)
- Audit logging and reporting
- Data encryption at rest & in transit
- Compliance with banking & privacy standards
- Develop companion mobile app (React Native / Flutter)
- Push notifications for payment reminders & approval status
- Support multiple banks/branches using same system
- Custom loan products & rules per bank
- Credit score simulation
- Loan refinancing options
- Support for multiple loan types (car, mortgage, personal, business)
I would like to acknowledge and thank the following:
- Django & Django REST Framework community for their excellent documentation and tools.
- OpenPyXL contributors for enabling Excel reporting and chart generation.
- SimpleJWT library maintainers for secure token-based authentication support.
- Financial & amortization formula resources that inspired the loan calculation logic.
