> ## Documentation Index
> Fetch the complete documentation index at: https://docs.streamly.watch/llms.txt
> Use this file to discover all available pages before exploring further.

# Cloudflare Workers

> OpenNext Cloudflare adapter notes for Streamly — wrangler personalization, KV, queues, minify, and Workers constraints.

## Deploy command

```bash theme={null}
pnpm run deploy:cloudflare
```

OpenNext build → minify worker → Wrangler deploy. Production reference host: `streamly.watch`.

## Key files

| File                  | Role                                                            |
| --------------------- | --------------------------------------------------------------- |
| `wrangler.jsonc`      | Worker name `streamly-platform`, routes, KV, queues, cron, vars |
| `open-next.config.ts` | OpenNext Cloudflare config                                      |
| `custom-worker.ts`    | Worker entry                                                    |

## Buyer personalization (required)

Shipped config targets Streamly’s account. Before your deploy:

1. Create KV namespace for binding `NEXT_INC_CACHE_KV` and replace `id` / `preview_id`.
2. Change `routes` / zone to your domain.
3. Set public URL vars for your host; set `ENABLE_DEMO` to false in production.
4. Put secrets with `wrangler secret put` (Supabase service role, encryption, cron, Envato, Resend, …).

Full steps: [Deploy Cloudflare](/getting-started/deploy-cloudflare).

## Bindings (typical)

* Images binding
* KV incremental cache (`NEXT_INC_CACHE_KV`) while R2 is optional/disabled
* Queues: `streamly-jobs` (+ dead letter)
* Hourly cron → internal jobs
* Durable Object queue support as configured

## Constraints

| Topic         | Guidance                                                         |
| ------------- | ---------------------------------------------------------------- |
| Bundle size   | Deploy script uses `--minify` for free-tier gzip limits          |
| Legal content | Bundle markdown — no runtime `fs`                                |
| Middleware    | Keep small; refresh via `/api/auth/refresh`                      |
| R2            | Product plugin + wrangler R2 may be disabled until account-ready |

## Related

* [Deploy Cloudflare](/getting-started/deploy-cloudflare)
* [Legal & Marketing](/viewer/legal-and-marketing)
* [Deployment FAQ](/faq/deployment-faq)
