Skip to content

Latest commit

 

History

History
279 lines (220 loc) · 7.87 KB

File metadata and controls

279 lines (220 loc) · 7.87 KB

🏦 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