A comprehensive peer-to-peer lending platform with advanced credit scoring and risk assessment built with Python Flask.
- User Authentication: Secure registration and login system with role-based access control
- Credit Assessment: Comprehensive credit application system with real-time scoring
- Risk-Based Lending: Dynamic loan limits and interest rates based on creditworthiness
- Loan Workflow: Complete application process from credit check to loan approval
- Payment Management: Advanced payment processing with detailed transaction history
- Borrower Management: Professional borrower dashboard with payment analytics
- Credit Scoring Algorithm: Proprietary scoring system based on:
- Annual income and employment status
- Debt-to-income ratio calculations
- Credit history and previous defaults
- Bank account balance and existing loans
- Dynamic Interest Rates: Credit score-based pricing (3.5% - 15% APR)
- Loan Limits: Tiered limits from $5,000 to $50,000 based on credit score
- Real-time Calculations: Live loan payment previews and amortization schedules
- Collateral Management: Required for loans over $10,000
- Professional UI: Modern sidebar navigation with responsive Bootstrap 5 design
- Admin Dashboard: Comprehensive system oversight and loan approval workflow
- Borrower Analytics: Detailed borrower profiles with payment statistics
- Financial Reports: System-wide lending and payment analytics
- User Management: Complete user administration with role management
- Backend: Python Flask with SQLAlchemy ORM
- Database: SQLite (production-ready for PostgreSQL/MySQL)
- Authentication: Flask-Login with secure session management
- Frontend: Bootstrap 5, HTML5, CSS3, JavaScript
- UI Components: Bootstrap Icons, responsive design patterns
- Data Processing: Decimal precision for financial calculations
- Form Validation: Client-side and server-side validation with error handling
- Clone the repository:
git clone https://github.com/regolet/LendingSystem.git
cd LendingSystem
- Create a virtual environment:
python -m venv venv
- Activate the virtual environment:
- Windows:
venv\Scripts\activate
- macOS/Linux:
source venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Initialize the database:
python -c "from app import app, db, User; app.app_context().push(); db.create_all(); admin = User(username='admin', email='admin@example.com', full_name='Administrator', is_admin=True); admin.set_password('admin123'); db.session.add(admin); db.session.commit(); print('Database initialized with admin user')"
- Run the application:
python app.py
The application will be available at http://localhost:5000
- Username:
admin
- Password:
admin123
- Email:
admin@example.com
Important: Change the default admin password after first login in a production environment.
- Register & Login: Create account and login to access the lending platform
- Credit Application: Complete comprehensive credit assessment including:
- Annual income and employment details
- Monthly housing and debt payments
- Bank account balance and existing loans
- Credit history information
- Credit Score: Receive instant credit score calculation (300-850 range)
- Loan Application: Apply for loans with credit-based limits:
- Excellent Credit (750+): Up to $50,000 at 3.5-5% APR
- Good Credit (700-749): Up to $25,000 at 5-7% APR
- Fair Credit (650-699): Up to $15,000 at 7-10% APR
- Poor Credit (<650): Up to $5,000 at 10-15% APR
- Collateral: Provide collateral details for loans over $10,000
- Real-time Calculations: View monthly payments, total interest, and repayment schedule
- Payment Management: Make payments and track detailed payment history
- Loan Review: Review submitted loan applications with credit scores and risk assessments
- Borrower Analytics: Access detailed borrower profiles with payment statistics
- Risk Management: Monitor loans with automated overdue tracking
- Financial Reports: Generate system-wide lending and payment reports
- User Management: Administer users and manage system roles
- Payment Oversight: Track all payments with advanced filtering and search
LendingSystem/
├── app.py # Main Flask application with models and routes
├── migrate_db.py # Database migration utility
├── requirements.txt # Python dependencies
├── README.md # Project documentation
├── templates/ # Jinja2 HTML templates
│ ├── base.html # Base template with sidebar navigation
│ ├── index.html # Landing page
│ ├── login.html # User authentication
│ ├── register.html # User registration
│ ├── dashboard.html # User dashboard with loan overview
│ ├── credit_application.html # Credit assessment form
│ ├── loan_application.html # Comprehensive loan application
│ ├── payments.html # Payment management interface
│ ├── borrowers.html # Borrower analytics dashboard
│ ├── view_loan.html # Individual loan details
│ ├── make_payment.html # Payment processing form
│ ├── users.html # User administration
│ └── reports.html # Financial reporting
├── static/ # Static web assets
│ ├── css/
│ │ └── style.css # Custom CSS styling
│ └── js/ # JavaScript files (if any)
└── instance/ # Instance-specific files
└── lending_new.db # SQLite database file
- Password Security: Secure password hashing with Werkzeug's scrypt algorithm
- Session Management: Flask-Login with secure session handling
- Input Validation: Comprehensive server-side and client-side form validation
- SQL Injection Protection: SQLAlchemy ORM with parameterized queries
- Financial Precision: Decimal arithmetic for accurate monetary calculations
- Role-Based Access Control: Admin and user roles with permission checks
- Error Handling: Graceful error handling with user-friendly messages
- User: Authentication, profile, and role management
- Loan: Enhanced loan records with credit scoring and risk assessment
- Payment: Detailed payment tracking with methods and notes
- CreditApplication: Comprehensive credit assessment data
- LoanDocument: Document management for loan applications
- AmortizationSchedule: Payment schedule calculations
- Credit Scoring Algorithm: Multi-factor credit assessment
- Risk Rating System: Automated risk categorization
- Debt-to-Income Calculations: Real-time financial ratio analysis
- Collateral Management: Asset tracking for secured loans
- Payment Reminders: Automated overdue notifications
- Document Upload: Secure file management for loan documentation
- Loan Amortization: Detailed payment schedule breakdowns
- Advanced Analytics: Enhanced reporting and data visualization
- API Development: RESTful APIs for mobile applications
- Multi-Currency: International currency support
- Email Integration: Automated status notifications
- Export Functionality: PDF and Excel report generation
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is open source and available under the MIT License.
For issues and questions, please create an issue in the GitHub repository.