A self-hosted email archiving service with React frontend and Node.js backend, featuring full-text search, user authentication, and comprehensive email management capabilities.
- 📤 Manual Upload: Drag & Drop interface for .eml/.msg files
- 🔍 Full-Text Search: Powered by Elasticsearch with advanced query capabilities
- 📎 Attachment Extraction: Automatic storage and preview of email attachments
- 📊 Metadata Extraction: Date, sender, recipient, subject, and more
- 🔄 Deduplication: Based on Message-ID to prevent duplicate emails
- 🏷️ Categorization: Automatic tagging and label management
- 🧵 Thread View: Email conversation threading and display
- 📤 Export Functions: JSON export of search results
- 👥 User Authentication: Multi-user support with role-based access control
- 📈 Analytics Dashboard: Comprehensive statistics and insights
- 🐳 Docker Compose: Easy deployment solution
- ⚛️ React + Vite: Modern, fast frontend
- 📘 TypeScript: Type safety across the entire stack
- 🔍 Elasticsearch: High-performance full-text search
- 🐘 PostgreSQL: Reliable metadata storage
- 🔴 Redis: Caching and job queues
- 🔐 JWT Authentication: Secure user authentication
- 🛡️ Security: bcrypt password hashing, CORS protection, input validation
┌─ Frontend (React + Vite + TypeScript)
├─ Backend (Node.js + Express + TypeScript)
├─ Database (PostgreSQL)
├─ Search Engine (Elasticsearch)
├─ Cache/Queue (Redis)
└─ File Storage (Docker Volumes)
- Docker & Docker Compose
- Node.js 18+ (for local development)
- Clone the repository
git clone <repository-url>
cd EmailArchiveOS- Automatic startup (recommended)
./start.shThe startup script automatically:
- ✅ Checks if Docker is installed (installs automatically if needed)
- ✅ Checks if Docker Compose v2 is available (installs automatically if needed)
- ✅ Starts Docker Desktop on macOS automatically
- ✅ Creates necessary directories
- ✅ Starts all services
- ✅ Waits for all services to be ready
- ✅ Performs health checks
- ✅ Shows final status overview
Supported operating systems:
- 🐧 Ubuntu/Debian (with apt)
- 🎩 CentOS/RHEL (with yum)
- 🏗️ Arch Linux (with pacman)
- 🍎 macOS (with Homebrew)
- Manual startup (optional)
docker-compose up -d
# or with Docker Compose v2:
docker compose up -d- Stop services
./stop.sh- Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:5000
- Backend Health Check: http://localhost:5000/health
-
Prepare email files
- Export emails as .eml files from your email client
- Or use .msg files (Outlook format)
-
Login to the system
- Default admin credentials:
- Email:
admin@emailarchive.local - Password:
admin123
- Email:
⚠️ Important: Change the password after first login!
- Default admin credentials:
-
Upload emails
- Navigate to http://localhost:3000/upload
- Drag & Drop your email files
- Wait for processing to complete
-
Search and browse emails
- Use the search function at http://localhost:3000/search
- Or browse the dashboard for an overview
- Admin: Full system permissions, can create and manage users
- User: Can use all email archiving functions
- Secure JWT-based authentication (24h token validity)
- Automatic token renewal during active usage
- bcrypt password hashing (12 rounds)
- Soft-delete for users (deactivation instead of deletion)
- Install dependencies
# Frontend
cd frontend
npm install
# Backend
cd ../backend
npm install- Start services (DB, Elasticsearch, Redis only)
docker-compose up -d postgres elasticsearch redis- Start frontend
cd frontend
npm run dev- Start backend
cd backend
npm run devEmailArchiveOS/
├── docker-compose.yml # Service orchestration
├── start.sh # Intelligent startup script
├── stop.sh # Safe shutdown script
├── frontend/
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ │ ├── Dashboard.tsx # Main dashboard
│ │ │ ├── Upload.tsx # File upload interface
│ │ │ ├── Search.tsx # Search functionality
│ │ │ ├── Archive.tsx # Email archive view
│ │ │ ├── Labels.tsx # Label management
│ │ │ ├── EmailView.tsx # Individual email view
│ │ │ ├── Login.tsx # Authentication
│ │ │ ├── UserManagement.tsx # Admin user management
│ │ │ └── Settings.tsx # Application settings
│ │ ├── services/ # API services
│ │ ├── contexts/ # React contexts
│ │ └── types/ # TypeScript types
│ ├── package.json
│ └── Dockerfile
├── backend/
│ ├── src/
│ │ ├── routes/ # Express routes
│ │ │ ├── authRoutes.ts # Authentication endpoints
│ │ │ ├── emailRoutes.ts # Email management
│ │ │ ├── labelsRoutes.ts # Label operations
│ │ │ ├── statsRoutes.ts # Analytics endpoints
│ │ │ └── databaseRoutes.ts # Database operations
│ │ ├── services/ # Business logic
│ │ │ ├── EmailService.ts # Email processing
│ │ │ ├── SearchService.ts # Search functionality
│ │ │ ├── UserService.ts # User management
│ │ │ ├── ElasticsearchService.ts # Search engine
│ │ │ └── DatabaseService.ts # Database operations
│ │ ├── middleware/ # Express middleware
│ │ │ └── auth.ts # Authentication middleware
│ │ ├── database/ # DB schema & migrations
│ │ └── types/ # TypeScript types
│ ├── package.json
│ └── Dockerfile
└── README.md
POST /api/auth/login- User loginGET /api/auth/profile- Current user profilePOST /api/auth/change-password- Change passwordPOST /api/auth/logout- Logout
POST /api/emails/upload- Upload email fileGET /api/emails/recent- Get recent emailsPOST /api/emails/search- Search emailsGET /api/emails/:id- Get email detailsGET /api/emails/thread/:threadId- Get email threadPATCH /api/emails/:id/labels- Update email labelsGET /api/emails/:id/attachments/:filename- Download attachment
POST /api/auth/users- Create new userGET /api/auth/users- List all usersPATCH /api/auth/users/:id- Edit userDELETE /api/auth/users/:id- Delete user
GET /api/stats- Get system statisticsGET /api/labels- Get all available labels
Backend (.env)
PORT=5000
FRONTEND_URL=http://localhost:3000
DATABASE_URL=postgresql://emailarchive:password@localhost:5432/emailarchive
ELASTICSEARCH_URL=http://localhost:9200
REDIS_URL=redis://localhost:6379
JWT_SECRET=your-very-secure-random-jwt-secret-key-hereFrontend (.env)
VITE_API_URL=http://localhost:5000/api- Configure environment
cp .env.example .env
# Edit .env with production values- SSL/HTTPS configuration
# docker-compose.prod.yml
# Add reverse proxy (nginx) configuration- Backup strategy
# PostgreSQL backup
docker-compose exec postgres pg_dump -U emailarchive emailarchive > backup.sql
# Elasticsearch backup
# Configure Elasticsearch snapshots🚀 start.sh - Intelligent startup
./start.sh- Automatic Docker/Docker Compose installation
- OS-specific installation procedures
- Health checks and status monitoring
- Automatic browser opening
🛑 stop.sh - Safe shutdown
./stop.sh- Confirmation before stopping
- Option to delete data volumes
- Overview of all stopped services
📋 Useful Commands
# Check service status
docker compose ps
# or
docker-compose ps
# View logs
docker compose logs -f
docker compose logs backend
docker compose logs frontend
# Restart services
docker compose restart
# Restart single service
docker compose restart backend
# Cleanup (images, containers, etc.)
docker system prune -aDocker Installation Errors
# Ensure curl is available
sudo apt-get update && sudo apt-get install -y curl
# For macOS: Install Homebrew if not available
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Elasticsearch Won't Start
# Increase vm.max_map_count
echo 'vm.max_map_count=262144' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
# The startup script warns about this automaticallyUpload Errors
- Check file size (Max 50MB)
- Ensure storage directory is writable
- Check backend logs:
docker compose logs backend
Search Not Working
- Wait for Elasticsearch to fully start
- Check Elasticsearch status:
curl http://localhost:9200/_health - The startup script monitors this automatically
Docker Desktop on macOS
- The startup script starts Docker Desktop automatically
- If issues: Open Docker Desktop manually from Applications
Permission Errors
# Add user to docker group (Linux)
sudo usermod -aG docker $USER
# Then log out and log back inAuthentication Issues
- Verify JWT_SECRET is set in backend .env
- Check user credentials and role assignments
- Review backend logs for detailed error messages
- IMAP Sync Integration
- Automatic Email Classification (AI)
- Mobile App
- Advanced Analytics Dashboard
- Email Reply Integration
- Advanced Search Filters
- Bulk Operations
- Email Templates
- API Rate Limiting
- Multi-language Support
- Fork the repository
- Create a feature branch
- Implement your changes
- Test thoroughly
- Create a pull request
MIT License - see LICENSE file for details.
For issues and questions:
- Check the troubleshooting section
- Review the logs:
docker compose logs - Create an issue on GitHub
- Check the documentation in
AUTHENTICATION_SETUP.md
EmailArchiveOS - Your self-hosted email archiving solution with powerful search, user management, and comprehensive email processing capabilities.