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, 06:00 UTC
| 1 | import * as Railway from "@alchemy.run/railway"; |
| 2 | import * as Alchemy from "alchemy"; |
| 3 | import * as Output from "alchemy/Output"; |
| 4 | import * as Config from "effect/Config"; |
| 5 | import * as Effect from "effect/Effect"; |
| 6 | import * as Option from "effect/Option"; |
| 7 | import Api from "./src/api.ts"; |
| 8 | import { Db, Site } from "./src/shared.ts"; |
| 9 | |
| 10 | const RAILWAY_TEST_DOMAIN = Config.String("RAILWAY_TEST_DOMAIN").pipe( |
| 11 | Config.option, |
| 12 | Config.map(Option.getOrUndefined), |
| 13 | ); |
| 14 | |
| 15 | export default Alchemy.Stack( |
| 16 | "RailwayWebsiteViteExample", |
| 17 | { |
| 18 | providers: Railway.providers(), |
| 19 | state: Alchemy.localState(), |
| 20 | }, |
| 21 | Effect.gen(function* () { |
| 22 | const domain = yield* RAILWAY_TEST_DOMAIN; |
| 23 | const project = yield* Site; |
| 24 | const db = yield* Db; |
| 25 | const api = yield* Api; |
| 26 | const web = yield* Railway.Website.Vite("Web", { |
| 27 | project, |
| 28 | domain, |
| 29 | env: { |
| 30 | VITE_API_URL: Output.map(api.url, (url) => url ?? ""), |
| 31 | }, |
| 32 | memo: { |
| 33 | include: ["index.html", "src/**", "public/**", "package.json", "vite.config.ts"], |
| 34 | }, |
| 35 | }); |
| 36 | |
| 37 | return { |
| 38 | url: web.url, |
| 39 | apiUrl: api.url, |
| 40 | serviceId: web.service?.serviceId, |
| 41 | postgresId: db.serviceId, |
| 42 | }; |
| 43 | }), |
| 44 | ); |