t3-code-android-nightly/.repos/alchemy-effect/examples/fly-postgres/alchemy.run.ts
Julius Marminge 6f9cea00ae
chore(refs): sync Effect and Alchemy references to 4.0.1 and beta.80 (#16170)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-05 13:22:30 -07:00

34 lines
857 B
TypeScript

/**
* Fly.io Managed Postgres + Drizzle, queried from an HTTP Service.
*
* Billed (~$38/mo Basic).
*/
import * as Alchemy from "alchemy";
import * as Drizzle from "alchemy/Drizzle";
import * as Fly from "alchemy/Fly";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";
import Api from "./src/api.ts";
import { Db, Schema } from "./src/shared.ts";
export default Alchemy.Stack(
"FlyPostgres",
{
providers: Layer.mergeAll(Fly.providers(), Drizzle.providers()),
state: Alchemy.localState(),
},
Effect.gen(function* () {
const schema = yield* Schema;
const db = yield* Db;
const api = yield* Api;
return {
appName: api.appName,
clusterId: db.clusterId,
clusterName: db.name,
region: db.region,
migrations: schema.migrations,
apiUrl: api.url,
};
}),
);