Skip to main content
Version: 2.0 PartyKit

Deployment

The production stack runs entirely on Cloudflare's free tier. No servers to manage.

Services​

ServicePlatformDeploy command
FrontendCloudflare Pages (front/)Git push β†’ auto-deploy
BackendPartyKit (Cloudflare Workers)npx partykit deploy
DocsCloudflare Pages (docs-site/)Git push β†’ auto-deploy
Proxy WorkerCloudflare WorkersDeploy 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 login to authenticate with your Cloudflare account.

Step 2 β€” Create Cloudflare KV namespace​

In the Cloudflare dashboard:

  1. Workers & Pages β†’ KV β†’ Create namespace
  2. Name: SOMMELIER_HOSTS
  3. Copy the namespace ID
  4. Update partykit.json:
    { "binding": "HOSTS_KV", "id": "YOUR_KV_NAMESPACE_ID" }
  5. Re-deploy PartyKit

Step 3 β€” Frontend on Cloudflare Pages​

  1. Workers & Pages β†’ Create application β†’ Pages β†’ Connect to Git
  2. Select repository, branch: cloudflare-migration
  3. Build settings:
    • Root directory: front
    • Build command: npm run build
    • Output directory: dist
  4. Environment variables:
    • PUBLIC_PARTYKIT_HOST = sommelier-arena.USERNAME.partykit.dev
  5. 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​

  1. 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:

  1. 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
    • Save. The route is applied immediately.
  2. Set the DOCS_ORIGIN environment variable (one-time):

    • Dashboard β†’ Workers β†’ select sommelier-arena-proxy β†’ Settings β†’ Variables & Bindings β†’ Add:
      • Name: DOCS_ORIGIN
      • Value: https://sommelier-arena.ducatillon.net
    • Save.

Verification

Notes and CI recommendation:

  • DOCS_ORIGIN must match the Pages project you deployed in Step 4. The Pages default domain is https://<project-name>.pages.dev once created and deployed.
  • Recommended: do not hard-code DOCS_ORIGIN in proxy-worker/index.ts. Instead capture the Pages URL in CI after docs deploy and publish the worker with DOCS_ORIGIN injected (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_ORIGIN via the Dashboard (Worker settings β†’ Variables & Bindings) or by editing proxy-worker/index.ts then running npx 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.