Quick start
One command deploys the whole stack — Worker, database, storage, DNS, and mail routing — to your own Cloudflare account.
bunx mailriz-cli@latest setupBefore you start
Section titled “Before you start”You need:
- A Cloudflare account with a domain already added as a zone. Mail arrives on that domain, so it has to be one you control.
- A Cloudflare API token. The wizard opens the right page and tells you which scopes to tick — see Cloudflare token if you want to prepare it first.
- Bun ≥ 1.1, or Node ≥ 18 if you run the CLI with
npxinstead.
What the wizard does
Section titled “What the wizard does”-
Pre-flight — checks wrangler, reachability, and your Bun version.
-
Token — you paste it; it is verified before anything is created.
-
Account and domain — pick which zone mail should arrive on.
-
Configuration — the dashboard hostname (default
inbox.yourdomain.com) and your admin email address. -
Auth — Cloudflare Access if your token allows it, otherwise a password you set here. See Authentication.
-
Provisioning, shown as a live task list:
Task What it creates releasedownloads the Worker bundle from GitHub Releases d1the mailrizdatabasemigrationsthe schema r2three buckets — raw mail, attachments, sanitised HTML accessthe Access application, if you chose it workerdeploys the Worker and attaches the custom domain email routingenables routing and points the catch-all at the Worker healthpolls /healthzuntil the domain answers
The last step waits for DNS and the certificate, which take a moment. That is expected, not a hang.
Saving the token
Section titled “Saving the token”At the end you are asked whether to save the token:
? Save this token so `update` and `destroy` don't ask again? › No / YesIt defaults to No. This token can delete your Worker, your database, and
every stored message, so it is never written to disk unless you say so. If you
save it, it goes to ~/.mailriz/config.json with mode 600.
If you decline, later commands read $CLOUDFLARE_API_TOKEN or ask you to paste
it again.
Open the dashboard at the hostname you chose, and send yourself a message at any address on your domain — you do not have to create an alias first.
# any of these work immediatelyecho "hi" | mail -s "test" anything@yourdomain.comIt should appear in the inbox within a few seconds, without a refresh.
If nothing arrives, see Troubleshooting.