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 | import Admin from "./src/Admin.ts"; |
| 5 | import Home from "./src/Home.ts"; |
| 6 | import Orders from "./src/Orders.ts"; |
| 7 | import Products from "./src/Products.ts"; |
| 8 | |
| 9 | /** |
| 10 | * One URL, four Workers, no gateway Worker in between. |
| 11 | * |
| 12 | * `Home` owns the hostname as a custom domain; `Products`, `Orders` and |
| 13 | * `Admin` each claim a path with a zone route. Cloudflare matches routes |
| 14 | * before custom domains, so a request goes straight to the Worker that |
| 15 | * owns its path. `alchemy dev` emulates the same routing table on `Home`'s |
| 16 | * local URL. |
| 17 | */ |
| 18 | export default Alchemy.Stack( |
| 19 | "CloudflareFederatedApi", |
| 20 | { |
| 21 | providers: Cloudflare.providers(), |
| 22 | state: Alchemy.localState(), |
| 23 | }, |
| 24 | Effect.gen(function* () { |
| 25 | const home = yield* Home; |
| 26 | yield* Products; |
| 27 | yield* Orders; |
| 28 | yield* Admin; |
| 29 | |
| 30 | return { |
| 31 | url: home.url.as<string>(), |
| 32 | }; |
| 33 | }), |
| 34 | ); |