BhaMail is a production-ready, self-hosted email solution that provides Gmail-like functionality for individuals, teams, and organizations. Built with modern technologies and designed for easy deployment and maintenance.
- Modern Web Interface - Gmail-like UI with responsive design
- Mobile Apps - Native Flutter apps for iOS and Android
- Email Protocols - Full SMTP, IMAP, and POP3 support
- Conversation Threading - Smart email grouping and organization
- Advanced Search - Powered by OpenSearch with full-text indexing
- Attachment Support - File uploads with virus scanning
- Rich Text Editor - HTML email composition with formatting
- Labels and Filters - Customizable email organization
- Multiple Accounts - Support for multiple email domains
- Two-Factor Authentication (2FA) - TOTP support
- DKIM Signing - Domain-based email authentication
- JWT Tokens - Secure API authentication
- Rate Limiting - Protection against abuse
- Virus Scanning - ClamAV integration for attachments
- Encrypted Storage - Secure password hashing
- Admin Panel - Web-based administration interface
- User Management - Create, edit, and manage user accounts
- Domain Configuration - Multi-domain email hosting
- Monitoring - Health checks and system metrics
- Backup/Restore - Automated backup and recovery tools
- API Access - RESTful API with OpenAPI documentation
- Docker Compose - Local development and testing
- Kubernetes - Production-ready container orchestration
- MinIO Storage - S3-compatible object storage for attachments
- Redis Cache - Performance optimization and session management
- PostgreSQL - Robust database with full ACID compliance
- MailHog - Email testing and development tools
- Docker and Docker Compose
- Node.js 18+ (for development)
- Git
-
Clone the repository
git clone https://github.com/your-org/bhamail.git cd bhamail -
Run setup script
./scripts/setup.sh
-
Start services
docker-compose up -d
-
Seed database
npm run seed
-
Access the application
- Web App: http://localhost:3000
- API Docs: http://localhost:3001/api-docs
- MailHog: http://localhost:8025
- Admin: admin@bhamail.local / password
See Production Deployment Guide for detailed instructions.
bhamail/
βββ api/ # Backend API (Node.js + TypeScript)
β βββ src/ # Source code
β βββ migrations/ # Database migrations
β βββ package.json
βββ web/ # Frontend web app (React + Vite)
β βββ src/ # React components and pages
β βββ public/ # Static assets
β βββ package.json
οΏ½οΏ½ββ mobile/ # Mobile app (Flutter)
β βββ lib/ # Dart source code
β βββ android/ # Android-specific files
β βββ ios/ # iOS-specific files
β βββ pubspec.yaml
βββ infra/ # Infrastructure as code
β βββ k8s/ # Kubernetes manifests
β βββ terraform/ # Terraform configurations
βββ docs/ # Documentation
β βββ api.md # API documentation
β βββ deployment.md # Deployment guide
β βββ architecture.md # System architecture
βββ scripts/ # Utility scripts
β βββ setup.sh # Development setup
β βββ seed.js # Database seeding
β βββ backup.sh # Backup script
β βββ restore.sh # Restore script
βββ tests/ # Test suites
β βββ api/ # API tests
β βββ web/ # Web app tests
β βββ e2e/ # End-to-end tests
βββ docker-compose.yml # Local development environment
- Node.js - Runtime environment
- TypeScript - Type-safe JavaScript
- Express.js - Web framework
- PostgreSQL - Primary database
- Redis - Caching and queues
- MinIO - Object storage (S3-compatible)
- OpenSearch - Search and analytics
- ClamAV - Antivirus scanning
- React - UI library
- Vite - Build tool and dev server
- Tailwind CSS - Utility-first CSS framework
- Radix UI - Accessible component primitives
- React Query - Data fetching and state management
- React Router - Client-side routing
- Flutter - Cross-platform mobile framework
- Dart - Programming language
- Provider/Riverpod - State management
- HTTP - API communication
- Docker - Containerization
- Kubernetes - Container orchestration
- Terraform - Infrastructure as code
- GitHub Actions - CI/CD pipelines
- API Documentation
- Architecture Overview
- Deployment Guide
- Development Guide
- Security Guide
- Troubleshooting
# Database
DB_HOST=localhost
DB_PORT=5432
DB_NAME=bhamail
DB_USER=bhamail
DB_PASSWORD=bhamail123
# Redis
REDIS_HOST=localhost
REDIS_PORT=6379
# JWT
JWT_SECRET=your-super-secret-jwt-key
JWT_EXPIRES_IN=7d
# Mail
SMTP_HOST=mailhog
SMTP_PORT=1025
SMTP_SECURE=false
# Storage
MINIO_ENDPOINT=localhost:9000
MINIO_ACCESS_KEY=minioadmin
MINIO_SECRET_KEY=minioadmin
MINIO_BUCKET=bhamail-attachments
# Search
OPENSEARCH_HOST=localhost:9200| Service | Port | Description |
|---|---|---|
| postgres | 5432 | PostgreSQL database |
| redis | 6379 | Redis cache and queues |
| minio | 9000/9001 | MinIO object storage |
| opensearch | 9200 | OpenSearch cluster |
| mailhog | 1025/8025 | Email testing (SMTP/Web) |
| clamav | 3310 | Antivirus scanning |
| api | 3001 | Backend API server |
| web | 3000 | Frontend web app |
cd api
npm test
npm run test:coveragecd web
npm test
npm run test:e2enpm run test:integrationWe welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Add tests for your changes
- Run the test suite:
npm test - Commit your changes:
git commit -m 'Add amazing feature' - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: Check our docs for detailed guides
- Issues: Report bugs or request features on GitHub Issues
- Discussions: Join community discussions on GitHub Discussions
- Email: Contact us at support@bhamail.com
- Calendar integration
- Contact management
- Email templates
- Mobile push notifications
- Advanced spam filtering
- End-to-end encryption (PGP)
- Chat integration
- File sharing and collaboration
- Advanced analytics dashboard
- Multi-language support
- AI-powered email categorization
- Video calls integration
- Advanced workflow automation
- Third-party app marketplace
- Enterprise features (SSO, LDAP)
Thank you to our sponsors who make this project possible!
Become a sponsor and get your logo here.
- Mailcow - Inspiration for self-hosted email
- Gmail - UI/UX inspiration
- Postfix - SMTP server reference
- Dovecot - IMAP server reference
- OpenSearch - Search functionality
- MinIO - S3-compatible storage
Made with β€οΈ by the BhaMail team - Open Source Email Service
A production-grade, Gmail-like email service built with modern web technologies. BhaMail provides a complete email solution with web and mobile clients, focusing on privacy, security, and ease of deployment.
- Docker Desktop
- Node.js 18+ (for development)
- Git
- Clone and Setup
git clone <repository-url>
cd BhaMail
cp .env.example .env- Start Services
docker-compose up -d- Initialize Database and Seed Data
npm run setup
npm run seed- Access the Application
- Web UI: http://localhost:3000
- API Docs: http://localhost:8000/docs
- MailHog (Email Testing): http://localhost:8025
- Admin Login:
admin@bhamail.local/password
BhaMail/
βββ api/ # Node.js + TypeScript Backend
β βββ src/
β β βββ controllers/ # API controllers
β β βββ services/ # Business logic
β β βββ models/ # Database models
β β βββ middleware/ # Express middleware
β β βββ routes/ # API routes
β β βββ utils/ # Utilities
β βββ migrations/ # Database migrations
β βββ tests/ # Backend tests
β βββ package.json
βββ web/ # React + Vite Frontend
β βββ src/
β β βββ components/ # React components
β β βββ pages/ # Page components
β β βββ services/ # API services
β β βββ hooks/ # Custom hooks
β β βββ utils/ # Utilities
β βββ public/ # Static assets
β βββ package.json
βββ mobile/ # Flutter Mobile App
β βββ lib/
β β βββ screens/ # Mobile screens
β β βββ widgets/ # Reusable widgets
β β βββ services/ # API services
β βββ pubspec.yaml
βββ infra/ # Infrastructure
β βββ docker-compose.yml
β βββ k8s/ # Kubernetes manifests
β βββ helm/ # Helm charts
βββ docs/ # Documentation
βββ scripts/ # Utility scripts
βββ tests/ # Integration & E2E tests
- API: Node.js + TypeScript + Express
- Database: PostgreSQL
- Cache: Redis
- Queue: BullMQ
- Search: OpenSearch
- Storage: MinIO (S3-compatible)
- Mail: MailHog (dev) / Postfix+Dovecot (prod)
- Security: JWT, bcrypt, rate limiting
- Monitoring: Prometheus + Grafana
- Web: React + Vite + TypeScript
- Mobile: Flutter
- PWA: Service Workers, offline support
- UI: Tailwind CSS, shadcn/ui components
- Containers: Docker + Docker Compose
- Orchestration: Kubernetes + Helm
- CI/CD: GitHub Actions
- Testing: Jest, Cypress, k6
cd api
npm install
npm run dev # Start development server
npm run build # Build for production
npm run test # Run tests
npm run migrate # Run database migrationscd web
npm install
npm run dev # Start development server
npm run build # Build for production
npm run test # Run tests
npm run preview # Preview production buildcd mobile
flutter pub get
flutter run # Run on connected device
flutter build apk # Build Android APK- β Email/password signup and login
- β JWT + refresh token authentication
- β Password reset via email
- β Two-factor authentication (TOTP)
- β Rate limiting and account lockouts
- β CSRF protection and CORS configuration
- β Compose, send, reply, forward emails
- β Conversation threading
- β Drafts auto-save
- β Attachments with virus scanning
- β Labels and folders
- β Email filters and rules
- β Full-text search with OpenSearch
- β Schedule send and snooze
- β Offline support via service workers
- β Multi-tenant support
- β User management admin panel
- β Quota management and monitoring
- β Audit logs and compliance features
- β Backup and restore procedures
- β SMTP sending and receiving
- β IMAP/POP3 support documentation
- β SPF/DKIM/DMARC configuration
- β External client support (Outlook, Thunderbird)
See docs/production-ops.md for detailed instructions.
helm install bhamail ./infra/helm/bhamail- Architecture Overview
- API Documentation
- Production Operations
- SPF/DKIM/DMARC Setup
- Security Best Practices
- Development Guide
npm run testnpm run test:integrationnpm run test:e2enpm run test:loadBhaMail implements security best practices:
- TLS encryption for all communications
- Secure password storage with bcrypt/Argon2
- JWT tokens with secure refresh mechanism
- CSRF tokens and XSS protection
- Rate limiting and DDoS protection
- Virus scanning for attachments
- Audit logging for compliance
Currently supported languages:
- English (default)
- Hindi (example implementation)
MIT License - see LICENSE file for details.
See CONTRIBUTING.md for development setup and contribution guidelines.
For support, please open an issue on GitHub or join our community discussions.
