Dashboard deploy
Do not put secrets in GitHub. Fill private values in Cloudflare Settings.
Accounts
- Sign up for Cloudflare and GitHub
- Fork Xi-Mail
- Prepare an admin email (an external inbox is fine)
- Prepare two different random secrets, at least 32 characters each, for
jwt_secretandinit_secret

You can deploy first and add a receiving domain later.
Create the project
- Cloudflare → Compute → Workers & Pages → Create → Create application
- Connect to Git → Continue with GitHub, then pick your fork
- Set the Worker name to
xi-mail - Leave Path, Build command, and Deploy command unchanged. The root
wrangler.tomlalready defines the build - Click Deploy and wait

If xi-mail already exists on this account, do not create another one. See Updates.
Runtime variables
Open xi-mail → Settings → Variables and Secrets and add:
| Type | Name | Value |
|---|---|---|
| Text | admin | The full admin email you will register |
| Secret | jwt_secret | First random secret |
| Secret | init_secret | Second, different secret |
Save and deploy. admin only marks the administrator; you still need to register with that address.

Do not put these in Build variables. For authenticator 2FA later, add Secret two_factor_key.
Bindings
The root wrangler.toml creates D1 and KV. On the same Settings page confirm:
| Type | Variable | Resource |
|---|---|---|
| D1 | db | xi-mail-db |
| KV | kv | xi-mail-kv |
Keep the names db and kv.
Custom URL: Settings → Domains & Routes → Add → Custom domain.
Initialize
Open:
https://your-site/api/init/your-init_secretWhen you see success, open the site and register with the admin email.

The init URL contains a secret. If it returns 404, check that init_secret is on the live version and is at least 32 characters.
Receiving mail
- Xi-Mail → Settings → Domains, add and enable a suffix
- Cloudflare → Email Service → Email Routing, enable the domain and add MX / TXT
- Routing rules → Catch-all: change Drop to Send to a Worker, target
xi-mail



A site hostname is not a mailbox suffix: binding mail.example.com does not receive mail for example.com.
After routing is connected, create a mailbox. The admin login is not a hosted inbox; add an address in the left list before mail can arrive.
Optional
| Feature | Where |
|---|---|
| OAuth login | Admin OAuth settings |
| R2 / S3 attachments | Bind r2, or fill S3 in the admin UI |
| Cloudflare Email sending | Bind Send Email as EMAIL, then enable it per domain |
| Sub-worker | End of CLI, or Sub-worker |