Index of every page on this site: llms.txt
All skills
prisma avatar

/prisma-compute

@a6f1929 official
by prismaprisma/skills80 stars
8
Run it yourself

Deploy and operate apps on Prisma Compute with the Prisma 8 CLI. Use whenever the user mentions Prisma Compute, deploying or hosting a Prisma app, `prisma deploy`, `prisma dev module.ts`, Prisma Composer apps (`module.ts`, `compute()`, the `composer` section of `prisma.config.ts`), preview stages, deploy on push (`prisma git connect`, `prisma/cloud-deploy-action`), `prisma service` logs, versions, rollback, or custom domains, `project env`, `PRISMA_SERVICE_TOKEN`, regions, 504s, sleeping instances, or `waitUntil`; also when a project still uses the removed `@prisma/cli app deploy`, `prisma.compute.ts`, `defineComputeConfig`, `compute:deploy`, or `build logs` surface.

Use this Skill: https://skilld.dev/gh/prisma/skills/prisma-compute

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesdeploy-cli-and-ci.md

≈1.8k tokens on demand. Your agent reads this file only when SKILL.md points to it.

deploy-cli-and-ci

Deploy a Composer app with prisma deploy: production or a stage, from a workstation or from CI.

Priority

HIGH

Why It Matters

deploy does not build, chooses the project by the app's name rather than the directory link, and targets production unless told otherwise. Getting any of these wrong ships stale code, deploys into the wrong project, or changes production by accident.

Commands

npx prisma deploy module.ts --help
npx prisma dev module.ts --help
You want to Run
Run the app locally, no credentials npm run build && npx prisma dev module.ts
Deploy a preview npm run build && npx prisma deploy module.ts --stage <name>
Deploy production npm run build && npx prisma deploy module.ts
Deploy under another app name npx prisma deploy module.ts --name <name>
Write the outcome as JSON npx prisma deploy module.ts --report deploy-report.json

<entry> is the file whose default export is the root module, usually module.ts.

Before Deploying

  1. Build. deploy and dev package what the build already produced.
  2. Run npx prisma dev module.ts and request each local URL it prints. It runs the same pipeline against local emulators, with a real local Postgres, and needs no account. Ctrl-C leaves local data in place.
  3. Check auth: npx prisma auth whoami --json. If no one is signed in, ask the user to run npx prisma auth login; it opens a browser and cannot be done by an agent.
  4. For a new project, set a region: prismaCloud({ region }) in prisma.config.ts or PRISMA_REGION.
  5. Decide the target with the user. No --stage changes production.

Production and Stages

  • No --stage: production. In platform terms the app is a project named after the root module, and production is its default branch.
  • --stage <name>: a complete, isolated copy of the app as a preview branch of the same project, with its own services, databases, and configuration. Only the code is shared. The name must be a valid Git ref name; an invalid one fails the deploy.
  • Redeploying is idempotent: the deploy compares the module with the recorded deploy state and applies the difference. Removing a provision() from the module deletes that resource on the next deploy. A deploy never deletes the last service, the project, or a branch.
  • Deploy state lives on the platform, per branch, so a workstation and CI see the same state. Concurrent deploys of one environment take turns through a lease; a second deploy fails while the first holds it, and a crashed deploy's lease expires after about a minute.

Which Project

The deploy finds the project in the workspace by the root module name (or --name) and creates it if none exists. It does not read or write .prisma/local.json, and it has no --project flag.

  • A project with the same name that this module did not create can stop the deploy. Deploy with --name <unique-name> or rename the module.
  • After the first deploy, link the directory so other commands target the project: npx prisma project link <app-name>. Otherwise pass --project <app-name> to service, git, and project env commands.

Credentials

Where How
Workstation npx prisma auth login once; later commands, including an agent's, reuse the stored session
CI or headless PRISMA_SERVICE_TOKEN (a workspace service token from Console settings) and PRISMA_WORKSPACE_ID
GitHub Actions on a connected repository OIDC through prisma/cloud-deploy-action; no stored secret. See deploy-on-push.md

A non-empty PRISMA_SERVICE_TOKEN takes priority over stored sessions. A set-but-empty value is an error. Never print the token; check presence with test -n "${PRISMA_SERVICE_TOKEN:-}".

Input fields bound with envParam/envSecret are stored per stage. A fresh stage starts with none, so CI must export those values; the first deploy copies missing names from the shell to the stage.

Output

A deploy prints each step and ends with the app tree: every authored name, the platform resource it became, and public URLs.

