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
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
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
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
git clone https://github.com/OPCODE-Open-Spring-Fest/MailMERN.git
cd MailMERNYou can now easily run the entire MailMERN stack (Frontend + Backend + MongoDB) using Docker Compose — no manual setup needed!
Make sure you have these installed:
Create a .env file inside the backend/ folder (if not already present):
PORT=5000
MONGO_URI=mongodb://mongo:27017/mailmern
EMAIL_USER=[email protected]
EMAIL_PASS=your_app_password
OPENAI_API_KEY=your_openai_key
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false # true for 465, false for 587
SMTP_USER=[email protected]
SMTP_PASS=your_app_password
EMAIL_FROM="MailMERN [email protected]"
EMAIL_TEST_TO=[email protected]
NODE_ENV=developmentFrom the project root, run:
docker-compose up --buildThis will:
🧩 Start the MongoDB container
⚙️ Run the Express backend on port 5000
💻 Serve the React frontend on port 5173
Once started:
Frontend: http://localhost:5173
Backend API: http://localhost:5000/api
To stop and remove all running containers, use:
docker-compose down2️⃣ Backend Setup
cd backend
npm installCreate a .env file based on .env.example:
PORT=5000
MONGO_URI=your_mongodb_uri
[email protected]
EMAIL_PASS=your_app_password
OPENAI_API_KEY=your_openai_keyRun the backend:
npm run dev3️⃣ Frontend Setup
cd frontend
npm install
npm run devOpen: 👉 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
The AI Auto Responder chatbot has been successfully implemented! 🎉
- 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
-
Set up OpenAI API key in your
.envfile:OPENAI_API_KEY=your_openai_api_key_here
-
Access the chatbot:
- Visit
/chatbotfor the full chat interface - Use the chat widget on the home page
- Navigate via the "AI Assistant" link in the navbar
- Visit
-
API Endpoints:
POST /api/chatbot/message- Send messagesGET /api/chatbot/history/:userId- Get chat historyGET /api/chatbot/analytics/:userId- Get analytics
For detailed documentation, see CHATBOT_README.md
| 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/MailMERNStep 2: Create a Branch
git checkout -b feat/your-feature-nameStep 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-nameStep 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.
Md Irfan Raj
🪪 Code Name: Silver
📧 [email protected]
🌟 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!
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!