Skip to content

regolet/LendingSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LendingSystem

A comprehensive peer-to-peer lending platform with advanced credit scoring and risk assessment built with Python Flask.

Features

Core Functionality

  • 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

Advanced Features

  • 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

Administrative Tools

  • 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

Technologies Used

  • 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

Installation

  1. Clone the repository:
git clone https://github.com/regolet/LendingSystem.git
cd LendingSystem
  1. Create a virtual environment:
python -m venv venv
  1. Activate the virtual environment:
  • Windows:
venv\Scripts\activate
  • macOS/Linux:
source venv/bin/activate
  1. Install dependencies:
pip install -r requirements.txt
  1. 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')"
  1. Run the application:
python app.py

The application will be available at http://localhost:5000

Default Admin Account

  • Username: admin
  • Password: admin123
  • Email: admin@example.com

Important: Change the default admin password after first login in a production environment.

Usage

Credit Assessment & Loan Application Process

For Borrowers:

  1. Register & Login: Create account and login to access the lending platform
  2. 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
  3. Credit Score: Receive instant credit score calculation (300-850 range)
  4. 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
  5. Collateral: Provide collateral details for loans over $10,000
  6. Real-time Calculations: View monthly payments, total interest, and repayment schedule
  7. Payment Management: Make payments and track detailed payment history

For Lenders & Admins:

  1. Loan Review: Review submitted loan applications with credit scores and risk assessments
  2. Borrower Analytics: Access detailed borrower profiles with payment statistics
  3. Risk Management: Monitor loans with automated overdue tracking
  4. Financial Reports: Generate system-wide lending and payment reports
  5. User Management: Administer users and manage system roles
  6. Payment Oversight: Track all payments with advanced filtering and search

Project Structure

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

Security Features

  • 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

Database Models

Core Models

  • 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

Key Features

  • 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

Planned Enhancements

  • 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

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is open source and available under the MIT License.

Support

For issues and questions, please create an issue in the GitHub repository.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published