Skip to content

Commit 991dbcf

Browse files
feat: document prisma compute config
1 parent bbfa0a2 commit 991dbcf

8 files changed

Lines changed: 552 additions & 49 deletions

File tree

prisma-compute/SKILL.md

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: prisma-compute
3-
description: Prisma Compute deployment and hosting guide. Use whenever the user mentions Prisma Compute, deploying or hosting a Prisma app, `@prisma/cli app deploy`, `compute:deploy`, `create-prisma --deploy`, `PRISMA_SERVICE_TOKEN`, Compute apps/deployments/logs/domains, localhost vs `0.0.0.0`, deploy port binding, or framework deploy readiness for Hono, Elysia, Next.js, TanStack Start, Astro, Nuxt, Svelte, Nest, or Turborepo.
3+
description: Prisma Compute deployment and hosting guide. Use whenever the user mentions Prisma Compute, `prisma.compute.ts`, `defineComputeConfig`, deploying or hosting a Prisma app, `@prisma/cli app deploy`, `compute:deploy`, `create-prisma --deploy`, `PRISMA_SERVICE_TOKEN`, Compute apps/deployments/logs/domains, localhost vs `0.0.0.0`, deploy port binding, or framework deploy readiness for Hono, Elysia, Next.js, TanStack Start, Astro, Nuxt, Svelte, Nest, or Turborepo.
44
license: MIT
55
metadata:
66
author: prisma
@@ -35,7 +35,7 @@ Set `PRISMA_COMPUTE_RUNNER=bunx` to use `bunx` instead of `npx`.
3535

3636
Prefer evidence that matches the user's project and installed tooling:
3737

38-
1. The project's generated scripts and config, especially `compute:deploy`, `prisma.app.json`, framework config, and `package.json`.
38+
1. The project's generated scripts and config, especially `prisma.compute.ts`, `compute:deploy`, framework config, and `package.json`.
3939
2. Current CLI help output from `create-prisma` and `@prisma/cli`.
4040
3. Local installed package code, generated artifacts, and type definitions.
4141
4. Official docs or launch notes, especially after Compute is public.
@@ -48,6 +48,7 @@ Use this skill for:
4848

4949
- Creating a new app that can deploy to Prisma Compute
5050
- Deploying an existing TypeScript app to Prisma Compute
51+
- Creating or updating a typed `prisma.compute.ts` deploy config
5152
- Deciding whether a framework is Compute-ready
5253
- Debugging `create-prisma --deploy`, `compute:deploy`, or `app deploy`
5354
- Managing Compute app logs, deployments, environment variables, branches, and domains
@@ -59,16 +60,19 @@ Use this skill for:
5960
1. Existing project deployment or redeploy:
6061
Read [`references/app-deploy-cli.md`](references/app-deploy-cli.md).
6162

62-
2. Framework-specific build/runtime work:
63+
2. Typed Compute config, monorepos, deploy targets, app roots, or build/env defaults:
64+
Read [`references/compute-config.md`](references/compute-config.md).
65+
66+
3. Framework-specific build/runtime work:
6367
Read [`references/frameworks.md`](references/frameworks.md).
6468

65-
3. New project from a scaffold:
69+
4. New project from a scaffold:
6670
Read [`references/create-prisma.md`](references/create-prisma.md).
6771

68-
4. Programmatic deployment, SDKs, APIs, or low-level service/version concepts:
72+
5. Programmatic deployment, SDKs, APIs, or low-level service/version concepts:
6973
Read [`references/sdk-api.md`](references/sdk-api.md).
7074

71-
5. Build, auth, env, deploy, or runtime failures:
75+
6. Build, auth, env, deploy, or runtime failures:
7276
Read [`references/troubleshooting.md`](references/troubleshooting.md).
7377

