The best way to control Claude Code, Codex and more from any computer or phone

main
ts 51 lines 1.53 KB
Raw
1 import * as Fly from "@alchemy.run/fly";
2 /**
3 * A Fly.io app that exercises the full module-scope graph:
4 *
5 * - `Site` — parent App (`src/shared.ts`)
6 * - `Marker` — App Secret the Api reads via `Fly.GetSecret`
7 * - `PublicIp` — shared IPv4 so `{app}.fly.dev` answers
8 * - `Api` — HTTP Service on port 3000 (`src/api.ts`)
9 * - `Worker` — background Service that writes a volume marker (`src/worker.ts`)
10 *
11 * N Services share one App; each Service is its own Machine. Disks are
12 * `Fly.MountVolume({ path, sizeGb })` inside the Service — one Volume
13 * per replica, not a standalone Volume resource.
14 */
15 import * as Alchemy from "alchemy";
16 import * as Effect from "effect/Effect";
17 import Api from "./src/api.ts";
18 import { Marker, PublicIp, Site } from "./src/shared.ts";
19 import Worker from "./src/worker.ts";
20
21 export default Alchemy.Stack(
22 "FlyService",
23 {
24 providers: Fly.providers(),
25 state: Alchemy.localState(),
26 },
27 Effect.gen(function* () {
28 const site = yield* Site;
29 const secret = yield* Marker;
30 const ip = yield* PublicIp;
31 const worker = yield* Worker;
32 const api = yield* Api;
33
34 return {
35 appName: site.appName,
36 appId: site.appId,
37 appUrl: site.url,
38 workerMounts: worker.mounts,
39 secretName: secret.name,
40 ip: ip.ip,
41 workerMachineId: worker.machineId,
42 workerName: worker.name,
43 workerState: worker.state,
44 apiMachineId: api.machineId,
45 apiName: api.name,
46 apiState: api.state,
47 apiUrl: api.url,
48 apiRegion: api.region,
49 };
50 }),
51 );