BillionMail gives you open-source MailServer, NewsLetter, Email Marketing โ fully self-hosted, dev-friendly, and free from monthly fees. Join the discord:
# BillionMail
Open-source email marketing platform & mail server. Handles bulk sending, campaigns, contact management, warmup, and analytics.
## Project Structure
```
core/
โโโ internal/
โ โโโ cmd/ # CLI entry points
โ โโโ controller/ # HTTP handlers (16+ domains)
โ โโโ service/ # Business logic (batch_mail, domains, rbac, maillog_stat, warmup, contact, etc.)
โ โโโ dao/ # Data access layer
โ โโโ model/entity/ # ORM entities
โ โโโ consts/ # Constants
โโโ api/ # API route definitions
โโโ frontend/src/
โ โโโ views/ # Page components
โ โโโ components/ # Reusable UI components
โ โโโ store/ # Pinia store modules
โ โโโ api/modules/ # API client modules
โ โโโ router/ # Vue Router + module routes
โ โโโ hooks/ # Composables
โ โโโ utils/ # Utilities (base, data, time, storage)
โ โโโ features/ # Feature-specific components (EmailEditor)
โ โโโ i18n/ # Internationalization (en, zh, ja)
โโโ template/ # Email templates
โโโ manifest/ # Config/deployment
conf/ # Mail service configs (postfix, dovecot, rspamd, redis)
Dockerfiles/ # Container definitions
```
## Stack
- **Backend:** Go 1.22, GoFrame v2, PostgreSQL, Redis
- **Frontend:** Vue 3, TypeScript, Pinia, Naive UI, Vitest, pnpm
- **Mail:** Postfix, Dovecot, Rspamd
- **Deploy:** Docker Compose
## Organization Rules
- Controllers โ `core/internal/controller/`, one dir per domain
- Services โ `core/internal/service/`, one dir per domain
- API routes โ `core/api/`, one dir per domain
- Frontend views โ `core/frontend/src/views/`, one dir per feature
- Tests โ next to source files (`*_test.go`, `*.test.ts`)
- Single responsibility per file, descriptive names
## Code Quality
After editing ANY file, run:
```bash
# Go
cd core && go vet ./... && gofmt -l .
# Frontend
cd core/frontend && pnpm run lint
```
Fix ALL errors before continuing.
## Testing
```bash
# Go (short mode, no DB required)
cd core && go test -count=1 -short ./internal/service/...
# Frontend
cd core/frontend && pnpm test
# Both
cd core && go test -count=1 -short ./internal/service/... && cd frontend && pnpm test
```
## Bug Memory Rules
- NEVER use bare domain for mail infrastructure (DNS, certs, DKIM, dedicated IPs). Always use `public.FormatMX(domain)` to get the mail hostname (e.g., `mail.example.com`).
- When adding new controllers, add the module name to the RBAC `modules` list in `core/internal/service/middlewares/rbac.go`.
## Commands
- `/test` - Run full test suite
- `/fix` - Lint + typecheck + auto-fix with parallel agents
- `/commit` - Quality checks + AI commit + push
- `/update-app` - Update deps + fix deprecations