7478
## Rules by Priority
@@ -78,9 +82,10 @@ Use this skill for:
7882
| 1 | Command verification | CRITICAL | `verify-` |
7983
| 2 | Framework readiness | CRITICAL | `framework-` |
8084
| 3 | Runtime host and port binding | CRITICAL | `runtime-` |
81-
| 4 | Branch, environment, and database wiring | HIGH | `env-` |
82-
| 5 | Deploy operations | HIGH | `deploy-` |
83-
| 6 | SDK and API automation | MEDIUM | `sdk-` |
85+
| 4 | Typed Compute config | HIGH | `config-` |
86+
| 5 | Branch, environment, and database wiring | HIGH | `env-` |
87+
| 6 | Deploy operations | HIGH | `deploy-` |
88+
| 7 | SDK and API automation | MEDIUM | `sdk-` |
8489

8590
## Quick Rules
8691

@@ -91,11 +96,12 @@ Use this skill for:
9196
- `verify-prisma-vs-platform-cli` - Do not assume `prisma app deploy` exists in the ORM CLI; check whether the task should use `@prisma/cli`.
9297
- `verify-generated-scripts` - Prefer the generated `compute:deploy` script when a project already has one.
9398
- `verify-public-url` - After a real deploy, smoke-test the public deployment URL instead of trusting local or readiness-only checks.
99+
- `verify-config-support` - For `prisma.compute.ts`, verify current CLI help/source because published package help may lag the repo.
94100

95101
### 2. Framework Readiness
96102

97103
- `framework-cli-first` - Evaluate deploy readiness against current `@prisma/cli app deploy`, not against what `create-prisma` can scaffold.
98-
- `framework-supported-cli-deploy` - Current CLI deploy framework keys are `nextjs`, `hono`, `tanstack-start`, and `bun`; verify help/source before using any other key.
104+
- `framework-supported-cli-deploy` - Current CLI source supports `nextjs`, `nuxt`, `astro`, `hono`, `tanstack-start`, and `bun`; verify installed help/source before relying on a key.
99105
- `framework-create-prisma-defaults-only` - `create-prisma` can provide generated defaults and `compute:deploy`, but it is not the general deploy surface for existing apps.
100106
- `framework-build-output` - Compute needs a server entrypoint or framework artifact, not only static output.
101107

@@ -105,7 +111,15 @@ Use this skill for:
105111
- `runtime-match-http-port` - The app must listen on the deployed HTTP port: read `process.env.PORT` when possible, or pass the matching `--http-port`.
106112
- `runtime-readiness-port-only` - Compute readiness watches listening ports; a loopback-only listener can look ready while public ingress cannot reach it.
107113

108-
### 4. Branch, Environment, and Database
114+
### 4. Typed Compute Config
115+
116+
- `config-use-prisma-compute-ts` - Put reusable deploy defaults in `prisma.compute.ts` with `defineComputeConfig`, not in `prisma.config.ts` or legacy `prisma.app.json`.
117+
- `config-app-vs-apps` - Use `app` for a single deploy target and `apps` for monorepos or multi-app repos; define exactly one.
118+
- `config-targets` - In multi-app configs, `prisma-cli app deploy web` selects the `apps.web` target, while a bare deploy can deploy every target when the CLI supports deploy-all.
119+
- `config-no-project-branch-secrets` - Do not commit Workspace, Project, Branch, production intent, service tokens, or secret values in `prisma.compute.ts`; keep those in flags, `.prisma/local.json`, env storage, or CI secrets.
120+
- `config-flags-win` - Explicit deploy flags such as `--framework`, `--entry`, `--http-port`, and `--env` override matching config values.
121+
122+
### 5. Branch, Environment, and Database
109123

110124
- `env-do-not-leak-secrets` - Never print full `DATABASE_URL`, service tokens, or secret values.
111125
- `env-deploy-loads-dotenv` - The generated deploy script passes `--env .env`; ensure production values are present before deploy.
@@ -114,23 +128,23 @@ Use this skill for:
114128
- `env-branch-scope` - Branch deploys, branch env vars, and branch databases must use the same branch name; pass `--branch <git-name>` explicitly when targeting a preview branch.
115129
- `env-production-vs-preview` - Use `--role production` for production env, `--role preview` for preview template env, and `--branch <git-name>` for branch-specific overrides.
116130

117-
### 5. Deploy Operations
131+
### 6. Deploy Operations
118132

119133
- `deploy-prod-intent` - Use `--prod --yes` only when the user intends a production deploy.
120134
- `deploy-noninteractive-auth` - Non-interactive deploys need either stored CLI login or a supported service token env var; never print the token.
121135
- `deploy-json-for-agents` - Use `--json --no-interactive` for scripts and agent-readable output.
122136

123-
### 6. SDK and API
137+
### 7. SDK and API
124138

125139
- `sdk-use-cli-first` - Prefer `@prisma/cli app deploy` for app workflows; use `create-prisma` only to scaffold a new app unless the user is building lower-level automation.
126140
- `sdk-result-handling` - `@prisma/compute-sdk` returns `Result` values; check `isOk()`/`isErr()` instead of relying on exceptions.
127141

128142
## Preferred Workflow
129143

130-
1. Inspect the project: package manager, template/framework, `package.json` scripts, Prisma version, Prisma client location, and existing `compute:deploy`.
144+
1. Inspect the project: package manager, template/framework, `package.json` scripts, Prisma version, Prisma client location, `prisma.compute.ts`, and existing `compute:deploy`.
131145
2. Verify CLI help output for the package actually being used, or run `scripts/verify-compute-surface.mjs` for the standard Compute surface check.
132146
3. Choose the path:
133-
- existing app deploy: generated `compute:deploy` or `@prisma/cli app build/run/deploy`
147+
- existing app deploy: `prisma.compute.ts` target, generated `compute:deploy`, or `@prisma/cli app build/run/deploy`
134148
- new app scaffold: `create-prisma`, then generated `compute:deploy` or `@prisma/cli app deploy`
135149
- low-level automation: `@prisma/compute-sdk` or Management API
136150
4. Check framework readiness plus host/port/env/runtime requirements, including project and branch scope.
@@ -142,6 +156,8 @@ Use this skill for:
142156
- Do not bury Compute deployment guidance in the generic `prisma-cli` skill.
143157
- Do not run `create-prisma` inside an existing app just to deploy it; use the generated `compute:deploy` script or `@prisma/cli app deploy`.
144158
- Do not tell users that every `create-prisma` template can auto-deploy.
159+
- Do not put Compute deploy defaults in `prisma.config.ts`; use `prisma.compute.ts` until the CLI ships a unified config shape.
160+
- Do not use legacy `prisma.app.json` for build settings; migrate custom build settings into `prisma.compute.ts`.
145161
- Do not deploy with placeholder `DATABASE_URL` values.
146162
- Do not assume `next start` is the Compute runtime path; Next.js deploys need standalone output.
147163
- Do not expose secret values from `.env`, CLI output, Management API responses, or logs.

prisma-compute/references/app-deploy-cli.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,54 @@ pnpm dlx @prisma/cli@latest app deploy
2222

2323
If a future Prisma ORM CLI exposes `prisma app deploy`, use the local project command after verifying `prisma app deploy --help`.
2424

