Skip to main content

Self-Host Quickstart

Full email stack in a single Docker Compose. Your servers, your data, your rules. MIT licensed, free forever.

Prerequisites

RequirementDetails
ServerAny Linux VPS with Docker. 1 vCPU / 1GB RAM minimum, 2 vCPU / 2GB recommended.
DomainA domain or subdomain with an MX record pointing to your server's IP.
DockerDocker Engine 20.10+ and Docker Compose V2.
Port 25SMTP requires port 25 open. Some cloud providers block it — check your firewall.

Steps

1. Clone the repository

git clone https://github.com/edwin0x/flashmail
cd spawnmail

2. Configure environment

cp .env.example .env

Edit .env with your settings:

DOMAIN=mail.yourdomain.com
POSTGRES_PASSWORD=your-secure-password
API_SECRET_KEY=your-api-secret

3. Start the stack

docker compose up -d
→ spawnmail-api    running on :8000
→ spawnmail-smtp running on :25
→ spawnmail-db running on :5432

Verify it's running:

curl http://localhost:8000/health
# → { "status": "ok" }

4. Create your first API key

docker exec spawnmail-api \
spawnmail-admin create-key --name "my-agent"
# → fm_live_abc123...def456

Test it:

curl -H "x-api-key: fm_live_abc123...def456" \
http://localhost:8000/me
# → { "email": "admin", "inboxes_count": 0 }

When to Self-Host vs. Cloud

Self-host when...Use cloud when...
Data residency is a hard requirementYou need custom domains with managed DNS
You need air-gapped or VPN-only accessDedicated IPs and email reputation matter
You want zero recurring costsYou want SSO/SAML and SLA guarantees
Your team can manage Docker and DNSYour team should ship agents, not infra
You want to customize the codebaseYou want priority support and managed updates