Deployment
The production stack runs entirely on Cloudflare's free tier. No servers to manage.
Servicesβ
| Service | Platform | Deploy command |
|---|---|---|
| Frontend | Cloudflare Pages (front/) | Git push β auto-deploy |
| Backend | PartyKit (Cloudflare Workers) | npx partykit deploy |
| Docs | Cloudflare Pages (docs-site/) | Git push β auto-deploy |
| Proxy Worker | Cloudflare Workers | Deploy via Wrangler (see below) |
Step 1 β PartyKit deployβ
# From repo root
npx partykit deploy
This deploys back/game.ts as a Durable Object class to sommelier-arena.USERNAME.partykit.dev.
First time:
npx partykit loginto authenticate with your Cloudflare account.
Step 2 β Create Cloudflare KV namespaceβ
In the Cloudflare dashboard:
- Workers & Pages β KV β Create namespace
- Name:
SOMMELIER_HOSTS - Copy the namespace ID
- Update
partykit.json:{ "binding": "HOSTS_KV", "id": "YOUR_KV_NAMESPACE_ID" } - Re-deploy PartyKit
Step 3 β Frontend on Cloudflare Pagesβ
- Workers & Pages β Create application β Pages β Connect to Git
- Select repository, branch:
cloudflare-migration - Build settings:
- Root directory:
front - Build command:
npm run build - Output directory:
dist
- Root directory:
- Environment variables:
PUBLIC_PARTYKIT_HOST=sommelier-arena.USERNAME.partykit.dev
- Deploy
Step 4 β Docs on Cloudflare Pagesβ
Same as Step 3 but:
- Root directory:
docs-site - Build command:
npm run build - Output directory:
build - Project name:
sommelier-arena-docs
Step 5 β Custom domainβ
In Cloudflare Pages β your front project β Custom domains β Add domain β sommelier-arena.ducatillon.net
Step 6 β Proxy Worker for /docs routeβ
- Workers & Pages β Create Worker
Wrangler (required for TypeScript / reproducible builds)
- The Cloudflare Dashboard editor cannot build or publish TypeScript worker projects. To publish the repo's TypeScript worker (
proxy-worker/index.ts) use Wrangler.
Recommended (wrangler.toml + deploy):
Create a simple wrangler.toml at the repo root:
name = "sommelier-arena-proxy"
main = "proxy-worker/index.ts"
compatibility_date = "2026-03-24"
Then publish from the repo root:
npx wrangler whoami # verify auth
# Example deploy with DOCS_ORIGIN set (replace URL with your pages.dev domain):
npx wrangler deploy --var DOCS_ORIGIN=https://sommelier-arena.ducatillon.net
Notes:
- Wrangler will compile TypeScript and bundle dependencies.
- If you insist on using the Dashboard editor, compile/bundle the worker to plain JS locally and paste the compiled JS into the Dashboard editor (not recommended).
After the worker exists:
-
Create the route (Dashboard):
- Cloudflare Dashboard β Workers & Pages β Workers β open
sommelier-arena-proxyβ Triggers β Add route:- Route:
sommelier-arena.ducatillon.net/docs* - Zone:
ducatillon.net
- Route:
- Save. The route is applied immediately.
- Cloudflare Dashboard β Workers & Pages β Workers β open
-
Set the
DOCS_ORIGINenvironment variable (one-time):- Dashboard β Workers β select
sommelier-arena-proxyβ Settings β Variables & Bindings β Add:- Name:
DOCS_ORIGIN - Value:
https://sommelier-arena.ducatillon.net
- Name:
- Save.
- Dashboard β Workers β select
Verification
- Open https://sommelier-arena.ducatillon.net/docs and confirm the docs site loads.
Notes and CI recommendation:
DOCS_ORIGINmust match the Pages project you deployed in Step 4. The Pages default domain ishttps://<project-name>.pages.devonce created and deployed.- Recommended: do not hard-code
DOCS_ORIGINinproxy-worker/index.ts. Instead capture the Pages URL in CI after docs deploy and publish the worker withDOCS_ORIGINinjected (or set as a worker environment variable). This makes deployments reproducible and avoids manual edits. - Manual quick fix: deploy the docs Pages project, copy the pages.dev URL, then publish the worker and set
DOCS_ORIGINvia the Dashboard (Worker settings β Variables & Bindings) or by editingproxy-worker/index.tsthen runningnpx wrangler deploy.
The proxy worker also routes /docs/* to the Docusaurus Pages project, keeping everything under one domain. See Proxy Worker for full details.
See Cloudflare Setup for a step-by-step dashboard walkthrough with UI labels.
Rollbackβ
Cloudflare Pages keeps deployment history. Roll back via dashboard β Deployments β select older deployment β Rollback to this deployment.
For PartyKit, there is no built-in rollback β redeploy the previous git commit.