How aapanel/billionmail works
Project type and purpose
• BillionMail is a full-stack, self-hosted email server and email-marketing platform.
• It provides:
• A Vue.js SPA frontend for management and campaign building
• A Go-based REST API backend for business logic (contact management, campaigns, SMTP relays, analytics)
• Traditional mailserver components (Postfix, Dovecot, Rspamd) running in containers
• Data storage (SQL database), caching/queuing (Redis), and auxiliary services (ACME for SSL, fail2ban, supervisord)
File structure
• Top-level “Dockerfiles/” holds container definitions for core app and mailserver components.
• “core/” directory contains the Go monolith:
• cmd & main.go – entry point
• api/v1 controllers – HTTP handlers
• internal/service, logic, dao, model – layered business logic
• “core/frontend/” is a Vue 3 + TypeScript SPA, built and served as static assets.
• “manifest/” holds kustomize/Kubernetes and Docker Compose deployment manifests.
• “conf/” holds runtime configs for Postfix, Dovecot, Rspamd, PHP-FPM (RoundCube), fail2ban.
• “env_init” / “.env” is for Docker Compose environment variables.
Key insights from README
• It’s intended to deploy via Docker Compose or k8s.
• Core services include RESTful API, ACME integration, database initialization, scheduled tasks (timers).
• Frontend SPA communicates over Axios with core API.
• RoundCube WebMail is integrated behind /roundcube/ via PHP-FPM container.
Relationships and data flow
1. User opens browser → loads Vue SPA → issues API calls
2. Vue → HTTP → Go API
3. Go API
– reads/writes to SQL DB
– interacts with Redis for caching, job control (e.g., batch mailing, warm-up)
– controls Docker API for dynamic container management (via core/api/dockerapi)
– invokes ACME service for SSL on user domains
– triggers mail tasks: enqueues send jobs
4. Mail tasks → Go service → hands off to Postfix via SMTP or direct send
5. Outbound mail passes through Rspamd (milter) → Postfix → recipient MTA
6. Inbound mail (for WebMail) → Dovecot → delivered to mailbox → accessible via RoundCube
7. fail2ban monitors logs and updates iptables to block suspicious traffic
Architectural patterns & principles
• Layered monolith (controller-service-dao-model) in Go
• Containerized micro-services for mailserver components
• Event/task queue using Redis for asynchronous batch mail, warm-up, analytics
• Plugin-style Sieve filters and periodic / timer jobs
• Configuration-as-code: Dockerfiles + supervisord + k8s manifests
Essential details to capture
• Docker Compose / k8s as the orchestration boundary.
• Supervisord controlling each container’s processes.
• ACME self-signed vs. production SSL path.