Skip to content

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MailPilot AI – AI-Powered Gmail Copilot

MailPilot AI is a full-stack Gmail automation dashboard that connects with a user's Gmail account, analyzes emails, generates smart replies, creates Gmail drafts, and stores AI analysis history using MongoDB.

It is designed as an AI-powered productivity tool for managing Gmail workflows through a clean dashboard, smart inbox, reply assistant, analysis history, and system health monitoring.


πŸš€ Project Overview

MailPilot AI helps users manage their Gmail inbox intelligently by combining Gmail API integration, AI-based email analysis, smart reply generation, and persistent history tracking.

The application allows users to:

  • Connect Gmail securely using Google OAuth
  • Fetch real Gmail emails
  • Analyze emails using an AI fallback engine
  • Classify emails by priority and category
  • Generate smart reply drafts
  • Create Gmail drafts directly from the dashboard
  • Save and view AI analysis history
  • Search, filter, and manage analyzed emails
  • Monitor backend, Gmail, AI mode, and MongoDB status

✨ Key Features

πŸ” Gmail OAuth Integration

Secure Gmail authentication using Google OAuth 2.0 with token persistence.

πŸ“© Smart Inbox

Fetches real Gmail emails and displays them in a searchable, filterable dashboard.

πŸ€– AI Email Analysis

Analyzes emails and generates:

  • Email summary
  • Priority level
  • Email category
  • Suggested response

✍️ AI Reply Draft Assistant

Generates editable reply drafts with tone control and allows users to create Gmail drafts directly.

πŸ—‚οΈ MongoDB Analysis History

Stores analyzed emails in MongoDB Atlas so users can revisit, search, filter, and delete past analysis records.

πŸ“Š Dashboard Analytics

Provides overview statistics such as loaded emails, analyzed emails, saved history, high-priority emails, and system status.

βš™οΈ System Health Page

Displays backend health, Gmail connection, AI mode, MongoDB history count, tech stack, and project module status.

🎨 Premium UI/UX

Includes a modern landing page, dark glass dashboard, animated visual elements, responsive layout, and clean product-style interface.


πŸ› οΈ Tech Stack

Frontend

  • React.js
  • Vite
  • CSS
  • Framer Motion
  • Lucide React
  • Axios

Backend

  • Node.js
  • Express.js
  • Gmail API
  • Google OAuth 2.0
  • MongoDB Atlas
  • Mongoose

AI Layer

  • Rule-based fallback AI engine
  • Email summarization
  • Priority detection
  • Reply generation

πŸ“ Project Structure

mailpilot-ai/
β”‚
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── db.js
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ User.js
β”‚   β”‚   └── AnalyzedEmail.js
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ authRoutes.js
β”‚   β”‚   β”œβ”€β”€ gmailRoutes.js
β”‚   β”‚   └── aiRoutes.js
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ googleAuthService.js
β”‚   β”‚   β”œβ”€β”€ gmailService.js
β”‚   β”‚   └── aiService.js
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   └── emailUtils.js
β”‚   β”œβ”€β”€ server.js
β”‚   β”œβ”€β”€ package.json
β”‚   └── .env.example
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   └── Sidebar.jsx
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ LandingPage.jsx
β”‚   β”‚   β”‚   └── Dashboard.jsx
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   └── api.js
β”‚   β”‚   β”œβ”€β”€ App.jsx
β”‚   β”‚   β”œβ”€β”€ App.css
β”‚   β”‚   └── main.jsx
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”‚
β”œβ”€β”€ .gitignore
└── README.md

βš™οΈ Environment Variables

Create a .env file inside the backend folder.

Use .env.example as reference:

PORT=5000
FRONTEND_URL=http://localhost:5173

GOOGLE_CLIENT_ID=your_google_client_id_here
GOOGLE_CLIENT_SECRET=your_google_client_secret_here
GOOGLE_REDIRECT_URI=http://localhost:5000/auth/google/callback

MONGO_URI=your_mongodb_atlas_connection_string_here

AI_MODE=fallback

Never upload your real .env file to GitHub.


▢️ How to Run Locally

1. Clone the repository

git clone https://github.com/javcod/mailpilot-ai.git
cd mailpilot-ai

2. Install backend dependencies

cd backend
npm install

3. Start backend server

npm run dev

Backend runs on:

http://localhost:5000

4. Install frontend dependencies

Open a new terminal:

cd frontend
npm install

5. Start frontend

npm run dev

Frontend runs on:

http://localhost:5173

πŸ”— Main API Endpoints

Health Check

GET /health

Gmail Auth Status

GET /auth/status

Fetch Gmail Emails

GET /api/gmail/emails

Analyze Emails

POST /api/ai/analyze-emails

Generate Reply

POST /api/ai/generate-reply

Create Gmail Draft

POST /api/gmail/create-draft

Get AI Analysis History

GET /api/ai/history

Delete History Item

DELETE /api/ai/history/:id

🧠 What I Learned

While building MailPilot AI, I worked on:

  • Google OAuth authentication
  • Gmail API integration
  • MongoDB Atlas connection and schema design
  • Full-stack API communication
  • AI-powered email workflow logic
  • Dashboard UI/UX design
  • Persistent user session handling
  • Secure environment variable management
  • Building a practical AI automation product

πŸ“Έ Screenshots

Add screenshots here after uploading images to the repository.

![Landing Page](./screenshots/landing-page.png)
![Dashboard](./screenshots/dashboard.png)
![Smart Inbox](./screenshots/smart-inbox.png)
![AI Analysis](./screenshots/ai-analysis.png)
![Reply Drafts](./screenshots/reply-drafts.png)
![System Health](./screenshots/settings.png)

🧩 Future Improvements

  • Add OpenAI or Gemini integration for advanced LLM-based responses
  • Add Gmail label automation
  • Add follow-up reminder system
  • Add n8n workflow integration
  • Add email sentiment detection
  • Add deployment on Render/Vercel
  • Add user-specific dashboard analytics
  • Add role-based authentication

πŸ“Œ Project Status

MailPilot AI is currently a working full-stack MVP with:

  • Gmail OAuth
  • Gmail API integration
  • MongoDB persistence
  • AI fallback analysis
  • Smart reply generation
  • Gmail draft creation
  • Dashboard analytics
  • History management
  • Premium UI/UX

πŸ‘¨β€πŸ’» Author

Prabhuji Mishra B.Tech CSE Student Focused on AI Agents, Automation Workflows, and Full-Stack AI Projects

GitHub: javcod


⭐ Support

If you like this project, consider giving it a star on GitHub.

About

AI-powered Gmail copilot for email analysis, smart replies, Gmail draft creation, and inbox automation.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages