t3-code-android-nightly/.repos/alchemy-effect/examples/cloudflare-website-waku
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00
..
public chore(refs): sync Alchemy reference to beta.76 (#10654) 2026-09-07 21:54:45 -07:00
src chore(refs): sync Alchemy reference to beta.76 (#10654) 2026-09-07 21:54:45 -07:00
test chore(refs): sync Effect and Alchemy references to rc.115 and beta.78 (#12327) 2026-09-17 23:21:25 -07:00
.gitignore chore(refs): sync Alchemy reference to beta.76 (#10654) 2026-09-07 21:54:45 -07:00
alchemy.run.ts chore(refs): sync Alchemy reference to beta.76 (#10654) 2026-09-07 21:54:45 -07:00
package.json chore(refs): sync Effect and Alchemy references to rc.115 and beta.78 (#12327) 2026-09-17 23:21:25 -07:00
README.md chore(refs): sync Alchemy reference to beta.76 (#10654) 2026-09-07 21:54:45 -07:00
tsconfig.json chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170) 2026-10-05 13:22:30 -07:00
waku.config.ts chore(refs): sync Alchemy reference to beta.76 (#10654) 2026-09-07 21:54:45 -07:00

Cloudflare Website: Waku

Deploys a Waku app to Cloudflare Workers with Cloudflare.Website.Waku — no waku.config.ts, no Wrangler.

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.

const site = yield* Cloudflare.Website.Waku("WakuSite", {
  compatibility: {
    flags: ["nodejs_als"], // waku's server runtime needs AsyncLocalStorage
  },
  env: {
    GREETING: "Hello from Waku on Cloudflare!",
  },
});

Commands

bun alchemy deploy   # build + deploy
bun alchemy dev      # waku's Vite dev server (rsc environment runs in workerd, HMR)
bun alchemy destroy  # tear down

Notes

  • @alchemy.run/frontend-frameworks must be installed in the project — the Worker's source provider is loaded from its /waku export at deploy time.
  • Unchanged projects skip the build and deploy entirely (the project tree is content-hashed, respecting .gitignore).
  • 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.