The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Cloudflare from "@alchemy.run/cloudflare"; |
| 2 | import * as Alchemy from "alchemy"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | |
| 5 | export default Alchemy.Stack( |
| 6 | "CloudflareFlueExample", |
| 7 | { |
| 8 | providers: Cloudflare.providers(), |
| 9 | state: Cloudflare.state(), |
| 10 | }, |
| 11 | Effect.gen(function* () { |
| 12 | const site = yield* Cloudflare.Website.Vite("Website", { |
| 13 | // Flue's generated Worker entry (`flue()` serves it as a virtual module). |
| 14 | main: "virtual:flue/worker", |
| 15 | // Flue requires `nodejs_compat` and a date of 2026-04-01 or later. |
| 16 | compatibility: { |
| 17 | date: "2026-06-01", |
| 18 | flags: ["nodejs_compat"], |
| 19 | }, |
| 20 | memo: { |
| 21 | include: ["src/**", "package.json", "vite.config.ts"], |
| 22 | }, |
| 23 | env: { |
| 24 | // Workers AI, for the agent's `cloudflare/...` model. |
| 25 | AI: Cloudflare.Workers.AI(), |
| 26 | // One Durable Object per `'use agent'` agent: the `Assistant` agent |
| 27 | // is the class `FlueAssistantAgent`, bound as `FLUE_ASSISTANT_AGENT`. |
| 28 | FLUE_ASSISTANT_AGENT: Cloudflare.DurableObject("FlueAssistantAgent", { |
| 29 | className: "FlueAssistantAgent", |
| 30 | }), |
| 31 | }, |
| 32 | }); |
| 33 | |
| 34 | return { |
| 35 | url: site.url, |
| 36 | }; |
| 37 | }), |
| 38 | ); |