The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import * as Cloudflare from "@alchemy.run/cloudflare"; |
| 2 | import * as Drizzle from "@alchemy.run/drizzle"; |
| 3 | import * as Planetscale from "@alchemy.run/planetscale"; |
| 4 | import * as Alchemy from "alchemy"; |
| 5 | import * as Effect from "effect/Effect"; |
| 6 | import * as Layer from "effect/Layer"; |
| 7 | import Api from "./src/Api.ts"; |
| 8 | import { Hyperdrive, PlanetscaleDb } from "./src/Db.ts"; |
| 9 | |
| 10 | export default Alchemy.Stack( |
| 11 | "CloudflarePlanetscalePostgresDrizzleExample", |
| 12 | { |
| 13 | providers: Layer.mergeAll(Cloudflare.providers(), Drizzle.providers(), Planetscale.providers()), |
| 14 | state: Alchemy.localState(), |
| 15 | }, |
| 16 | Effect.gen(function* () { |
| 17 | const { database, branch } = yield* PlanetscaleDb; |
| 18 | const hd = yield* Hyperdrive; |
| 19 | const api = yield* Api; |
| 20 | |
| 21 | return { |
| 22 | url: api.url.as<string>(), |
| 23 | databaseId: database.id, |
| 24 | branchName: branch.name, |
| 25 | hyperdriveId: hd.hyperdriveId, |
| 26 | }; |
| 27 | }), |
| 28 | ); |