@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, 07:15 UTC

main
ts 18 lines 767 Bytes
Raw
1 import * as Cloudflare from "@alchemy.run/cloudflare";
2 import * as Neon from "@alchemy.run/neon";
3 import * as Postgres from "@alchemy.run/sql/Postgres";
4 import * as Effect from "effect/Effect";
5 import * as Layer from "effect/Layer";
6
7 // #region show
8 export const DatabaseLive = Layer.unwrap(
9 Effect.gen(function* () {
10 const database = yield* Neon.Project("Db");
11 const db = yield* Neon.Branch("Db", { project: database });
12 const pool = yield* Cloudflare.Hyperdrive.Connection("Pool", { origin: db.origin });
13 const connection = yield* Cloudflare.Hyperdrive.Connect(pool);
14 return Postgres.PostgresLayer({ url: connection.connectionString });
15 }),
16 ) /*hide*/
17 .pipe(Layer.provide(Cloudflare.Hyperdrive.ConnectBinding)); /*end*/
18 // #endregion show