configuration

Deploy and Routing

Deploy the backend Worker and frontend Pages app, then connect custom domains and email routing.

Spinupmail deploys as two Cloudflare applications: a Worker for the API and email handler, and a Pages project for the frontend. The README also treats routing as a separate step, which is the right mental model: deploying the code is not the same as wiring traffic to it.

Deploy the backend Worker

From the repository root, deploy the Worker with:

BashCLI command example
pnpm -C packages/backend deploy

If you want automatic deployments in Cloudflare, connect the Worker to your Git repository with these settings from the README:

SettingValue
Root directorypackages/backend
Build commandLeave empty
Deploy commandpnpm run deploy
Non-production branch buildsOptional

After the Worker is live, add a custom API domain in the Worker dashboard, for example api.spinupmail.com.

Deploy the frontend Pages project

Deploy the UI as a Cloudflare Pages project, not as a Worker.

SettingValue
Root directorypackages/frontend
Framework presetNone
Build commandpnpm run build
Output directorydist

Set the required frontend environment variables in Pages:

DotenvEnvironment variables
VITE_AUTH_BASE_URL=https://api.spinupmail.com/api/auth
VITE_API_BASE_URL=https://api.spinupmail.com
VITE_TURNSTILE_SITE_KEY=<site-key>

For local development, the same values usually point to http://localhost:8787 instead.

After the first Pages deploy succeeds, attach your frontend custom domain, such as app.spinupmail.com, from the Pages dashboard.

Choose your API routing topology

Spinupmail works best with a dedicated API hostname such as api.spinupmail.com. A same-host setup where the Worker handles /api/* is still possible, but it should be treated as a fallback.

TopologyWhen to use itExample values
Dedicated API domainDefault and recommended for productionVITE_API_BASE_URL=https://api.spinupmail.com, VITE_AUTH_BASE_URL=https://api.spinupmail.com/api/auth
Same host with /api/* routingOptional fallback when you intentionally want one public hostVITE_API_BASE_URL=/api, VITE_AUTH_BASE_URL=/api/auth

If you choose the same-host fallback, configure a route like your-domain.com/api/* to the Worker so the frontend can call the API with relative URLs.

Configure inbound email routing

Inbound email requires one extra Cloudflare dashboard step even after the Worker is deployed.

  1. Open Cloudflare Email Routing for each inbound domain.
  2. Onboard the domain if needed.
  3. Create a catch-all routing rule.
  4. Set the action to send mail to your deployed Worker.

Repeat that rule for every domain listed in EMAIL_DOMAINS.