Skip to content

Gig workers like Swiggy and Zomato partners often lack access to formal loans due to no fixed salaries. This project uses ML to assess credit risk using alternative data such as daily earnings, delivery frequency, work consistency, and customer ratings to generate fair credit scores and enable inclusive lending.

Notifications You must be signed in to change notification settings

Disumakadiya/DU_Hacks

Repository files navigation

🏦 CrediGig - Credit Scoring Platform for Gig Workers

React Node.js Python scikit-learn PostgreSQL

Modern credit scoring system for gig economy workers with ML-powered risk assessment, loan management, and real-time performance tracking.


πŸš€ Quick Start

Prerequisites

  • Node.js >= 16.x
  • Python >= 3.8
  • npm >= 8.x
  • PostgreSQL (Neon Cloud)

Installation & Running

1️⃣ ML Service (Port 5001):

cd ml_service
pip install -r requirements.txt
python app.py

2️⃣ Backend Server (Port 5000):

cd server
npm install
npm start

3️⃣ Frontend Client (Port 5173):

cd client
npm install
npm run dev

🌐 Access the app: http://localhost:5173


🎨 Tech Stack

Layer Technology
Frontend React 19 + Vite + Tailwind CSS v4
Backend Node.js + Express 5
Database PostgreSQL (Neon Cloud)
ML Service Python + Flask + scikit-learn
Authentication JWT + bcrypt
Icons Lucide React

✨ Features

πŸ‘· Worker Portal

  • Dashboard - Real-time credit score, performance metrics, earnings summary
  • Credit Score - ML-powered credit scoring with detailed breakdown
  • Earnings Tracking - Log daily work hours, ratings, and income
  • Loan Eligibility - View max loan amount, interest rates, risk category
  • Loan Applications - Apply for loans from multiple banks
  • Profile Management - Update personal information

🏦 Banker/Admin Portal

  • Dashboard - Worker statistics, loan analytics, platform overview
  • Worker Management - Search workers, view profiles, credit scores
  • Loan Management - Review, approve/reject loan applications
  • Performance Metrics - Track worker performance across the platform

🎨 Design & UX

  • Sky Blue Theme - Modern gradient design with slate/sky color palette
  • Dark Mode - Full dark mode support with smooth transitions
  • Responsive - Mobile-first design, works on all screen sizes
  • Accessibility - WCAG AA compliant, keyboard navigation

πŸ“ Project Structure

DU_Hacks/
β”œβ”€β”€ πŸ“ client/                  # React Frontend (Vite)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ pages/              # Page components
β”‚   β”‚   β”‚   β”œβ”€β”€ LoginPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ RegisterPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ DashboardPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ EarningsPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ LoanEligibilityPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ LoanApplicationPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ProfilePage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminDashboardPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminWorkersPage.jsx
β”‚   β”‚   β”‚   └── AdminLoansPage.jsx
β”‚   β”‚   β”œβ”€β”€ components/         # Reusable UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ common/         # Button, Card, Input, Modal, etc.
β”‚   β”‚   β”‚   β”œβ”€β”€ worker/         # Worker-specific components
β”‚   β”‚   β”‚   └── admin/          # Admin-specific components
β”‚   β”‚   β”œβ”€β”€ context/            # React Context (Auth, Theme)
β”‚   β”‚   β”œβ”€β”€ hooks/              # Custom hooks
β”‚   β”‚   └── services/           # API service layer
β”‚   └── package.json
β”‚
β”œβ”€β”€ πŸ“ server/                  # Node.js Backend (Express)
β”‚   β”œβ”€β”€ index.js                # Main server entry
β”‚   β”œβ”€β”€ db.js                   # PostgreSQL connection
β”‚   β”œβ”€β”€ auth.js                 # Authentication logic
β”‚   β”œβ”€β”€ middleware.js           # Auth middleware
β”‚   β”œβ”€β”€ migrations/             # Database migrations
β”‚   └── package.json
β”‚
β”œβ”€β”€ πŸ“ ml_service/              # Python ML Service (Flask)
β”‚   β”œβ”€β”€ app.py                  # Flask API server
β”‚   β”œβ”€β”€ requirements.txt        # Python dependencies
β”‚   └── README.md
β”‚
└── README.md                   # This file

πŸ”Œ API Endpoints

Authentication

Method Endpoint Description
POST /api/auth/register User registration
POST /api/auth/login User login
GET /api/auth/me Get current user

Workers

Method Endpoint Description
GET /api/workers Get all workers
GET /api/workers/:id Get worker by ID
PUT /api/workers/:id Update worker
GET /api/workers/:id/credit-score Get credit score

Earnings

Method Endpoint Description
GET /api/earnings/:workerId Get earnings history
POST /api/earnings Add earnings record

Loans

Method Endpoint Description
GET /api/loans Get all loans
POST /api/loans Create loan application
PATCH /api/loans/:id/status Update loan status

ML Service

Method Endpoint Description
POST /predict Get ML credit score prediction
GET /health Health check

🧠 ML Credit Scoring Model

The credit scoring system uses a Gradient Boosting Classifier trained on:

Input Features

  • Monthly Income
  • Work Hours per Week
  • Platform Rating (1-5)
  • Completed Jobs Count
  • Account Age (months)
  • Debt-to-Income Ratio

Output

  • Credit Score (300-850)
  • Risk Category (Low/Medium/High)
  • Loan Eligibility (Max amount, Interest rate)

🎨 Color Palette

Light Mode

Element Color Hex
Background Slate 50 #f8fafc
Cards White #ffffff
Primary Sky 500 #0ea5e9
Text Slate 900 #0f172a

Dark Mode

Element Color Hex
Background Slate 950 #020617
Cards Slate 800 #1e293b
Primary Sky 500 #0ea5e9
Text Slate 100 #f1f5f9

πŸ§ͺ Testing

# Frontend tests
cd client
npm test

# Backend tests
cd server
npm test

πŸ› οΈ Environment Variables

Backend (server/.env)

DATABASE_URL=postgresql://username:password@host/database
JWT_SECRET=your_jwt_secret_key
ML_SERVICE_URL=http://localhost:5001
PORT=5000

Frontend (client/.env)

VITE_API_URL=http://localhost:5000

🚒 Deployment

Build for Production

# Frontend
cd client && npm run build
# Output: client/dist/

# Backend
cd server && npm start

# ML Service
cd ml_service && python app.py

πŸ“ License

MIT License - See LICENSE file for details.


πŸ™ Acknowledgments

  • Built for DU Hacks Hackathon 2026
  • Powered by Neon PostgreSQL
  • ML Model trained with scikit-learn

Built with ❀️ for the gig economy workers

Version Status Updated

About

Gig workers like Swiggy and Zomato partners often lack access to formal loans due to no fixed salaries. This project uses ML to assess credit risk using alternative data such as daily earnings, delivery frequency, work consistency, and customer ratings to generate fair credit scores and enable inclusive lending.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •