Sticky monorepo for weekday tech demos on Cloudflare Workers Paid ($5).
- No Workers for Platforms — dispatch namespaces are not on this plan.
apps/hub— gallery Worker with a Dynamic Worker Loader (LOADER). It serves the index UI and, for loader demos, bundles the module as text, starts an isolate on first request, and reuses it while it stays warm.demos/<slug>— self-contained demo source. New demos land here via PR.tracking/seen.json— scout dedupe (proposed / built / skipped).- Workers Builds — connect
apps/hubto this repo; push/merge tomaindeploys the hub.
There are two kinds of demo. The registry marks each as kind: "loader" or kind: "standalone".
A single worker.js with no bindings. The hub imports that file as a Text module and LOADER.get()s it. hello-dynamic is the example. Loader demos are GET/HEAD only: any other method returns 405 before LOADER.get.
The loader id is a hash of the source plus the compatibility date, so a source change is a new Dynamic Worker. Cookie and Authorization headers are stripped before the request is forwarded. The inbound body is not forwarded. Every Dynamic Worker response is wrapped with Content-Security-Policy: sandbox … and X-Content-Type-Options: nosniff.
A demo with Durable Objects, D1, R2, or any other binding ships as its own Worker. Its wrangler.jsonc must declare both routes:
tech-demos.theserverless.dev/demos/<slug>*<slug>.tech-demos.theserverless.dev/*
and register a fallback in apps/hub/src/registry.ts via redirectSource(slug, origin). The fallback only runs if the zone route is missing. Non-GET/HEAD on a fallback path returns 405 before LOADER.get, same as a loader demo. If the hub instead receives the request on the demo subdomain, it returns 503 demo Worker not deployed rather than redirecting to itself.
Zone routes win over the custom domain. The hub's tech-demos.theserverless.dev custom domain never sees /demos/<slug>* while the standalone Worker's zone route is in place.
bun install
bun run dev # hub at http://127.0.0.1:8787
bun test # hub + shared + demo helpers (hello-dynamic is a second bun test run)
bun run deploy # wrangler deploy hub (owner only)- Copy
demos/hello-dynamic→demos/<kebab-slug> - Implement a single
worker.js(no TypeScript, no bindings) - Register it in
apps/hub/src/registry.tswithkind: "loader"andimport source from "…/worker.js" with { type: "text" }. Hubtscalready accepts*/worker.jsas a Text module. - Add
demos/<kebab-slug>/worker.test.tsand a secondbun test demos/<kebab-slug>run in the roottestscript (hello-dynamic stays a separate bun test process) - Open a PR (screenshot + video of the running demo)
- Copy
demos/_template→demos/<kebab-slug>(or an existing standalone demo) - Add
wrangler.jsoncwith both routes:/demos/<slug>*and<slug>.tech-demos.theserverless.dev/* - Register a
redirectSource(slug, origin)fallback inapps/hub/src/registry.tswithkind: "standalone" - Open a PR (screenshot + video of the running demo)
- If the demo calls Turnstile, reuse the shared widget. Do not create one. See docs/turnstile.md.
Remember: zone routes win over the hub custom domain. Do not expect the hub loader to serve a standalone demo while those routes exist.
Cloudflare, AI, agents, RAG, distributed systems, self-hosting.