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

main
ts 40 lines 1.13 KB
Raw
1 import * as Hetzner from "@alchemy.run/hetzner";
2 import * as Neon from "@alchemy.run/neon";
3 import * as Alchemy from "alchemy";
4 import * as Output from "alchemy/Output";
5 import * as Effect from "effect/Effect";
6 import * as Layer from "effect/Layer";
7 import Api from "./src/api.ts";
8 import { Box, NeonBranch, NeonProject } from "./src/shared.ts";
9
10 export default Alchemy.Stack(
11 "HetznerWebsiteViteExample",
12 {
13 providers: Layer.mergeAll(Hetzner.providers(), Neon.providers()),
14 state: Alchemy.localState(),
15 },
16 Effect.gen(function* () {
17 const server = yield* Box;
18 const project = yield* NeonProject;
19 const branch = yield* NeonBranch;
20 const api = yield* Api;
21 const web = yield* Hetzner.Website.Vite("Web", {
22 server,
23 env: {
24 VITE_API_URL: Output.map(api.url, (url) => url ?? ""),
25 },
26 memo: {
27 include: ["index.html", "src/**", "package.json", "vite.config.ts"],
28 },
29 });
30
31 return {
32 url: web.url,
33 apiUrl: api.url,
34 serverId: server.serverId,
35 ipv4: server.ipv4,
36 neonProjectId: project.projectId,
37 neonBranchId: branch.branchId,
38 };
39 }),
40 );