A horizontally scalable, self-hosted email delivery platform built on Node.js, designed to safely send high volumes of emails while protecting sender accounts and maintaining excellent deliverability.
β Core Platform Implemented (85% Complete)
- β Database Layer: PostgreSQL with migrations and connection pooling
- β Worker System: Send workers with orchestrator and cron scheduler
- β API Layer: Complete REST API with JWT authentication
- β Tracking System: Open, click, and unsubscribe tracking
- β Safety Features: Warmup schedules, rate limiting, bounce monitoring
- β Analytics: Real-time metrics and reporting
- β Testing: Unit tests for core functionality
See IMPLEMENTATION_SUMMARY.md for complete details.
- Horizontal Scaling: Scale by adding sender accounts, not increasing per-account volume
- Account Protection: Strict per-account limits with automatic enforcement and warm-up schedules
- Multi-Provider Support: Works with both Gmail API and generic SMTP servers
- Advanced Tracking: Open, click, bounce, and unsubscribe tracking with privacy controls
- Worker-Based Architecture: One worker process per sender account for complete isolation
- Production-Ready: PostgreSQL database, PM2 process management, comprehensive monitoring
βββββββββββββββββββ
β Load Balancer β
ββββββββββ¬βββββββββ
β
βββββββββββββββΌββββββββββββββ
β Express.js API (Cluster) β
β β’ Admin Dashboard β
β β’ Campaign Management β
β β’ Tracking Endpoints β
βββββββββββββββ¬ββββββββββββββ
β
βββββββββββββββΌββββββββββββββ
β Worker Orchestrator β
β β’ Spawns send workers β
β β’ Enforces limits β
β β’ Handles failures β
βββββββββββββββ¬ββββββββββββββ
β
ββββββββββββ΄βββββββββββ
β β
ββββΌββββ ββββββΌβββ
βWorkerβ ... βWorkerNβ
βAcct 1β βAcct N β
ββββ¬ββββ ββββββ¬βββ
ββββββββββββ¬βββββββββββ
β
ββββββββββΌββββββββββ
β PostgreSQL DB β
ββββββββββββββββββββ
Core Principle: 1 Worker = 1 Account
- Each worker manages exactly one Gmail/SMTP account
- Workers send emails sequentially (never parallel within one worker)
- Horizontal scaling via adding more accounts/workers
- Complete failure isolation
- Node.js 18+
- PostgreSQL 14+
- Google Workspace account (for Gmail API) or SMTP server
```bash
git clone https://github.com/anaitabd/GAdmin-Toolkit.git cd GAdmin-Toolkit
npm install
cp .env.example .env
npm run migrate
npm run create-admin
pm2 start ecosystem.config.js
npm run dev
**For detailed setup instructions, see [QUICKSTART.md](QUICKSTART.md)**
## π Documentation
Comprehensive documentation is available:
### Getting Started
- **[QUICKSTART.md](QUICKSTART.md)** - Quick setup and testing guide
- **[IMPLEMENTATION_SUMMARY.md](IMPLEMENTATION_SUMMARY.md)** - What's been implemented
- **[IMPLEMENTATION_ROADMAP.md](IMPLEMENTATION_ROADMAP.md)** - Implementation status and roadmap
### Architecture & Design
- **[ARCHITECTURE.md](ARCHITECTURE.md)** - System architecture and design principles
- **[DATABASE_SCHEMA.md](docs/DATABASE_SCHEMA.md)** - Database schema and indexing strategy
- **[WORKER_DESIGN.md](docs/WORKER_DESIGN.md)** - Worker lifecycle and sending logic
- **[TRACKING_DESIGN.md](docs/TRACKING_DESIGN.md)** - Tracking implementation (opens, clicks, bounces)
- **[DELIVERABILITY.md](docs/DELIVERABILITY.md)** - Deliverability best practices and safety rules
- **[API_DESIGN.md](docs/API_DESIGN.md)** - API endpoints and integration guide
- **[DEPLOYMENT.md](docs/DEPLOYMENT.md)** - Production deployment guide
## π» Requirements
**Production** (for ~50-100 workers):
- AWS EC2 t3.medium or Azure Standard_B2s
- 2 vCPUs, 4 GB RAM
- PostgreSQL 14+
- Google Workspace or SMTP credentials
## βοΈ Configuration
### Environment Variables
\`\`\`env
NODE_ENV=production
PORT=3000
BASE_URL=https://yourdomain.com
DATABASE_URL=postgresql://user:pass@localhost/emaildb
JWT_SECRET=your_secret_here
GMAIL_SERVICE_ACCOUNT_PATH=./cred.json
MAX_WORKERS=50
\`\`\`
### Warm-Up Schedule
New accounts automatically follow a 6-week warm-up schedule:
- Week 1: 50 emails/day
- Week 2: 100 emails/day
- Week 3: 250 emails/day
- Week 4: 500 emails/day
- Week 5: 1,000 emails/day
- Week 6+: 2,000 emails/day (full capacity)
## π’ Deployment
### PM2 (Recommended)
\`\`\`bash
npm install -g pm2
pm2 start ecosystem.config.js
pm2 save
pm2 startup
\`\`\`
See [DEPLOYMENT.md](docs/DEPLOYMENT.md) for complete production guide.
## π Scaling
**Scaling Formula**:
- 10 accounts @ 2,000/day = 20,000 emails/day
- 100 accounts @ 2,000/day = 200,000 emails/day
- 1,000 accounts @ 2,000/day = 2,000,000 emails/day
## π Monitoring
\`\`\`bash
# Health check
curl https://yourdomain.com/api/health
# View stats
curl https://yourdomain.com/api/admin/stats \\
-H "Authorization: Bearer TOKEN"
\`\`\`
## π Security
- JWT Authentication
- Rate Limiting (100 req/15 min)
- Encrypted credentials at rest
- SSL/TLS for all communication
- Input validation and sanitization
## π License
MIT License - see LICENSE file for details.
## π Acknowledgments
### Option 1: Docker Deployment (Recommended for Production) π³
**The easiest way to deploy the complete application with all services!**
#### Quick Setup (Automated)
```bash
# 1. Clone the repository
git clone https://github.com/anaitabd/GAdmin-Toolkit.git
cd GAdmin-Toolkit
# 2. Run the automated setup script
chmod +x docker-setup.sh
./docker-setup.sh
The script will:
- β Validate Docker installation
- β Check and create .env file
- β Validate configuration
- β Build Docker images
- β Start all services
- β Help create admin user
# 1. Clone the repository
git clone https://github.com/anaitabd/GAdmin-Toolkit.git
cd GAdmin-Toolkit
# 2. Copy and configure environment variables
cp .env.example .env
# Edit .env with your settings (see DOCKER_GUIDE.md)
# 3. Start all services
docker compose up -d
# 4. Create admin user
docker compose exec backend node setup-admin.js admin YourPassword123!
# 5. Access the application
# Frontend: http://localhost
# Backend API: http://localhost:3000β Includes: MongoDB, Backend API, Frontend, and Redis π Full guide: See DOCKER_GUIDE.md for complete documentation
1. Install Backend Dependencies
cd main
npm install2. Setup Backend API
cd api
cp .env.example .env
# Edit .env with your MongoDB URI and JWT_SECRET
node setup-admin.js admin YourPassword123!3. Install Frontend Dependencies
cd ../frontend
npm install4. Start Both Services
In one terminal (Backend):
cd main/api
node server.jsIn another terminal (Frontend):
cd main/frontend
npm run devNow visit http://localhost:5173 to access the web interface!
See the API Documentation for complete setup instructions.
Quick setup:
cd main
npm install
cd api
cp .env.example .env
# Edit .env with your configuration
node setup-admin.js admin YourPassword123!
npm start1. Install Dependencies
Node.js
cd main
npm installPython
pip install -r py/requirement.txt2. Google API Credentials
Add your Google API credentials:
- Place your
cred.jsonfile in themain/api/directory.
- Start the backend API:
cd main/api
node server.js- Start the frontend (in a new terminal):
cd main/frontend
npm run dev- Open your browser:
- Navigate to
http://localhost:5173 - Login with username:
adminand password:YourSecurePassword123! - Use the intuitive web interface to:
- View dashboard statistics
- Generate and manage users
- Send emails via Gmail API or SMTP
- Monitor email logs and bounced emails
# Start the server
cd main && npm start
# Login to get a token
curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"YourPassword123!"}'
# Use the API with the token
curl -X GET http://localhost:3000/api/users \
-H "Authorization: Bearer YOUR_TOKEN_HERE"See TESTING.md for complete API examples.
1. Run All Scripts (Automated)
Use the automated script.sh to:
- Delete existing users
- Generate new user data
- Create users in Google Workspace
- Activate less secure app access
bash script.sh2. Run Scripts Individually
Generate User Data:
node main/api/generate.jsCreate Users:
node main/api/create.jsDelete Users:
node main/api/delete.jsActivate Less Secure App Access:
python py/activateLessSecureApp.py- Edit
main/api/.envfor database, JWT secrets, and server settings - See
.env.examplefor all available options
- Update CSV files in the
files/directory:data.csv,info.csv,names.csv,users.csv, etc. - Modify constants like
emailsPerWorkerandREQUESTS_PER_EMAILinside the scripts if needed
The new API backend includes:
- JWT Authentication: Secure token-based authentication
- Password Hashing: Bcrypt for secure password storage
- Rate Limiting: Protects against brute force and DoS attacks
- Auth endpoints: 5 requests per 15 minutes
- Email operations: 10 requests per hour
- General API: 100 requests per 15 minutes
- Environment Variables: Sensitive data protected in .env files
- Input Validation: Request validation on all endpoints
- CORS Support: Configurable cross-origin resource sharing
Built with Node.js, Express, PostgreSQL, Gmail API, and Nodemailer.
Built with β€οΈ for reliable, scalable email delivery
Contributions are welcome! Please submit a pull request or open an issue for enhancements or bug fixes.