Skip to content

MailMERN is an open-source MERN stack project designed to help teams, startups, and organizations send mass personalized emails, automate follow-ups, and respond intelligently through a chatbot assistant that

OPCODE-Open-Spring-Fest/MailMERN

Repository files navigation

πŸ’Œ MERN Mass Email Sender & AI Auto-Responder

All Contributors

A full-stack MERN Starter Project for creating an open-source email marketing platform β€” similar to AWeber or Mailchimp β€” that can:

  • πŸ“© Send mass emails to large groups efficiently
  • πŸ€– Provide AI-powered automated replies
  • πŸ“… Schedule meetings, reply to FAQs, and manage follow-up messages automatically

πŸš€ Tech Stack

Frontend: React (Vite or CRA)
Backend: Node.js + Express
Database: MongoDB (Mongoose)
Email Service: Nodemailer / Gmail API / SendGrid (planned)
AI Bot Engine: OpenAI API / Local Model Integration (planned)
Styling: CSS / Tailwind
Routing: React Router v6
Task Scheduling: Node Cron


🎯 Project Goal

To create an open-source scalable platform where contributors can collaboratively build:

  • Bulk email campaigns
  • Contact management system
  • Template-based email editor
  • AI assistant for automated replies
  • Analytics dashboard for sent & opened emails

πŸ“ Folder Structure

MailMERN/
β”‚
β”œβ”€β”€ backend/ # Node.js + Express API backend
β”‚ β”œβ”€β”€ server.js # Main backend entry point
β”‚ β”œβ”€β”€ routes/ # Express routes
β”‚ β”‚ β”œβ”€β”€ emailRoutes.js # Routes for sending & managing emails
β”‚ β”‚ β”œβ”€β”€ userRoutes.js # Routes for authentication & profiles
β”‚ β”‚ └── chatbotRoutes.js # Routes for AI-based auto responses
β”‚ β”œβ”€β”€ controllers/ # Controller logic for routes
β”‚ β”‚ β”œβ”€β”€ emailController.js
β”‚ β”‚ β”œβ”€β”€ userController.js
β”‚ β”‚ └── chatbotController.js
β”‚ β”œβ”€β”€ models/ # MongoDB models
β”‚ β”‚ β”œβ”€β”€ User.js
β”‚ β”‚ β”œβ”€β”€ Campaign.js
β”‚ β”‚ └── Message.js
β”‚ β”œβ”€β”€ utils/ # Helper files
β”‚ β”‚ β”œβ”€β”€ sendEmail.js # Nodemailer logic
β”‚ β”‚ β”œβ”€β”€ openaiClient.js # AI chatbot integration
β”‚ β”‚ └── scheduler.js # Cron job for scheduled emails
β”‚ β”œβ”€β”€ config/ # DB & server config
β”‚ β”‚ β”œβ”€β”€ db.js
β”‚ β”‚ └── dotenv.config.js
β”‚ └── .env.example # Example environment variables
β”‚
β”œβ”€β”€ frontend/ # React frontend
β”‚ β”œβ”€β”€ src/
β”‚ β”‚ β”œβ”€β”€ pages/ # App pages
β”‚ β”‚ β”‚ β”œβ”€β”€ Home.jsx
β”‚ β”‚ β”‚ β”œβ”€β”€ Campaigns.jsx
β”‚ β”‚ β”‚ β”œβ”€β”€ Chatbot.jsx
β”‚ β”‚ β”‚ β”œβ”€β”€ Analytics.jsx
β”‚ β”‚ β”‚ β”œβ”€β”€ About.jsx
β”‚ β”‚ β”‚ β”œβ”€β”€ Contact.jsx
β”‚ β”‚ β”‚ └── NotFound.jsx
β”‚ β”‚ β”œβ”€β”€ components/ # Reusable components
β”‚ β”‚ β”‚ β”œβ”€β”€ Navbar.jsx
β”‚ β”‚ β”‚ β”œβ”€β”€ Footer.jsx
β”‚ β”‚ β”‚ β”œβ”€β”€ CampaignCard.jsx
β”‚ β”‚ β”‚ β”œβ”€β”€ ChatbotWidget.jsx
β”‚ β”‚ β”‚ └── Loader.jsx
β”‚ β”‚ β”œβ”€β”€ App.jsx # Routing setup
β”‚ β”‚ β”œβ”€β”€ main.jsx # ReactDOM entry point
β”‚ β”‚ β”œβ”€β”€ assets/ # Images and icons
β”‚ β”‚ └── styles/ # Global styles
β”‚ β”œβ”€β”€ package.json
β”‚ └── vite.config.js
β”‚
β”œβ”€β”€ .gitignore
β”œβ”€β”€ package.json # Root file for concurrent scripts
β”œβ”€β”€ README.md # Project documentation
└── LICENSE # Open source license

βš™οΈ Environment Setup

1️⃣ Clone the Repository

git clone https://github.com/OPCODE-Open-Spring-Fest/MailMERN.git
cd MailMERN

2️⃣ Backend Setup

cd backend
npm install

Create a .env file based on .env.example:

PORT=5000
MONGO_URI=your_mongodb_uri
EMAIL_USER=your_email@example.com
EMAIL_PASS=your_app_password
OPENAI_API_KEY=your_openai_key

