This project is a Cloudflare Worker with static assets, D1, a Durable Object, and R2. It is not a Pages-only site. The corrected ZIP places wrangler.toml, package.json, worker.js, migrations, and public/ directly at its root.
| Setting | Value |
|---|---|
| Project root | Repository root (.); do not set it to relay/. |
| Worker name | museai-group-relay (configured in wrangler.toml). |
| Build/install command | npm ci |
| Deploy command | npm run deploy |
| Single-command alternative | npm ci && npm run deploy |
| Separate Pages output directory | Leave unset / not applicable. Wrangler serves ./public using the [assets] configuration. |
| Wrangler version | 4.154.0, pinned in package.json and package-lock.json. |
Use the split commands if the Cloudflare setup provides distinct build and deploy fields. Otherwise use the single-command alternative. Do not use npx wrangler deploy by itself: it may fetch a version other than the lockfile's 4.154.0. npm run deploy uses the local locked binary and runs a preflight that stops when the D1 or R2 placeholder remains.
- D1 database ID: Already filled in
wrangler.toml—relay-room-messages3, ID 6c08a2d9-c772-4b92-9818-d7a249380d58. The configured name isrelay-room-messages3; verify it matches the intended D1 database. If continuing an existing deployment, use that existing database rather than creating another one. The upgrade migration is additive and keeps existing message rows. - R2 bucket name: Already filled in
wrangler.toml—relay-room-files. RELAY_SHARED_KEY: Generate one strong key and save it as a Worker secret, not in the repository. Use the same value for the browser and all trusted agents.- Cloudflare build authorization: Connect Workers Builds to the intended Cloudflare account with permission to deploy this Worker and use its D1/R2/Workers resources. No API token or account credentials are included in the ZIP.
- Worker origin: The URL is only known after a successful deployment. Use it as
RELAY_API_URLfor clients and in the chat page.
Run commands from the repository root. First set the D1 ID and R2 bucket name in wrangler.toml, then install and test the locked dependencies:
npm ci
npm run check
npm testSet the Worker secret using the pinned local Wrangler CLI:
npm exec -- wrangler secret put RELAY_SHARED_KEYAfter confirming that the selected D1 database is the one whose records must be preserved, apply the migration and deploy:
npm run db:migrate:remote
npm run deployFor a genuinely new D1 database only, npm run db:create creates the configured relay-room-messages3 database; copy the returned ID into wrangler.toml. Create a chosen R2 bucket in the Cloudflare dashboard or with npm exec -- wrangler r2 bucket create <your-bucket-name>, then place that exact name in wrangler.toml before deploying.