Prerequisites
#prerequisitesInbox is a standalone Cloudflare Worker — it does not require the main EmailFlare Docker stack. You only need:
- A Cloudflare account on a paid plan (Workers Paid, $5/month) — required for Queues and Durable Objects.
- A domain on Cloudflare with Email Routing enabled.
- A Cloudflare API token with Email Routing (Edit), DNS (Edit), and Zone (Read) permissions. See the CF Token guide →
- Node.js 18+ and pnpm installed locally.
- The emailflare repo cloned:
git clone https://github.com/0xdps/emailflare
emailflare D1 database as the main worker. If you already have the main worker deployed, the inbox deploy script will detect and reuse the existing database.Step-by-step setup
#setupjust install. This installs all workspace packages including the inbox Worker and dashboard.cp scripts/config.example.toml scripts/config.toml. Fill in [deploy] (your CF API token + account ID) and the [inbox] VAPID keys. All fields are optional — any blank value will be prompted interactively.npx web-push generate-vapid-keys and copy the public and private keys into config.toml under [inbox].just deploy-inbox. The script creates all Cloudflare resources (D1, KV, R2, Queue), applies D1 migrations, sets all secrets, builds the dashboard SPA, and deploys the Worker.https://<your-worker>.workers.dev/setup (or your custom domain). Fill in admin name, email, and password. This endpoint is disabled after the first account is created.support@yourdomain.com). Note the generated inbox address — you'll use it in the Email Routing rule.Cloudflare Email Routing
#email-routingInbox receives mail by registering the Worker as an Email Routing worker. You need to do this in the Cloudflare dashboard for each domain you want to receive mail on.
Add the routing rule
emailflare-inbox from the worker list.support@yourdomain.com) or use a catch-all rule to capture all mail to the domain.to header of the incoming email. Make sure the address matches one of your configured inboxes in the dashboard, or it will be filed under a default inbox.Email Routing DNS records
Cloudflare automatically adds the required MX records when you enable Email Routing for a domain. If they're missing, visit Email → Email Routing → Overview and click Enable Email Routing. No manual DNS changes are needed.
config.toml reference
#configCopy scripts/config.example.toml to scripts/config.toml. Any blank value causes the deploy script to prompt interactively. The file is git-ignored.
Secrets reference
#secretsAll secrets are set as Cloudflare Worker secrets via wrangler secret put. The deploy script handles this automatically; use just inbox-secret SECRET_NAME to update a single secret later.
| Secret | Required | Description |
|---|---|---|
SESSION_SECRET | required | 32+ character random string used to sign session JWTs. Generate with openssl rand -hex 32. |
CF_API_TOKEN | required | Cloudflare API token used at runtime for Email Sending (outbound replies). Needs Email Routing (Edit), Zone (Read), DNS (Edit). |
CF_ACCOUNT_ID | required | Your Cloudflare account ID. Used for Email Sending API calls. |
VAPID_PUBLIC_KEY | required | VAPID public key for Web Push. Generate with npx web-push generate-vapid-keys. Also stored in wrangler.jsonc as VAPID_PUBLIC_KEY var (served to the frontend). |
VAPID_PRIVATE_KEY | required | VAPID private key. Never exposed to the frontend. Keep this secret. |
Updating a secret
Inbox API
#apiThe inbox Worker exposes both a session-authenticated API (used by the dashboard) and an API-key-authenticated API (for programmatic access). All endpoints are prefixed with /api.
Authentication
Dashboard endpoints use a session cookie set on POST /api/auth/login. Programmatic endpoints accept a bearer token:
Auth endpoints
People (contacts)
?search= and ?unread=true filters.{ from, subject, text, replyToMessageId? }Inboxes
{ name, address }Sequences
{ name, steps: [{subject, body, delayHours}] }{ personId, from }Users & invites
{ role: "admin" | "member" }CF_API_TOKEN secret must have Email Routing (Edit) permission.Upgrading
#upgradingPull the latest code and re-deploy. The inbox-update just recipe runs migrations before deploying so schema changes are applied atomically.
What just inbox-update does
- Runs
wrangler d1 migrations apply emailflare --remote— applies any pending SQL migrations to the live database. - Rebuilds the inbox UI SPA (
pnpm buildinservices/inbox-ui). - Runs
wrangler deployfromservices/inbox-worker— uploads new Worker code with the rebuilt assets.
just inbox-update at any time without risk of data loss.