Documentation navigation

Deploy MarkRelay to Cloudflare

Deploying MarkRelay into your Cloudflare account is automated and fast. Use Cloudflare's One-Click Deploy button or standard Wrangler commands to launch a private, multi-domain email platform in minutes.

Option A: One-Click Cloudflare Deploy (Recommended)

Click the Deploy to Cloudflare button in your MarkRelay customer portal. Cloudflare will automatically fork/bind the worker, provision your D1 database and R2 storage bucket, and deploy the application straight to your edge environment.

Option B: Command Line Deployment

If you prefer manual deployment from your local machine, extract your licensed package and run:

# 1. Log in to your Cloudflare account
npx wrangler login

# 2. Create the D1 database and R2 bucket for mail storage
npx wrangler d1 create markrelay
npx wrangler r2 bucket create markrelay

# 3. Set your secret key (generate with: openssl rand -base64 32)
pnpm run cf:secret BETTER_AUTH_SECRET

# 4. Apply remote database migrations to D1
pnpm run db:migrate:remote

# 5. Build and deploy to Cloudflare Workers
pnpm run cf:deploy

Cloudflare Email Routing & DNS setup

To allow MarkRelay to receive and send emails under your domain, configure your Cloudflare Email Routing:

  1. Open your domain in the Cloudflare Dashboard → Email → Email Routing.
  2. Enable Email Routing and let Cloudflare add the required MX and SPF records automatically.
  3. Add a Catch-all rule or specific address rules pointing the target address to your deployed MarkRelay Worker.
  4. Set up DKIM and DMARC records for optimal inbox deliverability.

Launch check

  • Open https://mail.yourdomain.com/setup to create your initial admin account.
  • Send an external message to your first mailbox and open it in Webmail.
  • Reply from MarkRelay and confirm it arrives in the external inbox.
  • Create a scoped API key and test calling GET /openapi/v1/mailboxes.
  • Send a broadcast test before scheduling a real audience.
Cloudflare usage and domain registration are billed through Cloudflare. MarkRelay itself adds no per-message charges or recurring subscription fees.

Next, follow Initial setup or use the Production checklist before launch.