A comprehensive MERN stack application with AI-powered email scheduling and optimization. Schedule emails, improve content with AI, and track performance analytics.
The AI Email Scheduler is a full-stack web application that allows users to:
- 📧 Schedule emails for future delivery
- 🤖 AI-powered text improvement with grammar correction and tone adjustment
- 📊 Excel contact management for bulk email operations
- 📈 Analytics dashboard to track email performance
- ⚡ Real-time scheduling with automatic email delivery
┌─────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ React.js │ │ Node.js │ │ Python Flask │
│ Frontend │◄──►│ Backend API │◄──►│ AI Service │
│ (Vite) │ │ (Express.js) │ │ (Transformers) │
└─────────────────┘ └──────────────────┘ └──────────────────┘
│ │
│ │
▼ ▼
┌─────────────────┐ ┌──────────────────┐
│ MongoDB │ │ Nodemailer │
│ Database │ │ Email Service │
└─────────────────┘ └──────────────────┘
- React.js 18 with Vite
- Tailwind CSS for styling
- React Router DOM for navigation
- Axios for API calls
- React Toastify for notifications
- SheetJS for Excel file processing
- Node.js with Express.js
- MongoDB with Mongoose ODM
- JWT for authentication
- bcryptjs for password hashing
- Nodemailer for email delivery
- node-cron for job scheduling
- Python Flask API
- Hugging Face Transformers
- PyTorch for model inference
- Grammar correction and tone optimization
- Node.js 16+
- Python 3.8+
- MongoDB
- Git
git clone <repository-url>
cd "AI-Based Email Scheduler"# Navigate to frontend
cd client
# Install dependencies
npm install
# Start development server
npm run devFrontend will run on http://localhost:3000
# Navigate to backend (new terminal)
cd server
# Install dependencies
npm install
# Create .env file and configure
cp .env.example .env
# Start backend server
npm run devBackend will run on http://localhost:5000
# Navigate to AI service (new terminal)
cd ai-email-service
# Create virtual environment
python -m venv venv
# Activate virtual environment
# Windows:
venv\Scripts\activate
# Mac/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Start AI service
python run.pyAI Service will run on http://localhost:5001
NODE_ENV=development
PORT=5000
MONGODB_URI=mongodb://localhost:27017/email_scheduler
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRE=7d
# Email Configuration (Gmail example)
EMAIL_SERVICE=gmail
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=[email protected]
EMAIL_PASS=your_app_password
FRONTEND_URL=http://localhost:3000
AI_SERVICE_URL=http://localhost:5001/apiFLASK_ENV=development
PORT=5001
HOST=0.0.0.0
MODEL_CACHE_DIR=./model_cache
CORS_ORIGINS=http://localhost:3000
RATE_LIMIT=100 per day- Enable 2-factor authentication
- Generate App Password:
- Go to Google Account → Security
- Enable 2-Step Verification
- Generate App Password
- Use the 16-character password in
EMAIL_PASS
Update the email configuration in backend .env:
EMAIL_SERVICE=outlook
EMAIL_HOST=smtp.office365.com
EMAIL_PORT=587- User registration and login
- JWT-based authentication
- Protected routes
- Password hashing with bcrypt
- Compose: Rich text email composition
- Schedule: Future delivery scheduling
- Contacts: Excel-based contact management
- Templates: AI-improved email templates
- Grammar Correction: Automatic grammar and spelling fixes
- Tone Adjustment: Professional, friendly, formal, casual tones
- Content Optimization: AI-suggested improvements
- Multi-tone Suggestions: Compare different writing styles
- Delivery success rates
- Open and click tracking
- Performance metrics
- Scheduled vs sent analytics
- Bulk Operations: Send to multiple contacts
- Excel Integration: Import/export contact lists
- Real-time Status: Live email delivery status
- Error Handling: Comprehensive error management
AI-Based Email Scheduler/
├── client/ # React Frontend
│ ├── src/
│ │ ├── components/ # Reusable components
│ │ ├── pages/ # Page components
│ │ ├── context/ # React context
│ │ ├── utils/ # Utilities and API
│ │ └── hooks/ # Custom hooks
│ └── package.json
├── server/ # Node.js Backend
│ ├── controllers/ # Route controllers
│ ├── models/ # MongoDB models
│ ├── routes/ # API routes
│ ├── services/ # Business logic
│ ├── middleware/ # Custom middleware
│ └── server.js
└── ai-email-service/ # Python AI Service
├── app/
│ ├── models/ # AI model wrappers
│ ├── services/ # Text processing services
│ └── utils/ # Helper functions
└── run.py
- Responsive Design: Works on desktop, tablet, and mobile
- Dark/Light Mode: Theme support (ready for implementation)
- Real-time Updates: Live dashboard updates
- Intuitive Navigation: Sidebar-based navigation
- Loading States: Smooth loading indicators
- Error Boundaries: Graceful error handling
POST /api/auth/register- User registrationPOST /api/auth/login- User loginGET /api/auth/me- Get current userPUT /api/auth/updatepassword- Update password
POST /api/emails/schedule- Schedule new emailsGET /api/emails/scheduled- Get scheduled emailsDELETE /api/emails/scheduled/:id- Cancel scheduled emailGET /api/emails/analytics- Get email analyticsPOST /api/emails/upload-contacts- Upload Excel contacts
POST /api/improve-text- Improve text with AIPOST /api/check-grammar- Grammar checkPOST /api/suggest-tone- Get tone suggestions
- Model:
vennify/t5-base-grammar-correction - Purpose: Fix grammatical errors and improve sentence structure
- Model:
cardiffnlp/twitter-roberta-base-sentiment-latest - Purpose: Analyze and adjust email tone
- Model:
t5-small - Purpose: Rephrase content for different tones
npm run build
# Deploy dist/ folder to your hosting service# Set environment variables in hosting platform
# Deploy server/ directory# Install Python dependencies
# Set environment variables
# Deploy ai-email-service/ directorycd client
npm testcd server
npm testUse the provided Postman collection or test with curl:
# Test health endpoint
curl http://localhost:5000/api/health
# Test AI service
curl -X POST http://localhost:5001/api/improve-text \
-H "Content-Type: application/json" \
-d '{"text": "test email content", "tone": "professional"}'- JWT Authentication: Secure token-based auth
- Password Hashing: bcrypt password security
- Input Validation: Server-side validation
- CORS Protection: Configured CORS policies
- Rate Limiting: API rate limiting
- XSS Protection: Input sanitization
- Helmet.js: Security headers
- React Lazy Loading: Code splitting for faster loads
- Image Optimization: Optimized assets
- API Caching: Intelligent caching strategies
- Database Indexing: Optimized MongoDB queries
- Model Caching: AI model caching for faster inference
-
Email Not Sending
- Check email configuration in
.env - Verify app password for Gmail
- Check SMTP settings for other providers
- Check email configuration in
-
AI Service Not Working
- Verify Python dependencies
- Check model download permissions
- Ensure sufficient RAM for models
-
Database Connection Issues
- Verify MongoDB is running
- Check connection string in
.env - Ensure network connectivity
Enable debug mode by setting:
NODE_ENV=development
FLASK_DEBUG=True- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Hugging Face for transformer models
- MongoDB for database services
- React & Node.js communities
- Tailwind CSS for styling utilities
For support and questions:
- 📧 Email: [email protected]
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
Built with ❤️ using MERN Stack & AI Technologies