Moving my homepage off the game's Worker
niceday-app.com is my homepage; slowbeads.niceday-app.com is my bead game, Slow Beads. For a while both domains pointed at the same Cloudflare Worker, which checked the hostname on every request: apex domain, render the homepage; anything else, run the game.
Why split them
With both domains on one Worker, fixing a typo on the homepage meant redeploying the entire game. The two aren't remotely the same size, either: after the split, a homepage deploy uploads about 35 KiB, while a game deploy uploads about 1,361 KiB. They ship on different schedules, and when something breaks, the blast radius is completely different.
What changed
The game side was all deletions: the apex domain came out of the routes in wrangler.jsonc, and every hostname check for the apex came out of the entry point.
- "routes": [
- { "pattern": "slowbeads.niceday-app.com", "custom_domain": true },
- { "pattern": "niceday-app.com", "custom_domain": true }
- ],
+ "routes": [{ "pattern": "slowbeads.niceday-app.com", "custom_domain": true }],
The homepage got a fresh repo and a fresh Worker bound only to niceday-app.com. The apex was still catching a few old paths that really belonged to the game (/ja, /ko, /zh, /home and the pattern pages), so the new Worker 301s them straight to the game subdomain, in one hop instead of two.
A guardrail in CI
The failure I worried about most after the split was someone (me) binding the wrong domain in a future config change. So both repos' CI now run a check before deploying: a script reads wrangler.jsonc and asserts that the routes contain exactly that repo's own domain. Anything else fails the build.
Two more rules came along with it. Pull requests only validate; wrangler deploy runs only on merges to main. And if the Cloudflare secrets are missing, the job fails loudly instead of quietly skipping the deploy.
Cutover order
Cloudflare won't let one custom domain sit on two Workers at once, so the real question was who lets go first and who grabs it.
My first plan kept both Workers in one repo: deploy the game Worker to release the apex, then deploy the homepage Worker to claim it. The commit message even admitted there might be a brief gap. When I moved the homepage into its own repo, I flipped the order:
- Merge the homepage PR so the new Worker is deployed and ready;
- Detach the apex domain from the old Worker and immediately attach it to the new one;
- Confirm the new Worker is actually answering on the apex;
- Only then merge the game PR, so its config no longer mentions the apex at all.
According to the CI logs, the two deploys landed less than two minutes apart: the homepage Worker finished at 06:20:10 UTC on 2026-11-12, the game Worker at 06:21:53 UTC.
One more lesson worth writing down: don't store a short-lived personal token as a long-lived CI secret.
Update, 2026-11-26: niceday-app.com now comes in Chinese, English, Japanese and Korean, so /ja and /ko are the Japanese and Korean homepages rather than redirects to the game. /zh, /home and the pattern pages still redirect as described above.