Skip to content

Latest commit

 

History

History
227 lines (172 loc) · 4.51 KB

File metadata and controls

227 lines (172 loc) · 4.51 KB

🎯 CREDIGIG - QUICK START GUIDE

⚡ Get Started in 3 Steps

Step 1: Start Backend Server

cd server
npm start

✅ Server running on http://localhost:3000

Step 2: Start ML Service

cd ml_service
python app.py

✅ ML Service running on http://localhost:5001

Step 3: Start Frontend

cd client
npm run dev

✅ Frontend running on http://localhost:5173


🔐 Login Credentials

Worker Account

  • Username: worker1
  • Password: w123

Admin Account

  • Username: banker1
  • Password: b123

Demo Account

  • Username: demo_worker
  • Password: demo123

📊 System Status

Component Status Port
Frontend (React) ✅ Running 5173
Backend (Express) ✅ Running 3000
ML Service (Flask) ✅ Running 5001
Database (PostgreSQL) ✅ Connected (Neon)
Authentication ✅ Enabled JWT

🚀 Key Features

For Workers

  • ✅ Register & Login securely
  • ✅ Submit risk assessment
  • ✅ Get instant credit score
  • ✅ Apply for loans
  • ✅ Track application status

For Admins

  • ✅ View all workers
  • ✅ Review assessments
  • ✅ Approve/reject loans
  • ✅ View analytics
  • ✅ Manage user roles

System

  • ✅ ML-powered risk scoring
  • ✅ Secure JWT authentication
  • ✅ Bcrypt password hashing
  • ✅ Role-based access control
  • ✅ Dark mode support
  • ✅ Mobile responsive

📚 Full Documentation


🧪 Test API Endpoints

Login

curl -X POST http://localhost:3000/api/login \
  -H "Content-Type: application/json" \
  -d '{"username":"worker1","password":"w123"}'

Get Profile

curl -X GET http://localhost:3000/api/user/profile \
  -H "Authorization: Bearer {YOUR_TOKEN}"

Submit Risk Assessment

curl -X POST http://localhost:3000/api/assess-risk \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer {YOUR_TOKEN}" \
  -d '{
    "worker_name":"John Doe",
    "upi_earnings":500,
    "delivery_frequency":20,
    "work_consistency":6,
    "existing_debt":0
  }'

🔧 Useful Commands

Database

# Check database contents
node server/check_db_data.js

# Update schema
node server/migrate_users_table.js

# Seed test users
node server/update_auth_users.js

Frontend

# Build for production
cd client && npm run build

# Run tests
npm run test

Backend

# Check health
curl http://localhost:3000/api/health

# Install dependencies
npm install

💾 Environment Variables

Create .env file in server directory:

DATABASE_URL=postgresql://user:password@host/database
JWT_SECRET=your-secret-key-here
NODE_ENV=development

🎓 Project Structure

Frontend: React 19 + Vite + Tailwind CSS
Backend: Express.js + PostgreSQL + JWT Auth
ML: Flask + scikit-learn Random Forest
Database: Neon PostgreSQL (Cloud)

✅ Everything Works!

The system is 100% complete and production-ready:

  • ✅ User authentication (register/login)
  • ✅ Password security (bcryptjs)
  • ✅ JWT tokens (7-day expiration)
  • ✅ Role-based access control
  • ✅ ML risk scoring
  • ✅ Database persistence
  • ✅ Professional UI
  • ✅ Error handling
  • ✅ Input validation
  • ✅ Documentation

📞 Troubleshooting

Backend won't start?

  • Check npm install is complete
  • Verify .env has DATABASE_URL
  • Check port 3000 is available

ML service error?

  • Ensure Python installed
  • Check pip install -r requirements.txt
  • Verify port 5001 is available

Frontend won't load?

  • Check backend is running
  • Clear browser cache
  • Ensure port 5173 is available

Login fails?

  • Verify credentials are correct
  • Check backend is running
  • Check database is connected

🎉 You're All Set!

Navigate to http://localhost:5173 and start using CrediGig!

Need help? Check the documentation files in the root directory.


CrediGig v1.0.0 - Production Ready 🚀