my-app
├─ db    postgres-database db_def456
└─ api   compute-service cps_abc123
         https://xyz.ewr.prisma.build

With --json, the final envelope's result.summary.nodes[].entities[] lists what was deployed, each with kind, id, and url for services. --report <path> (or PRISMA_COMPOSER_REPORT_FILE) writes the outcome as JSON, including failure.code when the deploy fails. Request each service URL after the deploy:

curl -i https://xyz.ewr.prisma.build

CI Without GitHub

Any CI runs the same commands with the two credential variables as secrets:

npm ci
npm run build
npx prisma deploy module.ts --stage "pr-$PR_NUMBER" --json --report deploy-report.json

--build-id <id> joins a build record your CI already created through POST /v1/builds.

Teardown

The CLI has no destroy command, and branch has no delete.

  • Connected GitHub repository: deleting the Git branch tears down the matching preview (services, databases, buckets). Production and the default branch are never torn down this way.
  • Otherwise: call destroy from @prisma/composer/control with an explicit target. It needs PRISMA_SERVICE_TOKEN and PRISMA_WORKSPACE_ID in the environment and the app already built:
// destroy-stage.ts
import { destroy } from "@prisma/composer/control";
import prismaConfig from "./prisma.config.ts";

const result = await destroy({
  entry: "module.ts",
  config: { value: prismaConfig.composer, file: "prisma.config.ts" },
  target: { kind: "stage", stage: "pr-42" },
});
if (!result.ok) throw new Error(`${result.failure.code}: ${result.failure.message}`);

config is required in @prisma/composer 0.28.0: the composer section and the path of the file that declares it. Pass name when the app was deployed with --name. target is { kind: "stage", stage } or { kind: "production" } and has no default. Destroying a stage removes its resources, branch, and data; destroying production removes its resources and deletes the project once it is empty. Get the user's confirmation first. The deploy action's mode: destroy does not work against the current CLI.

Bad

npx prisma deploy module.ts

Run without a build, this deploys whatever stale output is on disk, and without --stage it targets production.

Good

npm run build
npx prisma dev module.ts            # verify locally, then Ctrl-C
npx prisma auth whoami --json
npx prisma deploy module.ts --stage feat-search --json --report deploy-report.json
npx prisma project link my-app
npx prisma service list --branch feat-search --json

References

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts10d3 checks · Risk SAFE
  • Gen Agent Trust Hub11d

    The skill provides comprehensive instructions for deploying and managing applications on Prisma Compute using the Prisma 8 CLI. It follows security best practices, such as redacting environment variables before display and warning against sharing secrets. All external resources and tools originate from trusted Prisma domains and repositories.

  • Socket10d

    No alerts

  • Snyk11d

    Risk: LOW · No issues

Signed by skilld at a6f1929. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 2 weeks ago
metadata
{
  "author": "prisma",
  "version": "2.1.0"
}

README badge

README badge for prisma/skills/prisma-compute

Guides agents through deploying TypeScript apps to Prisma Compute using the `@prisma/cli app deploy` command or `create-prisma` scaffolding. Covers framework-specific readiness (Next.js, Hono, Elysia, Astro, Nuxt, etc.), host/port binding, environment variables, branch deployments, and troubleshooting of the Compute CLI surface.

Generated from the current SKILL.md.

Does this skill cover deploying existing apps or only new scaffolds?
Both. It covers deploying existing TypeScript apps using the generated `compute:deploy` script or `@prisma/cli app deploy`, and scaffolding new apps with `create-prisma --deploy`. Prefer the generated script if your project already has one.
What frameworks does Prisma Compute support?
Current CLI deploy support includes Next.js, Hono, TanStack Start, and Bun. The skill covers deploy readiness checks for Elysia, Astro, Nuxt, Svelte, Nest, and Turborepo, but verify current CLI help output before deploying any framework.
Do I need to use `@prisma/cli` or the old Prisma CLI for Compute?
Use `@prisma/cli@latest` for Compute app deployment unless your help output shows the command has moved. Always verify current CLI help before assuming package names or flags.
What do I need to fix if my server won't accept connections after deploying?
Ensure your app binds to all interfaces (`0.0.0.0` or the framework equivalent) and reads the `PORT` environment variable, not hardcoded `localhost` or `127.0.0.1`. Loopback-only listeners appear ready locally but fail in production.
How do I deploy without interactive browser auth?
Use a stored CLI login or set `PRISMA_SERVICE_TOKEN` in your environment. Run with `--json --no-interactive` for agent-readable output. Never print the token.

Generated from the current SKILL.md. These answers refresh after source changes.