Sortify AI is a next-generation, open-source email command center that automates email sorting, drafts replies, security audits, and newsletter cleanup. Using the Google Gemini API and advanced background pipeline logic, it turns a cluttered inbox into an organized dashboard.
🌐 Try the Live App on Railway: https://sortify-production-1ef5.up.railway.app/ 🎥 Watch the Video Presentation: Google Drive Demo Video
The landing page features custom cinematic lighting, floating interactive particles, and a glowing, animated AI sorting core visualizer.

The main dashboard includes real-time email ingestion metrics, top-sender intelligence widgets, and email priority categorization feeds.

A background analyzer tracks labels and manual email organizational actions to suggest automations that write directly back to Gmail.

Automatically runs deep security checks on incoming messages, quarantines threats, and warns users of spoofing behaviors.

If you are hosting this project, copy-paste these details to your GitHub project page:
- Description:
✉️ AI-powered Gmail inbox command center that auto-triages, categorizes, drafts smart replies, and unsubscribes newsletters using Gemini AI. Built with Flask, SQLite, and Vanilla HTML/CSS/JS + GSAP. - Website:
https://sortify-production-1ef5.up.railway.app/ - Topics/Tags:
gmail-api,gemini-api,flask-app,email-triage,pwa,gsap-animation,dark-mode,sqlite,developer-tools,ai-agents
Sortify AI was born out of a simple problem: inbox overload. Standard email clients group messages chronologically, forcing developers and professionals to spend hours manually reading, classifying, and drafting replies.
Sortify AI reimagines the inbox as a Command Center. By securely integrating with the Gmail API, it runs a background pipeline that:
- Analyzes Intent: Gemini Flash reads incoming messages to detect their semantic category, urgency, and core highlights.
- Auto-Categorizes: Moves emails into structured labels (Important, Clients, Promotions, Updates, Spam) automatically.
- Drafts Smart Responses: Gemini pre-drafts replies matching your personal template preferences, inserting them directly into your Gmail drafts folder.
- Detects Security Risks: Flags phishing attempts, domain anomalies, and spoofing signatures before they reach you.
- Manages Subscriptions: Aggregates newsletters and promotions, allowing you to unsubscribe with a single click.
It includes a fully functional Sandbox/Demo Mode with mock data and active simulators, letting anyone experience the platform instantly without connecting their Google credentials.
- ✨ Zero-Auth Sandbox Mode: Explore the full capability of Sortify AI (metrics dashboard, smart rules, templates, sandbox controls, and mock data) immediately without configuring or sharing any real Gmail credentials.
- 🕰️ Smart Snooze: Snooze emails out of sight. Powered by Gemini, the system inspects the email body to suggest optimal snooze times (e.g. matching an event date or deadline) and auto-unsnoozes them in the background.
- 📑 Conversational Thread Summarizer: Condense long email threads into clean, actionable bullet points, with summaries cached locally for high performance.
- 📈 Inbox Intelligence Center:
- Weekly Volume Chart: Interactive multi-series bar chart tracking email ingestion.
- Top Senders Widget: Pinpoints high-frequency senders and allows one-click rule creation.
- Peak Heatmap Grid: A 7×24 grid visualizing hourly and daily email density patterns.
- 🧠 Rule Learning Engine: A background analyzer that detects manual movement patterns (e.g., sorting multiple emails from a sender into a custom label) and automatically prompts active rules.
- 🔒 Security Center & Phishing Shield: Automatically runs security analyses on incoming mail, quarantines threats, and highlights warning indicators.
- 📱 Progressive Web App (PWA): Full support with standalone windows, customized launch branding, and service-worker caching for high-speed offline capabilities.
- 🤖 Auto-Pilot Service: Background worker thread dynamically checks new messages, applies active rules, updates snoozes, and drafts Gemini replies.
┌─────────────────────────────────────┐
│ Sortify AI Web UI │
│ (HTML/CSS/JS + GSAP Animations) │
│ (PWA Offline Mode / sw.js) │
└──────────┬───────────────┬──────────┘
│ │
Real API │ │ Sandbox Mode
Calls ▼ ▼ (Zero Auth)
┌──────────┴───────────────┴──────────┐
│ Flask Backend │
│ (app.py) │
└──────────┬───────────────┬──────────┘
│ │
▼ ▼
┌────────────────────┐ ┌──────────────────────┐
│ Service Layers & │ │ In-Memory Mock Data │
│ Gemini Client │ │ (demo_data.py) │
└────────┬───────────┘ └──────────────────────┘
│
┌────────────────┼────────────────┐
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Gmail API │ │ Gemini API │ │ SQLite DB │
│ (Auto Sync) │ │ (LLM Core) │ │ (february) │
└─────────────┘ └─────────────┘ └─────────────┘
Sortify/
├── app.py # Core Flask Application & API Endpoints
├── demo_data.py # Sandbox Mode mock data & email simulator
├── models.py # Database schemas (Snooze, ActionLogs, Rules)
├── scanner.py # Background mail sync & automation engine
├── services/
│ └── snooze_service.py # AI Smart Snooze calculations & expiries
├── static/
│ ├── css/
│ │ ├── design-system.css # Global style tokens (colors, variables)
│ │ ├── styles.css # Main Command Center UI styles
│ │ └── walkthrough.css # Onboarding tour stylesheet
│ ├── js/
│ │ └── animations.js # GSAP page transitions and particle effects
│ ├── images/
│ │ └── favicon.svg # Brand favicon
│ └── manifest.json # PWA Manifest settings
├── templates/
│ ├── base.html # Base layout template
│ ├── landing.html # Premium responsive landing page
│ ├── index.html # Modular Command Center Dashboard
│ └── walkthrough.html # Guided tour layout
├── tests/ # Pytest backend test suite
├── docs/ # Developer guides & contributing documentation
├── screenshots/ # Repository image assets for README presentation
└── Dockerfile # Standard Docker deployment configuration
- Python:
3.10or3.11(highly recommended) - Google Cloud Console Project: Gmail API enabled with OAuth Web App client credentials (for Real Mode connection)
- Gemini API Key: From Google AI Studio (for AI triage, summarization, and drafts)
-
Clone the Repository
git clone https://github.com/Piyusha942007/Sortify.git cd Sortify -
Set up Virtual Environment
python -m venv venv # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate
-
Install Dependencies
pip install --upgrade pip pip install -r requirements.txt
-
Setup Environment Configuration Copy the template environment file:
cp .env.example .env
Open the
.envfile and insert your API keys:# Flask Config FLASK_SECRET_KEY=secure-random-key OAUTHLIB_INSECURE_TRANSPORT=1 # Set to 0 in HTTPS production # Gemini API Key GEMINI_API_KEY=your-gemini-key # Google Client Credentials GOOGLE_CLIENT_ID=your-google-client-id GOOGLE_CLIENT_SECRET=your-google-client-secret GOOGLE_PROJECT_ID=your-project-id GOOGLE_REDIRECT_URI=http://127.0.0.1:5000/oauth2callback
-
Start the Platform
python app.py
- Open
http://127.0.0.1:5000to access the Landing Page. - Click Launch Demo Sandbox to explore immediately without credentials!
- Open
The application is fully containerized. To spin up using Docker Compose:
- Configure your
.envvariables as outlined above. - Build and run:
docker-compose up --build -d
- Visit
http://localhost:5000on your host. The database is persistent and binds tofebruary.dbin your local directory.
The codebase includes a comprehensive backend validation suite. Run all tests locally:
python -m pytest tests/ -vContributions make the open-source community an amazing place to learn, inspire, and create. Please read our Contributor Guide to get started on pull requests, database schema changes, and plugin additions.
Distributed under the MIT License. See LICENSE for details.