1import * as Alchemy from "alchemy";
2import * as Cloudflare from "alchemy/Cloudflare";
3import * as Neon from "alchemy/Neon";
4import * as Prisma from "alchemy/Prisma";
5import * as Effect from "effect/Effect";
6import * as Layer from "effect/Layer";
7
8import Api from "./src/Api.ts";
9import { Hyperdrive, NeonDb } from "./src/Db.ts";
10
11export default Alchemy.Stack(
12 "CloudflareNeonPrismaPslExample",
13 {
14 providers: Layer.mergeAll(
15 Cloudflare.providers(),
16 Prisma.providers(),
17 Neon.providers(),
18 ),
19 state: Alchemy.localState(),
20 },
21 Effect.gen(function* () {
22 const { branch } = yield* NeonDb;
23 const hd = yield* Hyperdrive;
24 const api = yield* Api;
25
26 return {
27 url: api.url.as<string>(),
28 branchId: branch.branchId,
29 hyperdriveId: hd.hyperdriveId,
30 };
31 }),
32);