Getting Started Guide
Step-by-step setup, local development, domain provisioning, and webmail SSO.
Getting Started with mailwart
This guide walks you through setting up mailwart from scratch, configuring your email server credentials, provisioning your first domain, creating user mailboxes, and launching Roundcube Webmail with zero-password single sign-on.
1. Prerequisites
Before running mailwart, ensure your host environment meets the following requirements:
| Component | Minimum Version | Notes |
|---|---|---|
| Node.js | >= 20.x (Recommended: 22 LTS) | Required for local development. |
| npm / pnpm | >= 10.x | Package manager. |
| Docker & Docker Compose | >= 24.x / Compose v2 | Required for containerized deployment. |
| Stalwart Mail Server | >= 0.16.x | Running in cluster or reachable via HTTPS. |
| PostgreSQL | >= 15.x (Included in Compose) | Database store for users, RBAC, and audit logs. |
2. Quick Local Development Setup
To explore mailwart on your local machine:
Step 1: Clone the Repository
git clone https://github.com/zzokm/mailwart.git
cd mailwartStep 2: Install Dependencies
npm installStep 3: Configure Environment
Copy the example environment template:
cp .env.example .env.localFor immediate local exploration, you can run mailwart in Mock Mode without configuring live Stalwart or PostgreSQL credentials. If you have live credentials, populate .env.local:
# Required for live console authentication
APP_ADMIN_USER=yehia
APP_ADMIN_PASSWORD=YourSecurePassword123!
SESSION_SECRET=make_sure_this_is_at_least_32_random_characters_long
# Stalwart JMAP Connection
STALWART_JMAP_URL=https://mail.example.com/jmap
[email protected]
STALWART_ADMIN_PASSWORD=YourStalwartAdminPassword
# Roundcube Webmail SSO
ROUNDCUBE_URL=https://mail.example.com/webmail/
WEBMAIL_SSO_SECRET=another_random_32_character_secret_keyStep 4: Start Development Server
npm run devOpen http://localhost:3000 in your browser. You will be greeted by the public landing page.
3. Provisioning Your First Domain
Once signed in to /dashboard:
- Navigate to Domains in the left sidebar or press
/dashboard/domains. - Click Add Domain (
+). - Enter the fully qualified domain name (e.g.
example.com). - (Optional) Add a description for internal documentation.
- (Optional) If you have linked a Cloudflare API token, toggle Auto-provision DNS records to immediately publish MX, SPF, DKIM, and DMARC records to your zone.
- Click Create Domain.
The domain is registered immediately in Stalwart's directory via JMAP and synchronized to the local PostgreSQL database.
4. Creating Mailboxes & Managing Quotas
With your domain active:
- Click Mailboxes in the sidebar.
- Click Create Mailbox.
- Select your managed domain from the dropdown.
- Enter the local-part (e.g.,
hellofor[email protected]). - Generate a secure random password using the built-in generator, or type a custom password.
- (Optional) Set a storage quota in Megabytes or Gigabytes (e.g.,
2048for 2 GB). - Click Create Mailbox.
- Copy the generated credentials. Mailwart never stores plaintext mailbox passwords in the database.
5. Setting Up Zero-Password Webmail SSO
Mailwart integrates directly with Roundcube via the custom em_sso plugin:
- On the Mailboxes page, find your created account.
- Click the Webmail action button.
- Mailwart mints an HMAC SHA-256 token and redirects your browser to Roundcube.
- Roundcube verifies the signature, authenticates with Stalwart via master impersonation (
user%impersonator), and opens the inbox without prompting for credentials.
6. Automating DNS with Cloudflare
To eliminate manual DNS record entry:
- Open Settings (
/dashboard/settings) and switch to the DNS Automation tab. - Click Add Cloudflare Account.
- Provide an API token with
Zone:DNS:Editpermissions across your zones. - Mailwart scans and pools all available zones.
- In Domains → [Domain Detail], click Provision to Cloudflare to automatically deploy:
MXrecords pointing tomail.<domain>(Priority: 10)Arecord pointing to the server's public IPTXTrecord with compliant SPF mechanismsTXTrecord with 2048-bit DKIM public keyTXTrecord with RFC 7489 DMARC policyCNAMErecord forwebmail.<domain>
7. Running Deliverability Audits
Verify that outgoing emails will not land in spam:
- Navigate to Settings → Deliverability.
- Click Run Health Checkup.
- The 10-point inspection engine tests:
- SPF, DKIM, and DMARC validity.
- Forward-Confirmed Reverse DNS (FCrDNS / PTR).
- SSL/TLS handshakes on ports 993, 465, and 587.
- Public IP presence across Spamhaus, Barracuda, and SpamCop blacklists.
- Clean SMTP 220 banner response.
- Review your overall deliverability score (target:
10 / 10).
8. Navigating the Documentation
Use the navigation sidebar to explore deeper topics:
- System Architecture: Network boundaries, Docker topology, and container ingress.
- Pages & UX Workflows: Complete breakdown of every screen and modal.
- Roundcube Webmail SSO: Cryptographic token architecture and impersonation security.
- HTTP API Reference: Endpoint parameters, responses, and authentication.
- Server Actions Catalog: Technical reference for all 80+ server actions.
- Stalwart JMAP Integration: Directory schemas and method calls.
- AI Copilot & Tool Registry: 10 LLM providers and 48 administrative tools.
- Database & Security: PostgreSQL schema, RBAC, and Dokploy deployment.