A compact, practical system that automatically classifies incoming emails and suggests short professional replies. Built for experimentation and lightweight deployment: FastAPI backend with an ML model, and a minimal React frontend with a polished dark UI.
- Fast hybrid classification (keyword heuristics + LinearSVC ML fallback)
- Three labels:
high_priority,normal,spam - Reply suggestion endpoint to generate one-sentence professional replies
- Minimal, responsive React UI with dark mode and smooth animations
- Docker + docker-compose for full-stack local deployment
- Nginx reverse proxy configuration for production-ready static serving and API proxying
┌──────────────────────┐
│ Browser UI │
│ (React, Axios) │
└──────────┬───────────┘
│
(requests to /predict, /suggest_reply)
│
┌─────────────▼─────────────┐
│ Nginx proxy │
│ (serves frontend build, │
│ proxies /api -> backend)│
└───────┬─────────┬─────────┘
│ │
(80/static) (8000/api)
│ │
┌────────────▼─┐ ┌───▼────────┐
│ Frontend │ │ Backend │
│ (Nginx serve │ │ (FastAPI) │
│ static build)│ │ endpoints │
└──────────────┘ └─────────────┘
│
▼
┌────────────────────┐
│ Model artifacts │
│ model.pkl, vectorizer.pkl │
└────────────────────┘
- Frontend: React (Hooks), Axios, plain CSS (dark theme)
- Backend: FastAPI, Uvicorn, Pydantic
- ML: scikit-learn (LinearSVC + TfidfVectorizer)
- Deployment: Docker, docker-compose, Nginx
Prerequisites:
- Node.js (v16+ / v18 recommended)
- Python 3.11+
- Docker & Docker Compose (optional for containerized run)
- Clone repository
git clone <your-repo-url> inbox-intelligence
cd "inbox-intelligence"- Backend (local dev)
cd backend
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
# source .venv/bin/activate
pip install -r requirements.txt
# Run development server
uvicorn app:app --reload --port 8000Open http://localhost:8000/docs to view the interactive API docs.
- Frontend (local dev)
cd ../frontend
npm install
npm startOpen http://localhost:3000 (development server).
- Full stack with Docker Compose
From repository root:
# Build and start everything
docker-compose up --build
# Open UI via the reverse proxy (Nginx):
# http://localhost (port 80)
# Stop
docker-compose downNotes:
- The frontend calls the backend at
http://localhost:8000in development. When served through Nginx, the proxy routes API calls to the backend service.
Request:
{
"text": "Your invoice #12345 is overdue. Please remit payment ASAP."
}Response:
{
"label": "high_priority",
"confidence": 1.0
}Request:
{
"label": "high_priority"
}Response:
{
"suggested_reply": "Thank you for bringing this to my attention. I will prioritize this and get back to you shortly."
}- Add probability calibration for meaningful confidence values
- Support email subject, sender parsing and richer metadata
- Add authentication and per-user settings
- Batch processing & saved histories
- Improve ML model (more data, transformer-based classifier)
- A/B testing and model versioning
- Light/dark theme toggle and keyboard shortcuts
Enjoy — open http://localhost:3000 and try pasting an email into the app.