Skillz619/Mailflow-AI

β˜… 0Forks 1JavaScriptGitHub β†—Compare

README

Mailflow AI - AI-Powered Email Management

A modern, intelligent email management application built with React.js that integrates with Gmail API, featuring AI-powered categorization, priority classification, smart search, and email summarization.

πŸš€ Quick Start

New to the project? Start here:

  1. QUICK_START.md - 5-minute quick setup guide
  2. SETUP_GUIDE.md - Complete detailed setup instructions

πŸ“‹ Prerequisites

⚑ Quick Setup (5 minutes)

1. Install Frontend Dependencies

npm install

2. Create Environment File

Create .env.local in the root directory:

VITE_GEMINI_API_KEY=your_gemini_api_key_here
VITE_EMAIL_INTELLIGENCE_API_BASE=http://localhost:8000

# Optional: Gmail Proxy Service (Redis cache for faster performance)
# Set to http://localhost:3001 to enable, or leave empty to disable
# Requires Redis and Proxy Service to be running (see SETUP_GUIDE.md)
VITE_GMAIL_PROXY_URL=http://localhost:3001

3. Setup AI Service

cd email-intel-service
python3 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt
python train_priority_model.py  # First time only

4. Run Services

Terminal 1 (AI Service):

cd email-intel-service
source venv/bin/activate
python -m uvicorn main:app --reload --host 0.0.0.0 --port 8000

Terminal 2 (Redis - Optional but Recommended):

# macOS: brew services start redis
# Linux: sudo systemctl start redis
# Or Docker: docker run -d -p 6379:6379 redis:7-alpine

Terminal 3 (Proxy Service - Optional, requires Redis):

cd gmail-proxy-service
npm install  # First time only
npm start

Terminal 4 (Frontend):

npm run dev

Note: Redis and Proxy Service are optional. The app works with just AI Service and Frontend, but Redis cache provides 10-50x faster performance. See REDIS_CACHE_SETUP.md for details.

5. Open Browser

Navigate to: http://localhost:5173


🐳 Docker Setup (Alternative)

# Create .env file with VITE_GEMINI_API_KEY
docker-compose up --build

This will start all services:

  • Frontend (port 5173)
  • AI Service (port 8000)
  • Proxy Service (port 3001) - Redis cache
  • Redis (port 6379) - Cache storage

Access at: http://localhost:5173


πŸ“š Documentation


✨ Features

  • πŸ€– AI-Powered Classification: Automatic priority (High/Medium/Low) and category labeling
  • πŸ“§ Gmail Integration: Full OAuth 2.0 integration with Gmail API
  • πŸ” AI Search: Natural language search queries
  • πŸ“ Email Summarization: One-line AI summaries for each email
  • ⚑ Performance: IndexedDB caching, incremental sync (90%+ API reduction)
  • πŸš€ Redis Cache: Server-side caching for 10-50x faster responses (optional)
  • 🎨 Modern UI: Gmail-like interface with dark/light themes
  • πŸ“± Responsive: Works on desktop and mobile
  • πŸ”„ Background Sync: Automatic 30-second sync
  • πŸ’Ύ Offline Support: Works with cached data

πŸ—οΈ Architecture

  • Frontend: React 19 + Vite (Port 5173)
  • AI Service: Python FastAPI microservice (Port 8000)
  • Proxy Service: Node.js Express with Redis caching (Port 3001, optional)
  • Cache: Redis (Port 6379, optional) + IndexedDB (browser)
  • AI: DistilBERT model + Google Gemini API
  • Storage: IndexedDB (browser) + localStorage
  • APIs: Gmail API, Gemini API

Service Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Frontend │─────▢│ Proxy Service│─────▢│Redis β”‚      β”‚Gmail API β”‚
β”‚  (5173)  β”‚      β”‚   (3001)     β”‚      β”‚(6379)β”‚      β”‚          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚                     β”‚                                β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                    (fallback to direct Gmail API)

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚AI Serviceβ”‚
β”‚  (8000)  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Note: Proxy Service and Redis are optional. The app works without them but with better performance when enabled.


πŸ› οΈ Development

# Frontend development
npm run dev

# Build for production
npm run build

# Preview production build
npm run preview

πŸ“¦ Project Structure

Mailflow-AI/
β”œβ”€β”€ src/                    # React frontend
β”œβ”€β”€ email-intel-service/    # Python AI microservice
β”œβ”€β”€ gmail-proxy-service/    # Node.js Redis proxy service (optional)
β”œβ”€β”€ .env.local             # Environment variables (create this)
β”œβ”€β”€ package.json           # Node.js dependencies
β”œβ”€β”€ docker-compose.yml     # Docker configuration (includes Redis + Proxy)
└── README.md             # This file

πŸ†˜ Troubleshooting

See SETUP_GUIDE.md for detailed troubleshooting guide.

Common issues:

  • Port conflicts: Change ports in commands or .env files
  • API errors: Check your Gemini API key
  • Connection errors: Ensure services are running
  • Redis/Proxy issues: See REDIS_CACHE_SETUP.md for troubleshooting

πŸ“„ License

This project is for educational/demonstration purposes.


πŸ™ Acknowledgments

  • Google Gmail API
  • Google Gemini API
  • Hugging Face Transformers
  • React Community

For detailed setup instructions, see SETUP_GUIDE.md

Contributors

Skillz619chaitanyanaidug23

Issues