ML-powered burnout risk assessment app. Tracks your work profile, daily check-ins, and habits to surface burnout risk early — before it becomes a crisis.
- Frontend: React 19 + TypeScript + Vite (port 5173)
- Backend: FastAPI + SQLAlchemy + SQLite (port 8000)
- ML: XGBoost + SHAP — burnout prediction with contributor explanations
- Auth: JWT (PyJWT + bcrypt), token stored in
localStorage
Recharge/
├── frontend/
│ ├── src/
│ │ ├── App.tsx # All UI: landing, dashboard, history, profile pages
│ │ ├── App.css # Styles
│ │ └── utils.ts # Risk color helpers
│ ├── .env.example
│ └── package.json
│
├── backend/
│ ├── app/
│ │ ├── main.py # FastAPI entry point, lifespan DB setup
│ │ ├── auth.py # JWT helpers, bcrypt
│ │ ├── auth_routes.py # POST /api/auth/register, /api/auth/login
│ │ ├── burnout.py # POST /api/burnout/predict
│ │ ├── wellness_routes.py # /api/wellness/* — hobbies, logs, burnout-preview
│ │ ├── profile_routes.py # GET/PUT /api/profile — stored work profile
│ │ ├── assessment_routes.py # GET /api/assessments/history
│ │ ├── student_routes.py # Student burnout assessment
│ │ ├── daily_nlp.py # Rule-based sentiment + hobby matching
│ │ ├── recommendations.py # Tip generation from risk band + contributors
│ │ ├── models.py # SQLAlchemy models
│ │ ├── database.py # Engine + session setup
│ │ └── config.py # Pydantic Settings (.env reader)
│ ├── ml/
│ │ ├── predictor.py # predict_with_shap()
│ │ ├── train.py # Training pipeline (synthetic or CSV)
│ │ ├── schema_cols.py # Feature column definitions
│ │ └── artifacts/
│ │ └── burnout_model.joblib
│ ├── tests/
│ ├── .env.example
│ └── requirements.txt
│
└── CLAUDE.md # Project context for Claude Code
Requires Python 3.11 or 3.12 (needed for XGBoost/numpy wheels).
cd backend
# Create and activate virtual environment
python3.12 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env and set JWT_SECRET to a long random stringRequired in backend/.env:
JWT_SECRET=your-long-random-secret-here
Optional overrides:
APP_ENV=development
FRONTEND_URL=http://localhost:5173
DATABASE_URL=sqlite:///./app.db
Train the ML model (required before running predictions):
python -m ml.train --syntheticStart the API:
uvicorn app.main:app --reload --port 8000Tables are created automatically on first start. The SQLite database appears at backend/app.db.
Requires Node.js 18+.
cd frontend
npm install
cp .env.example .envOptional in frontend/.env:
VITE_API_BASE_URL=http://localhost:8000
Start the dev server:
npm run devOpen http://localhost:5173.
| Method | Path | Auth | Description |
|---|---|---|---|
| GET | /api/health |
No | Health check |
| POST | /api/auth/register |
No | Create account, returns JWT |
| POST | /api/auth/login |
No | Login, returns JWT |
| GET | /api/me |
Yes | Current user info |
| GET | /api/burnout/status |
No | Model loaded check |
| POST | /api/burnout/predict |
Yes | Burnout risk from work profile |
| GET/PUT | /api/profile |
Yes | Stored work profile (set once, update anytime) |
| POST | /api/wellness/hobbies |
Yes | Add hobby to protect |
| GET | /api/wellness/hobbies |
Yes | List hobbies |
| DELETE | /api/wellness/hobbies/:id |
Yes | Remove hobby |
| POST | /api/wellness/logs |
Yes | Save daily check-in |
| GET | /api/wellness/logs |
Yes | List recent check-ins |
| POST | /api/wellness/burnout-preview |
Yes | Burnout prediction with daily signals + habit context |
| GET | /api/assessments/history |
Yes | Past assessment results |
-
Set up your profile — answer questions about your role, company, work hours, and recovery habits once. Stored in the database, editable any time.
-
Daily check-in — each day, answer 4 quick questions (energy, sleep, stress, breaks) and optionally add a free-text note. These are saved as daily logs.
-
Analyze — click Analyze to run the burnout prediction. The model takes your work profile as the base, then applies:
- Direct adjustments from today's check-in questions (energy/sleep/stress raise or lower
mental_fatigue_score; breaks adjustresource_allocation) - A 14-day NLP sentiment signal from your log notes
- XGBoost outputs a risk score (0–1) with SHAP contributor explanations
- Direct adjustments from today's check-in questions (energy/sleep/stress raise or lower
-
History — view your risk trend as a line chart over time, plus all past daily logs.
The backend and frontend are deployed as two separate Vercel projects.
SQLite doesn't work on Vercel's serverless runtime. You need a hosted PostgreSQL database.
- Create a free account at neon.tech
- Create a new project and copy the connection string — it looks like:
postgresql://user:password@ep-xxx.us-east-1.aws.neon.tech/neondb?sslmode=require - You'll paste this as
DATABASE_URLwhen setting up the backend below.
-
Go to vercel.com → Add New Project → import your repo
-
Set Root Directory to
backend -
Vercel will auto-detect Python. No build command needed.
-
Add these Environment Variables in the Vercel project settings:
Variable Value JWT_SECRETA long random string (e.g. output of openssl rand -hex 32)DATABASE_URLYour Neon PostgreSQL connection string FRONTEND_URLYour frontend Vercel URL (set after deploying frontend, or update later) APP_ENVproduction -
Click Deploy. Note the backend URL (e.g.
https://recharge-api.vercel.app).
-
Add New Project → same repo
-
Set Root Directory to
frontend -
Add this Environment Variable:
Variable Value VITE_API_BASE_URLYour backend Vercel URL from the step above -
Click Deploy.
After both are deployed:
- Copy the frontend URL (e.g.
https://recharge.vercel.app) - Go to the backend Vercel project → Settings → Environment Variables
- Update
FRONTEND_URLto the frontend URL - Redeploy the backend so the CORS setting takes effect
Push to main — Vercel auto-deploys both projects via the Git integration.
To deploy manually:
npm install -g vercel
# Deploy backend
cd backend && vercel --prod
# Deploy frontend
cd frontend && vercel --prod# Backend
cd backend
source .venv/bin/activate
pytest
# Frontend
cd frontend
npm test