Skip to content

javcod/mailpilot-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

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

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors