@devries-cameron20 / t3code Mirror · read-only
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 40 lines 1.28 KB
Raw
1 import * as Fly from "@alchemy.run/fly";
2 /**
3 * Three Services connected over a private Fly network:
4 *
5 * - `Users` — private, serves `list` and `get` methods (`src/users.ts`)
6 * - `Orders` — private, binds Users (`src/orders.ts`)
7 * - `Gateway` — the only public Service, binds both (`src/gateway.ts`)
8 *
9 * Each Service is its own Fly App. All three join `Fly.stackNetwork`, a
10 * private network unique to this stack and stage, so Users and Orders are
11 * unreachable from the internet and from every other App in the org.
12 * `Fly.bindService` connects them: only a Service that binds another
13 * receives its caller token, so it can call its methods.
14 */
15 import * as Alchemy from "alchemy";
16 import * as Effect from "effect/Effect";
17 import Gateway from "./src/gateway.ts";
18 import Orders from "./src/orders.ts";
19 import Users from "./src/users.ts";
20
21 export default Alchemy.Stack(
22 "FlyMicroservices",
23 {
24 providers: Fly.providers(),
25 state: Alchemy.localState(),
26 },
27 Effect.gen(function* () {
28 const users = yield* Users;
29 const orders = yield* Orders;
30 const gateway = yield* Gateway;
31
32 return {
33 url: gateway.url,
34 network: gateway.network,
35 usersUrl: users.url,
36 usersPrivateUrl: users.privateUrl,
37 ordersPrivateUrl: orders.privateUrl,
38 };
39 }),
40 );