sailfork / t3code-github / .repos/ alchemy-effect/ website/ src/ content/ docs/ prisma/ setup.mdx

import PackageManagers from "../../../components/PackageManagers.astro";

Sign up at prisma.io and create a service token in the Prisma Console (workspace settings → service tokens). Install @alchemy.run/prisma:

Then register the provider next to your cloud's:

// alchemy.run.ts
import * as Alchemy from "alchemy";
import * as Cloudflare from "@alchemy.run/cloudflare";
import * as Prisma from "@alchemy.run/prisma";
import * as Effect from "effect/Effect";
import * as Layer from "effect/Layer";

export default Alchemy.Stack(
  "App",
  {
    providers: Layer.mergeAll(
      Cloudflare.providers(),
      Prisma.providers(),
    ),
    state: Alchemy.localState(),
  },
  Effect.gen(function* () {
    // Declare Prisma and Cloudflare resources here.
  }),
);

Run alchemy profile edit --add Prisma. The service token is entered interactively and saved under ~/.alchemy/credentials/<profile>/prisma-stored.json.

In CI (CI=true), profiles are bypassed. Set PRISMA_SERVICE_TOKEN or PRISMA_API_TOKEN; Alchemy reads it directly and persists nothing.

See Profiles for how credentials are stored and switched.

Local dev

bun alchemy dev needs no Prisma credentials. Database resources run against a local @prisma/dev Postgres, Compute resources run their configured dev.command, and the remaining Prisma resources return compatible local outputs. See Postgres for the dev database options.

Next steps