25+
## Typed Compute Config
26+
27+
For reusable deploy defaults, prefer `prisma.compute.ts` over long command lines. Read [`compute-config.md`](compute-config.md) before creating or editing it.
28+
29+
Minimal single-app config:
30+
31+
```typescript
32+
import { defineComputeConfig } from "@prisma/compute-sdk/config";
33+
34+
export default defineComputeConfig({
35+
app: {
36+
name: "api",
37+
framework: "hono",
38+
entry: "src/index.ts",
39+
httpPort: 8080,
40+
env: ".env",
41+
},
42+
});
43+
```
44+
45+
Monorepo config:
46+
47+
```typescript
48+
import { defineComputeConfig } from "@prisma/compute-sdk/config";
49+
50+
export default defineComputeConfig({
51+
apps: {
52+
web: { root: "apps/web", framework: "nextjs" },
53+
api: {
54+
root: "apps/api",
55+
framework: "bun",
56+
entry: "src/index.ts",
57+
httpPort: 8080,
58+
env: "apps/api/.env",
59+
},
60+
},
61+
});
62+
```
63+
64+
Targeted deploys:
65+
66+
```bash
67+
bunx @prisma/cli@latest app deploy web
68+
bunx @prisma/cli@latest app deploy api --branch feature/login --json
69+
```
70+
71+
Config values are deploy defaults. Explicit flags such as `--framework`, `--entry`, `--http-port`, and `--env` override matching config values. `prisma.compute.ts` does not select Workspace, Project, Branch, database, or production scope; continue to use flags, project linking, env storage, and CI secrets for those.
72+
2573
## Auth and Project Binding
2674

2775
Useful commands:
@@ -62,6 +110,12 @@ bunx @prisma/cli@latest project show --json
62110
bunx @prisma/cli@latest app deploy --project proj_123 --app my-api --branch feature/login --json
63111
```
64112

113+
If `prisma.compute.ts` defines a `name` or an `apps` key, that config can provide the app name. `--app` and `PRISMA_APP_ID` rank above the config value. `[app]` selects a target from `apps` when the installed CLI supports typed compute config:
114+
115+
```bash
116+
bunx @prisma/cli@latest app deploy api --project proj_123 --branch feature/login --json
117+
```
118+
65119
Branch scope must line up across deploys, databases, and env vars:
66120

67121
- `app deploy --branch <git-name>` creates a deployment for that branch.
@@ -99,6 +153,8 @@ bunx @prisma/cli@latest project env remove STRIPE_KEY --role preview
99153

100154
If the deploy should create and wire a Prisma Postgres database for the deploy target, current `app deploy` exposes `--db`; use `--no-db` to skip database setup. Treat any generated connection URL as a one-time secret.
101155

156+
Database setup is not part of `prisma.compute.ts` in the current beta. Keep database intent explicit with `--db`, `--no-db`, `database create`, and project env commands.
157+
102158
## Build and Run Locally
103159

104160
Before deploy, verify that the app can produce a Compute artifact:
@@ -115,6 +171,13 @@ bunx @prisma/cli@latest app build --build-type bun --entry src/index.ts
115171
bunx @prisma/cli@latest app run --build-type bun --entry src/index.ts --port 8080
116172
```
117173

174+
With a compute config, pass the target name instead of repeating framework/entry/port flags:
175+
176+
```bash
177+
bunx @prisma/cli@latest app build api
178+
bunx @prisma/cli@latest app run api --port 8080
179+
```
180+
118181
`app run --port` sets `PORT` for local development. It does not rewrite an app's explicit host binding, so a local run is not enough to prove the deployed server is reachable from ingress.
119182

120183
## Runtime Host and Port
@@ -209,6 +272,18 @@ bunx @prisma/cli@latest app deploy \
209272
--env .env
210273
```
211274

275+
Config-backed Bun-style app:
276+
277+
```bash
278+
bunx @prisma/cli@latest app deploy api --prod --yes --env .env
279+
```
280+
281+
Use config for stable app defaults, and flags for one-off project, branch, env, database, and production choices.
282+
283+
## Legacy Config
284+
285+
Do not create `prisma.app.json`. It is legacy and no longer the Compute app config path. If a project has custom build settings there, move them into the relevant `build` block in `prisma.compute.ts` and delete `prisma.app.json`.
286+
212287
## Operations
213288

214289
Inspect and open:

0 commit comments

Comments
 (0)