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:
pnpm -C packages/backend deployIf you want automatic deployments in Cloudflare, connect the Worker to your Git repository with these settings from the README:
| Setting | Value |
|---|---|
| Root directory | packages/backend |
| Build command | Leave empty |
| Deploy command | pnpm run deploy |
| Non-production branch builds | Optional |
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.
| Setting | Value |
|---|---|
| Root directory | packages/frontend |
| Framework preset | None |
| Build command | pnpm run build |
| Output directory | dist |
Set the required frontend environment variables in Pages:
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.
| Topology | When to use it | Example values |
|---|---|---|
| Dedicated API domain | Default and recommended for production | VITE_API_BASE_URL=https://api.spinupmail.com, VITE_AUTH_BASE_URL=https://api.spinupmail.com/api/auth |
Same host with /api/* routing | Optional fallback when you intentionally want one public host | VITE_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.
- Open Cloudflare Email Routing for each inbound domain.
- Onboard the domain if needed.
- Create a catch-all routing rule.
- Set the action to send mail to your deployed Worker.
Repeat that rule for every domain listed in EMAIL_DOMAINS.

