A backend-driven loan processing system built with Python (FastAPI) and PostgreSQL.
This project demonstrates real API design, business logic, data validation, and stateful workflows.
A machine learning model provides optional risk scoring, but the core system focuses on consistency and correctness.
A full-stack application for bank loan applications, risk prediction using ML, and admin management.
- User registration/login with JWT auth and roles (user/admin).
- Loan application form with real-time installment/interest calculation.
- Admin dashboard for approving/rejecting loans, viewing stats and risk predictions.
- ML-based default risk prediction using Logistic Regression on the BankLoanSafety dataset.
- Basic loan monitoring in user dashboard.
- Visualizations in admin (e.g., loan status pie chart).
- Dockerized for easy deployment.
- Backend: FastAPI, SQLAlchemy, PostgreSQL, Alembic, scikit-learn.
- Frontend: React (Vite), Axios, Formik+Yup, Recharts, Material-UI.
- ML: Trained on https://huggingface.co/datasets/VerisimilitudeX/BankLoanSafety (target: binary from loan_status).
- Clone repo and create directories as per structure.
- Backend:
cd backend && pip install -r requirements.txt. - Train ML model:
python app/ml/train_model.py(generates model.pkl). - Setup DB: Update .env with DATABASE_URL. Run
alembic init app/db/migrations, then in alembic/env.py addfrom app.db.base import Base; target_metadata = Base.metadataandfrom app.db.models import *. Thenalembic revision --autogenerate -m "initial"andalembic upgrade head. - Run backend:
uvicorn app.main:app --reload. - Frontend:
cd frontend && npm install && npm run dev. - Docker:
docker-compose up --build. - Access: Frontend at http://localhost:3000, Backend API at http://localhost:8000/docs.
The dataset is loaded from Hugging Face. Customize features in train_model.py if needed.
MIT