Skip to content

Instantly share code, notes, and snippets.

@kandros
Created July 27, 2025 19:47
Show Gist options
  • Save kandros/a727135eff5840d68383b10aa33cfb52 to your computer and use it in GitHub Desktop.
Save kandros/a727135eff5840d68383b10aa33cfb52 to your computer and use it in GitHub Desktop.
import * as PgDrizzle from "@effect/sql-drizzle/Pg";
import { PgClient } from "@effect/sql-pg";
import { Config, Effect } from "effect";
import * as schema from "~/lib/server/schema";
const PgLive = PgClient.layerConfig({
url: Config.redacted("DATABASE_URL"),
});
export class DrizzleClient extends Effect.Service<DrizzleClient>()("app/DrizzleClient", {
dependencies: [PgLive],
effect: Effect.gen(function* () {
const db = yield* PgDrizzle.make<typeof schema>({
schema: schema,
});
return db;
}),
}) {}
@akshat-OwO
Copy link

thank you @kandros! I was stuck on this for a long time :)
Please update this as well when there is a better way to handle this 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment