| 1 | # Cloudflare Website: Waku |
| 2 | |
| 3 | Deploys a [Waku](https://waku.gg) app to Cloudflare Workers with `Cloudflare.Website.Waku` — no `waku.config.ts`, no Wrangler. |
| 4 | |
| 5 | The resource builds the app with waku's own Vite pipeline and a wrangler-free in-memory Cloudflare adapter: the RSC server bundle deploys as the Worker script, and the client output (including SSG-prerendered pages and the RSC payloads) deploys as Worker static assets. Values passed via `env` are readable in server components through waku's `getEnv`. |
| 6 | |
| 7 | ```ts |
| 8 | const site = yield* Cloudflare.Website.Waku("WakuSite", { |
| 9 | compatibility: { |
| 10 | flags: ["nodejs_als"], // waku's server runtime needs AsyncLocalStorage |
| 11 | }, |
| 12 | env: { |
| 13 | GREETING: "Hello from Waku on Cloudflare!", |
| 14 | }, |
| 15 | }); |
| 16 | ``` |
| 17 | |
| 18 | ## Commands |
| 19 | |
| 20 | ```sh |
| 21 | bun alchemy deploy # build + deploy |
| 22 | bun alchemy dev # waku's Vite dev server (rsc environment runs in workerd, HMR) |
| 23 | bun alchemy destroy # tear down |
| 24 | ``` |
| 25 | |
| 26 | ## Notes |
| 27 | |
| 28 | - `@alchemy.run/frontend-frameworks` must be installed in the project — the Worker's source provider is loaded from its `/waku` export at deploy time. |
| 29 | - Unchanged projects skip the build and deploy entirely (the project tree is content-hashed, respecting `.gitignore`). |
| 30 | - Waku's SSG step renders static pages in **Node** (upstream parity), so a top-level `import { env } from "cloudflare:workers"` in a page module breaks the build — read env via `getEnv` from `waku` (as in `src/pages/index.tsx`) or a guarded dynamic import. |