SmartLead AI is a full-stack lead scoring platform that combines website activity and offline interactions (calls, emails, meetings) to calculate conversion probability, provide explainability, and recommend next actions.
- Frontend: React + Tailwind + React Query
- Backend: FastAPI
- Database: MySQL
- Auth: JWT (Admin / Employee roles)
- ML: scikit-learn (RandomForest)
- Explainability: SHAP
src/: Frontend applicationbackend/app/: FastAPI API, auth, models, ML servicebackend/sample_data/: Training CSV for scoring modelbackend/schema.sql: MySQL schema reference
- Node.js 18+
- Python 3.11+
- MySQL 8+
Create database:
CREATE DATABASE smartlead;cd backend
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements.txt
copy .env.example .envUpdate .env with your MySQL connection string:
DATABASE_URL=mysql+pymysql://root:root@localhost:3306/smartlead
JWT_SECRET_KEY=change-this-in-production
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=1440Run backend:
uvicorn app.main:app --reload --port 8000The backend seeds a default admin user at startup:
- Email:
admin@smartlead.local - Password:
admin12345
In another terminal:
cd ..
npm install
npm run devApp URL: http://localhost:8080
- Open
/auth - Login with seeded admin credentials (or register a new user)
- JWT is stored in browser local storage and used for API requests
POST /api/auth/registerPOST /api/auth/loginGET /api/auth/mePOST /api/leadsGET /api/leadsGET /api/leads/{lead_id}POST /api/leads/{lead_id}/interactionsGET /api/leads/{lead_id}/interactionsPOST /api/leads/{lead_id}/scoreGET /api/leads/{lead_id}/recommendationGET /api/analytics/summary(admin only)
- Score > 80: Call immediately
- Score 50-80: Send follow-up email
- Score < 50: Nurture later
- SHAP explanations are included as top contributing factors per lead score.
- Score recalculation is triggered automatically when a new interaction is logged.