Run the backend:

npm run dev

3️⃣ Frontend Setup

cd frontend
npm install
npm run dev

Open: πŸ‘‰ http://localhost:5173 (Vite) or πŸ‘‰ http://localhost:3000 (CRA)

4️⃣ Run Both (Optional)

In the root directory, add to package.json:

"scripts": { "start": "concurrently "npm run dev --prefix backend" "npm run dev --prefix frontend"" }

Then simply run:

npm start

πŸ€– AI Chatbot Feature (COMPLETED!)

The AI Auto Responder chatbot has been successfully implemented! πŸŽ‰

What's Included:

  • OpenAI Integration: Uses GPT-3.5-turbo for intelligent responses
  • Smart Fallback: Predefined responses when OpenAI is unavailable
  • Message Categorization: Automatically categorizes queries (greeting, pricing, support, features)
  • Sentiment Analysis: Analyzes user message sentiment
  • Full Chat Interface: Complete chat page at /chatbot
  • Embeddable Widget: Chat widget for any page
  • Conversation History: Stores and retrieves chat history
  • Analytics: Usage analytics and insights

How to Use:

  1. Set up OpenAI API key in your .env file:

    OPENAI_API_KEY=your_openai_api_key_here
  2. Access the chatbot:

    • Visit /chatbot for the full chat interface
    • Use the chat widget on the home page
    • Navigate via the "AI Assistant" link in the navbar
  3. API Endpoints:

    • POST /api/chatbot/message - Send messages
    • GET /api/chatbot/history/:userId - Get chat history
    • GET /api/chatbot/analytics/:userId - Get analytics

For detailed documentation, see CHATBOT_README.md

πŸš€ Planned Features

Feature Description Status
πŸ“§ Mass Email Sending Send personalized bulk emails βœ… Base setup
🧠 AI Auto Responder AI chatbot replies to received emails βœ… COMPLETED
πŸ“… Scheduler Schedule campaigns for future dates 🧩 Planned
πŸ“Š Dashboard Track sent, opened, and clicked emails 🧩 Planned
πŸ“‚ Contact Management Upload and manage email lists 🧩 Planned
βœ‰οΈ Template Builder Create and edit HTML email templates 🧩 Planned

πŸ‘©β€πŸ’» Contribution Guide

We ❀️ contributions from the community!

Step 1: Fork the Repo from github and then clone it in local pc

git clone https://github.com/OPCODE-Open-Spring-Fest/MailMERN

Step 2: Create a Branch

git checkout -b feat/your-feature-name

Step 3: Make Changes

Add your updates inside frontend or backend folder.

Step 4: Commit & Push

git add .
git commit -m "feat: added <feature>"
git push origin feat/your-feature-name

Step 5: Create a Pull Request

Go to GitHub β†’ Pull Requests β†’ New PR Describe your changes, link related issues, and submit πŸš€

🧠 How It Works (Concept)

User uploads contact list (CSV/Excel) β†’ Contacts stored in MongoDB

User creates a campaign β†’ Selects template and message content

System sends emails using Nodemailer / SendGrid β†’ Logs results (sent, failed, bounced)

Incoming replies trigger AI chatbot β†’ Uses OpenAI API to auto-reply, schedule meetings, or answer FAQs

πŸ§ͺ Scripts Command Description

npm run dev (backend) Start Express server npm run dev (frontend) Start React frontend npm start (root) Run both concurrently 🧩 Future Enhancements

Add JWT authentication

Integrate email tracking via Pixel

Add custom analytics dashboard

Integrate Google Calendar API for scheduling meetings

Support multiple SMTP providers

βš–οΈ License

This project is open-sourced under the MIT License. You’re free to use, modify, and distribute β€” just give credit.

πŸ‘€ Maintainer

Md Irfan Raj
πŸͺͺ Code Name: Silver
πŸ“§ mdirfanraj88.omega@gmail.com

🌟 Support & Contribution

If you like this project:

⭐ Star this repository

πŸ’¬ Share feedback in Issues

πŸš€ Contribute by raising PRs

Together, let’s build an open-source AI-powered mass email platform!

Contributors ✨

Thanks goes to these wonderful people (emoji key):

sujalgoyall
sujalgoyall

πŸ’» πŸ“–
Shreyanshi210205
Shreyanshi210205

πŸ’» πŸ“– πŸš‡
MD IRFAN RAJ
MD IRFAN RAJ

πŸ’» πŸ“– πŸš‡
Tushar Patel
Tushar Patel

πŸ’»
Satvik Singh
Satvik Singh

πŸ’»
Sneha Singh
Sneha Singh

πŸ’»
SHIVA00202
SHIVA00202

πŸ’»
Abhijit Kumar
Abhijit Kumar

πŸ’»
Nitin Gupta
Nitin Gupta

πŸ’»
Koushal G H
Koushal G H

πŸ’»
Indrasuthar07
Indrasuthar07

πŸ’»
Abhijit
Abhijit

πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!

About

MailMERN is an open-source MERN stack project designed to help teams, startups, and organizations send mass personalized emails, automate follow-ups, and respond intelligently through a chatbot assistant that

Topics

Resources

Code of conduct

Stars

Watchers

Forks

Contributors 13