Skip to main content
Streamly ships a premade Cloudflare Workers path using OpenNext and Wrangler. This runs the full app (operator admin + viewer storefront + APIs) — not CDN-only static hosting. Production reference: https://streamly.watch via pnpm run deploy:cloudflare.
The repo wrangler.jsonc is wired for streamly.watch (routes, KV ids, and often ENABLE_DEMO=true). Before your own production deploy, create your KV namespace, replace ids, change routes/vars to your domain, and turn off demo mode.

When to use this

Requirements

  • Node.js 20+, pnpm, Cloudflare account
  • Same secrets as a normal deploy (Environment Variables)
  • Cloudflare KV (incremental cache), queues; R2 optional when enabled on the account

1 — Install

Cloudflare-related files: wrangler.jsonc, open-next.config.ts, custom-worker.ts.

2 — Create Cloudflare resources (once)

Paste the returned id / preview_id into wrangler.jsonckv_namespaces binding NEXT_INC_CACHE_KV (replace the Streamly account values). Optional when R2 is available: create the cache/media buckets noted in product DEPLOYMENT.md, then re-enable R2 bindings.

3 — Personalize wrangler.jsonc

pnpm run deploy:cloudflare currently bakes https://streamly.watch public URLs in package.json scripts — for your domain, set those env vars in the shell before deploy or adjust the scripts:

4 — Secrets

Local Workers preview uses .dev.vars (from .dev.vars.example, includes NEXTJS_ENV=development) — never commit it.

5 — Deploy

What it runs: OpenNext Cloudflare build → worker minify → opennextjs-cloudflare deploy -- --minify. Preview:
Also available: pnpm run upload:cloudflare (build + upload without full deploy flow).

6 — Domains & SaaS

Attach your custom domain in Cloudflare → Workers & Pages → Domains & Routes. Optional Cloudflare for SaaS hostname automation:
  • CLOUDFLARE_ACCOUNT_ID
  • CLOUDFLARE_ZONE_ID
  • CLOUDFLARE_CUSTOM_HOSTNAMES_API_TOKEN
  • CLOUDFLARE_SAAS_FALLBACK_HOST (default customers.streamly.watch)

7 — After deploy

Do not rely on runtime fs reads for content under content/ on Workers. Legal markdown is imported at build time via lib/landing/legal-markdown.ts.

Troubleshooting