MailDocs

Operations

Deploy

Migrations, secrets and going live.

Production

The D1 database and R2 bucket already exist (their IDs are in wrangler.jsonc). CLOUDFLARE_API_TOKEN needs the permissions listed on /setup (Zone Read, Zone Settings Edit, Email Routing Rules Edit, DNS Edit, Email Sending Edit, Workers Routes Edit, Email Routing Addresses Edit). Deploying serves mail.appneurox.com.

Terminal
npx wrangler secret put EDIT_PASSCODE
npx wrangler secret put CLOUDFLARE_API_TOKEN
npm run db:migrate:remote
npm run deploy

Then open /setup, set the default forward address (it must be a verified Email Routing destination), and set up mail servers from /domains.

Deploy from your machine

Important

The wrangler login sees several Cloudflare accounts. Set CLOUDFLARE_ACCOUNT_ID to the APPNEURAL account in your shell first, or Wrangler stops to ask.

Terminal
npm install
npm run db:migrate:remote
npm run deploy

Set the secrets once (they stay across deploys):

Terminal
npx wrangler secret put EDIT_PASSCODE

Database migrations

Applied in order from migrations/:

# Migration
0001 create mail
0002 seed account domains
0003 mail server

Check that it is live

Terminal
curl https://mail.appneurox.com/health

It answers {"status":"ok"} when the Worker and its database are up.

Last updated 2 November 2026