The best way to control Claude Code, Codex and more from any computer or phone

main
mdx 60 lines 1.84 KB
Raw
1 ---
2 title: Setup
3 description: Connect alchemy to Prisma — account, service tokens, and profiles.
4 ---
5
6 import PackageManagers from "../../../components/PackageManagers.astro";
7
8 Sign up at [prisma.io](https://www.prisma.io) and create a service
9 token in the [Prisma Console](https://console.prisma.io) (workspace
10 settings → service tokens). Install `@alchemy.run/prisma`:
11
12 <PackageManagers add="@alchemy.run/prisma" />
13
14 Then register the provider next to your cloud's:
15
16 ```typescript
17 // alchemy.run.ts
18 import * as Alchemy from "alchemy";
19 import * as Cloudflare from "@alchemy.run/cloudflare";
20 import * as Prisma from "@alchemy.run/prisma";
21 import * as Effect from "effect/Effect";
22 import * as Layer from "effect/Layer";
23
24 export default Alchemy.Stack(
25 "App",
26 {
27 providers: Layer.mergeAll(
28 Cloudflare.providers(),
29 Prisma.providers(),
30 ),
31 state: Alchemy.localState(),
32 },
33 Effect.gen(function* () {
34 // Declare Prisma and Cloudflare resources here.
35 }),
36 );
37 ```
38
39 Run `alchemy profile edit --add Prisma`. The service token is entered
40 interactively and saved under
41 `~/.alchemy/credentials/<profile>/prisma-stored.json`.
42
43 In CI (`CI=true`), profiles are bypassed. Set `PRISMA_SERVICE_TOKEN` or
44 `PRISMA_API_TOKEN`; Alchemy reads it directly and persists nothing.
45
46 See [Profiles](/environments/profiles) for how credentials are stored
47 and switched.
48
49 ## Local dev
50
51 `bun alchemy dev` needs no Prisma credentials. Database resources run
52 against a local `@prisma/dev` Postgres, Compute resources run their
53 configured `dev.command`, and the remaining Prisma resources return
54 compatible local outputs. See
55 [Postgres](/prisma/data/postgres) for the dev database options.
56
57 ## Next steps
58
59 - [Tutorial: Your First Project](/prisma/tutorial/part-1) — build a full-stack Prisma application in four parts.
60 - [Prisma overview](/prisma) — resources and compositions.