diff --git a/apps/docs/content/docs/(index)/full-stack-tutorial.mdx b/apps/docs/content/docs/(index)/full-stack-tutorial.mdx index ea584d9c415..81198aa15e2 100644 --- a/apps/docs/content/docs/(index)/full-stack-tutorial.mdx +++ b/apps/docs/content/docs/(index)/full-stack-tutorial.mdx @@ -79,7 +79,7 @@ Check the Node.js version first: `node --version` must print 22.18 or newer on t 1. Scaffold: `npm create prisma@latest -- my-app --template hono --provider postgres --yes`. Then run `npx prisma@latest init` in `my-app` to confirm the Prisma agent skills the scaffold installed are current, and use them. 2. Read `module.ts` and `service.ts` first: the Composer module provisions the database and the service, and it is what `dev` and `deploy` operate on. -3. Build and run locally: `npm run build`, then start `npx prisma dev module.ts` in the background and wait until it prints the local URL. This provisions a local Prisma Postgres database and applies the contract; no DATABASE_URL is needed. Sample users are seeded on the app's first query. Verify with curl that the local URL's /users endpoint returns the seeded users, then stop `dev`. +3. Build and run locally: `npm run build`, then `npx prisma dev module.ts --detach`, which returns once the app answers and leaves it running. This provisions a local Prisma Postgres database and applies the contract; no DATABASE_URL is needed. Sample users are seeded on the app's first query. Verify that `curl "$(npx prisma dev url app)/users"` returns the seeded users, then run `npx prisma dev stop`. 4. Deploy: check `npx prisma auth whoami`; if I am not signed in, stop and ask me to run `npx prisma auth login` (it opens a browser). The scaffold already wrote the baseline migration under `migrations/app/`; note its directory name, which ends in `_init`. The `composer` section of the scaffold's `prisma.config.ts` already sets the deploy region, so do not add one. Then run `npx prisma deploy module.ts` and verify the live URL's /users endpoint with curl. The deploy creates the project and provisions the database from the module declaration; do not pass a DATABASE_URL. 5. Evolve the schema: add `role String @default("member")` to the User model in `src/prisma/contract.prisma`, run `npx prisma contract emit`, add `"role"` to the typed select and the returned object in `src/prisma/users.ts`, and plan the migration with `npx prisma migration plan --name add-user-role --from `. Then run `npm run build` and `npx prisma deploy module.ts` again, and verify the live /users now returns `role: "member"` with the same createdAt values as before. ``` @@ -192,10 +192,10 @@ npx prisma dev module.ts `dev` provisions a local Prisma Postgres database, applies the contract to it, starts the service, and prints the app's local URL when everything is ready. No account, credentials, or connection string are involved; see [Local development](/local-development) for how the local platform works. -Sample users are seeded automatically the first time the app queries the database. Confirm the API serves the seeded rows. `dev` keeps running until you press Ctrl-C, so run the curl in a second terminal. `dev` also picks a free port and prints the URL, so use the one it printed if it differs from the `3000` shown here: +Sample users are seeded automatically the first time the app queries the database. Confirm the API serves the seeded rows. `dev` keeps running until you press Ctrl-C, so run the curl in a second terminal in the same directory. `dev` picks a free port for the service, and `prisma dev url app` prints the URL of the service named `app`, whichever port it got: ```bash -curl http://localhost:3000/users +curl "$(npx prisma dev url app)/users" ``` ```json no-copy diff --git a/apps/docs/content/docs/(index)/index.mdx b/apps/docs/content/docs/(index)/index.mdx index 8d5063f9380..ae76fafe9db 100644 --- a/apps/docs/content/docs/(index)/index.mdx +++ b/apps/docs/content/docs/(index)/index.mdx @@ -169,7 +169,7 @@ Compute runs apps declared with Prisma Composer: your server code plus a small T 1. Install `@prisma/composer` and `@prisma/composer-prisma-cloud`, and install `prisma` as a dev dependency. Do not pin `effect`: Composer pins it. Only if another dependency pins a different `effect` and `prisma.config.ts` fails with `CLI.CONFIG_UNREADABLE`, add the override from https://www.prisma.io/docs/composer/deploying#when-prismaconfigts-fails-on-an-effect-version-conflict. Then install the Composer skill with `npx prisma skills sync`, and use it. 2. Declare the app: a `service.ts` with `compute({ name, deps, build })`, a `module.ts` that provisions it, and a `prisma.config.ts` whose `composer` section lists the extensions and the state store (`definePrismaConfig` from `prisma/config`, `defineConfig as composer` from `@prisma/composer/config`). Read the port from `service.port()` and bind 0.0.0.0. Replace other `process.env` reads with the service input schema, binding credentials like DATABASE_URL with `envSecret`. Composer does not build: produce one self-contained entry file per service (for example `esbuild --bundle --platform=node --format=esm --outfile=dist/server.mjs`), or use the framework build adapter (Next.js needs the `nextjs` adapter and `output: "standalone"`). -3. Verify locally: run the build, then `npx prisma dev module.ts`, and curl the printed local URL. +3. Verify locally: run the build, then `npx prisma dev module.ts --detach`, curl each service at the URL `npx prisma dev url ` prints, then run `npx prisma dev stop`. 4. Confirm I am signed in with `npx prisma auth whoami`; if not, stop and ask me to run `npx prisma auth login` (it opens a browser). 5. Deploy: run the build, then `npx prisma deploy module.ts` with the app's env values (like DATABASE_URL) exported in the shell; the first deploy copies input values up to the deployment. Verify the printed public URL with curl. diff --git a/apps/docs/content/docs/(index)/prisma-compute/deploy.mdx b/apps/docs/content/docs/(index)/prisma-compute/deploy.mdx index 7888f8f5cc0..85b88260aba 100644 --- a/apps/docs/content/docs/(index)/prisma-compute/deploy.mdx +++ b/apps/docs/content/docs/(index)/prisma-compute/deploy.mdx @@ -100,7 +100,13 @@ npm run build npx prisma dev module.ts ``` -`dev` prints the service's local URL; `curl` it and you get `Hello from Prisma Compute`. See [Local development](/local-development) for the local database, storage, and log workflow. +`dev` prints the service's local URL and keeps running. From a second terminal in the same directory, call the service through `prisma dev url`, which prints the URL of the service named `web`: + +```bash +curl "$(npx prisma dev url web)" +``` + +You get `Hello from Prisma Compute`. See [Local development](/local-development) for the local database, storage, and log workflow. From here the app grows by declaration: `deps: { db: rawPostgres() }` gives the service a [Prisma Postgres database](/composer/databases) (or `postgres(contract)` from `@prisma/composer-prisma-cloud/orm` for one typed by Prisma ORM), [`bucket()`](/composer/object-storage) gives it object storage, and a second service with a [typed contract](/composer/getting-started) turns cross-service calls into checked function calls. When the app runs locally, continue to [Deploy](#2-deploy). diff --git a/apps/docs/content/docs/(index)/prisma-orm/from-scratch.mdx b/apps/docs/content/docs/(index)/prisma-orm/from-scratch.mdx index cccdac51c71..51bd4d8dd6d 100644 --- a/apps/docs/content/docs/(index)/prisma-orm/from-scratch.mdx +++ b/apps/docs/content/docs/(index)/prisma-orm/from-scratch.mdx @@ -43,7 +43,7 @@ npm install @prisma/orm-postgres dotenv npm install --save-dev prisma tsx typescript ``` -`@prisma/orm-postgres` is the library your code imports, and `prisma` is the command-line tool. `dotenv` loads `.env`, `tsx` runs `index.ts` without a build step, and `typescript` 5.9 or newer is a peer dependency of `@prisma/orm-postgres`. So is `temporal-polyfill`, which npm installs for you; with Yarn, add it yourself. The two Prisma packages have different version numbers (for example, `prisma` 8.0.0-rc.23 and `@prisma/orm-postgres` 8.0.0-rc.18); that is normal, and any two `latest` versions work together. +`@prisma/orm-postgres` is the library your code imports, and `prisma` is the command-line tool. `dotenv` loads `.env`, `tsx` runs `index.ts` without a build step, and `typescript` 5.9 or newer is a peer dependency of `@prisma/orm-postgres`. So is `temporal-polyfill`, which npm installs for you; with Yarn, add it yourself. The two Prisma packages have different version numbers (for example, `prisma` 8.0.0-rc.24 and `@prisma/orm-postgres` 8.0.0-rc.18); that is normal, and any two `latest` versions work together. ## 2. Create the config file and `.env` diff --git a/apps/docs/content/docs/(index)/prisma-orm/quickstart/existing-app/mongodb.mdx b/apps/docs/content/docs/(index)/prisma-orm/quickstart/existing-app/mongodb.mdx index 03800d3672c..eb3dc61e7f6 100644 --- a/apps/docs/content/docs/(index)/prisma-orm/quickstart/existing-app/mongodb.mdx +++ b/apps/docs/content/docs/(index)/prisma-orm/quickstart/existing-app/mongodb.mdx @@ -59,7 +59,7 @@ installed ├─ dotenv ├─ prisma@latest (dev) ├─ @types/node (dev) -└─ @prisma/cli-engine@0.7.0 (dev) +└─ @prisma/cli-engine@0.9.0 (dev) ✔ Done. Open prisma-8.md to get started. ``` diff --git a/apps/docs/content/docs/(index)/prisma-orm/quickstart/existing-app/postgresql.mdx b/apps/docs/content/docs/(index)/prisma-orm/quickstart/existing-app/postgresql.mdx index 6b3acc46de6..6a6f30ec49c 100644 --- a/apps/docs/content/docs/(index)/prisma-orm/quickstart/existing-app/postgresql.mdx +++ b/apps/docs/content/docs/(index)/prisma-orm/quickstart/existing-app/postgresql.mdx @@ -59,7 +59,7 @@ installed ├─ dotenv ├─ prisma@latest (dev) ├─ @types/node (dev) -└─ @prisma/cli-engine@0.7.0 (dev) +└─ @prisma/cli-engine@0.9.0 (dev) ✔ Done. Open prisma-8.md to get started. ``` diff --git a/apps/docs/content/docs/cli/configuration.mdx b/apps/docs/content/docs/cli/configuration.mdx index 64baf7ac503..c089ded0881 100644 --- a/apps/docs/content/docs/cli/configuration.mdx +++ b/apps/docs/content/docs/cli/configuration.mdx @@ -239,6 +239,8 @@ Use the default text output when running commands locally. Use `--json` in CI or npx prisma db verify --db "$DATABASE_URL" --json ``` +Piping a command does not switch it to JSON: without `--json`, standard output gets the command's plain data, such as one line per item of a list. See [Global flags](/cli/global-flags#output-formats). + For an AI agent that reads the output as text rather than parsing JSON, use `--format markdown`; see [Global flags](/cli/global-flags#output-formats). Use `--no-interactive` for scripts that must never pause for user input. Use `--confirm ` to grant a consent prompt non-interactively. For example, [`db update`](/cli/db-update) asks for the database name before a destructive change. diff --git a/apps/docs/content/docs/cli/contract-print.mdx b/apps/docs/content/docs/cli/contract-print.mdx index 0d75b3398f6..61982cb83fc 100644 --- a/apps/docs/content/docs/cli/contract-print.mdx +++ b/apps/docs/content/docs/cli/contract-print.mdx @@ -22,8 +22,7 @@ npx prisma contract print [--output ] | Option | What it does | | --- | --- | -| `--output ` | Writes the PSL to this file. Without it, the command prints the PSL and writes no file. | -| `--format human` | Prints the PSL to standard output, so you can redirect it to a file. | +| `--output ` | Writes the PSL to this file. Without it, the command writes the PSL to standard output and writes no file. | | `--config ` | Read this config file instead of `./prisma.config.ts`. | | `--json` | Prints a machine-readable result, with the PSL in `psl.text`. | @@ -35,6 +34,12 @@ npx prisma contract print --output ./src/prisma/contract.prisma npx prisma contract print --json ``` +Without `--output`, standard output gets only the PSL, while the status line goes to standard error. So you can redirect or pipe it: + +```bash +npx prisma contract print > contract.v8.prisma +``` + ## What it writes The file starts with `// use prisma-8`. When you point `contract` at the file and run `contract emit`, you get the same contract as before, with the same hashes, so the database needs no migration and no new `db sign`. diff --git a/apps/docs/content/docs/cli/dev.mdx b/apps/docs/content/docs/cli/dev.mdx index 7e4fce8b31b..0b0f72f4547 100644 --- a/apps/docs/content/docs/cli/dev.mdx +++ b/apps/docs/content/docs/cli/dev.mdx @@ -3,32 +3,99 @@ title: dev description: Bring a Composer application up entirely on this machine, with no cloud credentials. url: /cli/dev metaTitle: dev | Prisma CLI -metaDescription: Complete reference for the prisma dev command, which runs a Prisma Composer application locally against local emulators for Prisma Compute and Prisma Postgres. +metaDescription: Complete reference for the prisma dev command and its url and stop subcommands, which run a Prisma Composer application locally against local emulators for Prisma Compute and Prisma Postgres. --- -`dev` brings a [Prisma Composer](/composer) application up entirely on this machine. It takes an `` argument: the module whose default export is the application root, typically `module.ts`. The command runs credential-free against local emulators standing in for Prisma Compute and Prisma Postgres, watches the built output, and restarts a service when its build changes. See [Local development](/composer/local-development). +`dev` brings a [Prisma Composer](/composer) application up entirely on this machine. It takes an `` argument: the module whose default export is the application root, typically `module.ts`. The command runs credential-free against local emulators, programs on your machine that stand in for Prisma Compute, Prisma Postgres, and buckets. It watches the built output and restarts a service when its build changes. See [Local development](/composer/local-development). -`dev` and [`deploy`](/cli/deploy) are root-level commands of the unified Prisma CLI. There is no `composer` command group. Like `deploy`, `dev` runs your *built* output, so build first. +Like [`deploy`](/cli/deploy), `dev` runs your *built* output, so build first. ## Usage ```npm npx prisma dev module.ts npx prisma dev module.ts --fresh +npx prisma dev module.ts --detach +npx prisma dev url gateway +npx prisma dev stop ``` +## Commands + +| Command | Description | +| --- | --- | +| `dev ` | Run the app on this machine and watch it for changes until you press `Ctrl-C` | +| `dev url
` | Print where a service, database, or bucket of the app answers locally | +| `dev stop` | Stop the app that `prisma dev` last ran from this directory | + +`dev url`, `dev stop`, and `--detach` are in `prisma` since `8.0.0-rc.24`. Check your version with `npx prisma --version`. + ## Flags | Flag | Description | | --- | --- | -| `--name ` | Override the application name for the local dev instance | -| `--fresh` | Destroy the dev stack and wipe the dev state directory before starting. In this release the flag fails for apps with a database; see [Local development](/composer/local-development#whats-local-vs-whats-real) for the manual reset | +| `--name ` | Run the app under this name instead of the name its root module declares. A different name gets its own local services, databases, and buckets | +| `--fresh` | Before starting, delete this app's local services, databases, and buckets, with their data. Other apps run from the same directory keep theirs | +| `--detach` | Return once every service answers, and leave the app running without watching for changes. `prisma dev stop` stops it. Use it in scripts, agents, and CI | `dev` needs no credentials or environment variables; local runs never talk to the platform. -To tail the running application's merged logs, use the `log` operation of the [control API](/cli/deploy#the-control-api); the unified CLI has no `log` command. +When `dev` ends, by `Ctrl-C` or a failure, it stops the app's service processes and local Postgres servers. The emulators themselves keep running. Their data and ports are kept, so the next `dev` in this directory starts with the same ports and data. + +With `--detach`, `dev` prints the same `ready` line and service URLs as a foreground run, then exits with code `0` and leaves the app running. It does not pick up rebuilds: run `prisma dev module.ts --detach` again after a build, or run `prisma dev module.ts` in the foreground, which takes over the running app and watches it. If a detached start fails before every service answers, `dev` stops the whole app and exits non-zero. `--detach` combines with `--fresh` and `--name`. + +## dev url + +`dev url
` prints the local URL of one node of the app that `prisma dev` runs from the current directory. A node is a service, database, or bucket in the app, and its address is its name in the app, with dots for a nested node, such as `catalog.database`. + +```npm +npx prisma dev url gateway +``` + +```text no-copy +✔ The service gateway is running at http://localhost:3001 +``` + +| Node | What `dev url` prints | +| --- | --- | +| Service | `http://localhost:` | +| Database | Its connection string, with its local credentials | +| Bucket | Its S3 endpoint followed by `/` | + +That line is for you to read. When standard output is a pipe or a file, or `$(...)` captures it, `dev url` writes the URL alone, so a script can use it directly. Check the exit status before using it, so a failure does not run the next command with an empty URL: + +```bash +url=$(npx prisma dev url gateway) && curl "$url" +``` + +Run it from the directory you ran `prisma dev` in, while the app runs. It starts nothing: it reads what the last `prisma dev` in this directory recorded. With `--json`, it prints `{ address, kind, url, state }` instead. + +`dev url` prints a URL only for a node that is running, so something is listening at the URL it prints. Otherwise it fails with one of these codes: + +| Code | Meaning | +| --- | --- | +| `DEV.NOT_STARTED_HERE` | `prisma dev` never ran in this directory | +| `DEV.ADDRESS_UNKNOWN` | The app has no node at that address. The message lists the addresses it has | +| `DEV.EMULATOR_UNREACHABLE` | The emulator that runs the node is not running. Run `prisma dev` again, which starts it | +| `DEV.NOT_RUNNING` | The node exists but is not running. Usually it was stopped, by `prisma dev stop`, by `prisma dev` ending, or by running another app in this directory. A service that keeps crashing is reported this way too, with the path of its log | + +## dev stop + +`dev stop` stops the app that `prisma dev` last ran from the current directory: its service processes and local database servers, as `Ctrl-C` does in a foreground `prisma dev`. + +```npm +npx prisma dev stop +``` + +Use it to stop an app started with `--detach`, or when `prisma dev` was killed without a chance to stop the app. It lists the services and databases it stopped. When nothing of the app was running, it prints `Nothing of was running.` and still exits with code `0`. Data and ports are kept, so the next `prisma dev` starts with the same ports and data. The emulators themselves keep running, because apps in other directories may use them. + +## Global flags + +The Prisma CLI's [global flags](/cli/global-flags) also apply: `--format`, `--json`, `--log-level`, `--verbose`, `--quiet`, `--yes`, `--confirm`, `--interactive`, `--color`, and `--config`. + +To tail the running application's merged logs, use the `log` operation of the [control API](/cli/deploy#the-control-api); the unified CLI has no `log` command. To see every local emulator and what runs on it, use [`emulator list`](/cli/emulator). ## Next steps -- [Local development](/composer/local-development): warm restarts, `--fresh`, and what persists. +- [Local development](/composer/local-development): ports, what persists, and running in the background. - [`deploy`](/cli/deploy): the same application, on Prisma Compute. diff --git a/apps/docs/content/docs/cli/emulator.mdx b/apps/docs/content/docs/cli/emulator.mdx new file mode 100644 index 00000000000..23f5570586c --- /dev/null +++ b/apps/docs/content/docs/cli/emulator.mdx @@ -0,0 +1,74 @@ +--- +title: emulator +description: List the local emulators that prisma dev runs your app on, and every instance they hold. +url: /cli/emulator +metaTitle: emulator | Prisma CLI +metaDescription: Reference for the prisma emulator list command, which lists the local emulators that run Prisma Composer services, databases, and buckets on your machine. +--- + +Use `emulator` commands to inspect the local emulators. An emulator is a program on your machine that stands in for Prisma Compute, Prisma Postgres, or a bucket while [`prisma dev`](/cli/dev) runs a [Prisma Composer](/composer) app: one runs services, one runs Postgres databases, and one runs S3-compatible buckets. Each emulator holds instances, one for every service, database, or bucket that a `prisma dev` started, from any directory on the machine. + +The emulators keep running after `prisma dev` ends. An instance keeps its port and data until `prisma dev --fresh`, run from the directory that started it, deletes it. There is no command yet to remove the instances of a directory you deleted. + +`emulator list` is in `prisma` since `8.0.0-rc.24`. + +## Usage + +```npm +npx prisma emulator list +npx prisma emulator list --json +``` + +## Commands + +| Command | Description | +| --- | --- | +| `emulator list` | List every local emulator, whether it is running, and every instance it holds | + +## emulator list + +`emulator list` works from any directory and needs no `prisma.config.ts`, because it describes the machine rather than one project. For each instance it shows the instance id, its URL, its state, and the node address and directory of the `prisma dev` that started it. + +```npm +npx prisma emulator list +``` + +```text no-copy +✔ Service emulator at http://127.0.0.1:4304 +└─ svc_56b2c1618f6488d2 http://localhost:3001 running gateway in /Users/ada/my-app +✔ Database emulator at http://127.0.0.1:4305 +└─ db_7cff71f83ae35c90 postgres://…:51650/template1?sslmode=disable running catalog.database in /Users/ada/my-app +ℹ Bucket emulator (not running) +``` + +An emulator that is not running is listed with no instances. One that is running but does not answer, or answers with an error, is shown with that error, and the other emulators are still listed. + +When standard output is a pipe or a file, `emulator list` writes one line per instance, with six tab-separated fields: + +| Field | Value | +| --- | --- | +| 1 | The emulator's kind: `service`, `database`, or `bucket` | +| 2 | The instance id | +| 3 | The instance's URL | +| 4 | The instance's state | +| 5 | The address of the node it runs, such as `gateway` or `catalog.database` | +| 6 | The directory `prisma dev` ran from | + +The last two fields are empty for an instance that the emulator holds without a record of which app started it. For example, to print the URL of every running instance started from the current directory: + +```bash +npx prisma emulator list | awk -F '\t' -v dir="$PWD" '$4 == "running" && $6 == dir { print $3 }' +``` + +With `--json`, the result is `{ emulators: [{ kind, running, url, instances: [{ id, kind, url, state, labels }], error }] }`, where `url` is `null` for an emulator that is not running, and `error` is `null` unless the emulator is running but could not be listed. + +There is no `prisma emulator start` or `prisma emulator stop` yet, so to stop one app's services and databases, run [`prisma dev stop`](/cli/dev#dev-stop) from that app's directory. + +## Global flags + +The Prisma CLI's [global flags](/cli/global-flags) also apply: `--format`, `--json`, `--log-level`, `--verbose`, `--quiet`, `--yes`, `--confirm`, `--interactive`, `--color`, and `--config`. + +## Next steps + +- [`dev`](/cli/dev): run a Composer app on the emulators, and find or stop its services. +- [Local development](/composer/local-development): how local services, databases, and buckets are kept per directory. diff --git a/apps/docs/content/docs/cli/global-flags.mdx b/apps/docs/content/docs/cli/global-flags.mdx index efd35ae1c96..c221f61b32a 100644 --- a/apps/docs/content/docs/cli/global-flags.mdx +++ b/apps/docs/content/docs/cli/global-flags.mdx @@ -25,7 +25,22 @@ All commands in the unified Prisma CLI accept these flags. ## Output formats -Without `--format`, a terminal gets `human` output and a pipe gets `json`. `markdown` is never chosen for you; pass `--format markdown` to get it. +Without `--format` or `--json`, every run uses `human` output, whether standard output is a terminal, a pipe, or a file. JSON and Markdown are never chosen for you; pass `--json` or `--format markdown` to get them. + +In `human` output, the formatted result, progress, and errors go to standard error. Standard output gets only the command's data lines: plain values with no labels or color, which `cut`, `xargs`, and `$(...)` can take directly. + +- A list prints one line per item, with its fields separated by tabs, in the order the table shows them. +- A command that returns one value, such as a URL or the id of a created resource, prints that value alone. +- A command whose only result is that it succeeded, such as a delete or a stop, writes nothing to standard output. Its exit code is the result, and its message goes to standard error. + +```bash +npx prisma project list | cut -f2 +curl "$(npx prisma dev url gateway)" +``` + +In a terminal you see only the formatted result, because it already shows the same values. The data lines appear when standard output is piped, redirected to a file, or captured by `$(...)`. A script that needs more than the data lines uses `--json`. Some commands do not write data lines yet, so a script reads their result with `--json`: `deploy`, and Prisma ORM commands such as `migration list`, `migration status`, and `contract format`. Two Prisma ORM commands do write usable standard output: `contract print` writes the printed PSL contract, and `contract emit` writes the path of each file it emitted. + +Before `8.0.0-rc.24`, a pipe got `json` output, so add `--json` to any older script that parses JSON. `markdown` is for AI agents that read command output as text rather than parsing JSON. It prints the same content as `human`, as plain Markdown: a summary line, `label: value` lines, pipe tables, bullet lists, and fenced code, followed by a `### Next` section with the suggested next commands and a `### Diagnostics` section with any findings. There is no padding, alignment, or color, and no JSON envelope. Everything the command produces, including errors, help, `--version`, and progress, goes to stdout, so an agent reads one stream. diff --git a/apps/docs/content/docs/cli/meta.json b/apps/docs/content/docs/cli/meta.json index 659af25465a..21c7b18d241 100644 --- a/apps/docs/content/docs/cli/meta.json +++ b/apps/docs/content/docs/cli/meta.json @@ -16,6 +16,7 @@ "bucket", "deploy", "dev", + "emulator", "git", "init", "postgres", diff --git a/apps/docs/content/docs/composer/getting-started.mdx b/apps/docs/content/docs/composer/getting-started.mdx index 5b7bbf8cd68..eb4bdd18cb3 100644 --- a/apps/docs/content/docs/composer/getting-started.mdx +++ b/apps/docs/content/docs/composer/getting-started.mdx @@ -260,13 +260,13 @@ npx tsc --noEmit ## 6. Run it locally -One command brings the whole app up on your machine, both services wired together, with no cloud credentials: +With the build from step 5 in place, one command brings the whole app up on your machine, both services wired together, with no cloud credentials: ```npm npx prisma dev module.ts ``` -It runs the same pipeline a deploy runs, against local stand-ins for Prisma Compute and Prisma Postgres, and prints each service's local URL: +It runs the same pipeline a deploy runs, against local stand-ins for Prisma Compute and Prisma Postgres, and prints each service's local URL once every service accepts connections: ```text no-copy dev: ready @@ -274,28 +274,40 @@ gateway: http://localhost:3001 quotes: http://localhost:3000 ``` -Verify it works by calling the gateway: +Each service gets the lowest free port from 3000 up, so your ports can differ if another program already uses 3000 or 3001. `dev` keeps running in this terminal. + +Verify it works by calling the gateway. Open a second terminal in the same directory and ask `dev url` where the gateway answers, then call it: ```bash -curl localhost:3001 +curl "$(npx prisma dev url gateway)" ``` ```text no-copy +✔ The service gateway is running at http://localhost:3001 Make it work, make it right, make it fast. ``` -That response traveled over one typed RPC hop: the gateway received your request, called `quotes.random({})` through its injected client, and returned the result. +The first line comes from `dev url`, which says what it found; only the bare URL is passed to `curl`. The second line is the gateway's response, one of the two quotes at random. That response traveled over one typed RPC hop: the gateway received your request, called `quotes.random({})` through its injected client, and returned the result. -`dev` keeps running, watches your built output, and restarts a service when its build changes (run `npm run build` in another terminal and the affected service restarts). `Ctrl-C` stops it. Your local data stays, so the next start is warm. See [Local development](/composer/local-development) for logs, `--fresh`, and what persists. +`npx prisma dev url gateway` prints only the gateway's URL, so the command works whichever port the gateway got. If it fails with `DEV.NOT_RUNNING`, the first terminal's `dev` is no longer running; start it again. `dev url` is in `prisma` since `8.0.0-rc.24`. On an older version, call the URL that `dev` printed, for example `curl http://localhost:3001`. -Now try the quotes service directly: +Now try the quotes service directly, from the same second terminal: ```bash -curl -X POST localhost:3000/rpc/random -H 'content-type: application/json' -d '{}' +curl -i -X POST "$(npx prisma dev url quotes)/rpc/random" -H 'content-type: application/json' -d '{}' +``` + +```text no-copy +✔ The service quotes is running at http://localhost:3000 +HTTP/1.1 401 Unauthorized +... +{"error":"Unauthorized: missing or invalid service key"} ``` You get `401 Unauthorized`. That is deliberate: Composer mints a **service key** for each dependency edge and the quotes service accepts only calls from the gateway. Neither service's code mentions a key. See [Services and contracts](/composer/services-and-contracts#calls-are-authenticated-for-you) for how this works. +`dev` watches your built output and restarts a service when its build changes, so run `npm run build` in the second terminal and the affected service restarts. Press `Ctrl-C` in the first terminal to stop the app. Your local data and ports stay, so the next start is warm. See [Local development](/composer/local-development) for logs, running the app in the background, `--fresh`, and what persists. + ## 7. Deploy it (optional) Local dev needed no account. Deploying the same app to [Prisma Compute](/compute) needs a signed-in session: diff --git a/apps/docs/content/docs/composer/local-development.mdx b/apps/docs/content/docs/composer/local-development.mdx index 67f1cdb3dc6..64a4cdb8130 100644 --- a/apps/docs/content/docs/composer/local-development.mdx +++ b/apps/docs/content/docs/composer/local-development.mdx @@ -3,7 +3,7 @@ title: Local development description: Run the whole app on your machine with prisma dev, with no cloud credentials, and tail its logs through the control API. url: /composer/local-development metaTitle: Local development | Prisma Composer -metaDescription: Run a Prisma Composer app locally with prisma dev, tail merged service logs through the control API, and understand warm restarts, --fresh, and local emulators. +metaDescription: Run a Prisma Composer app locally with prisma dev, find a running service's URL with prisma dev url, run the app in the background, and understand ports, warm restarts, --fresh, and local emulators. --- One command brings your whole app up on your machine, every service, its databases and buckets, wired together, with no cloud credentials. `dev` runs the same pipeline a deploy runs, but against local stand-ins for Prisma Compute and Prisma Postgres, so what you run locally is what you ship. Logs are read separately, through the control API's `log` operation. @@ -11,10 +11,17 @@ One command brings your whole app up on your machine, every service, its databas | You want to... | Run | | --- | --- | | Bring the app up locally | `npx prisma dev module.ts` | -| Start clean (wipe local data first) | `npx prisma dev module.ts --fresh` (fails for apps with a database in this release; see [the reset steps](#whats-local-vs-whats-real)) | +| Find where a service answers | `npx prisma dev url
` | +| Run the app in the background | `npx prisma dev module.ts --detach` | +| Stop the app | `Ctrl-C`, or `npx prisma dev stop` | +| Start clean (wipe local data first) | `npx prisma dev module.ts --fresh` | +| See everything running on this machine | `npx prisma emulator list` | +| Watch the app's logs | the `log` operation (see [Logs](#logs)) | `module.ts` is your entry file, the one whose default export is the root module, the same file you pass to `deploy`. No `PRISMA_*` variables are needed. Local dev never talks to the platform. +`prisma dev url`, `prisma dev stop`, `--detach`, and `prisma emulator list` are in `prisma` since `8.0.0-rc.24`. Check your version with `npx prisma --version`. + ## Bring it up Like deploy, `dev` runs your *built* output, so build first: @@ -32,20 +39,125 @@ gateway: http://localhost:3001 quotes: http://localhost:3000 ``` -From here `dev` keeps running: it watches your built output and, when a service's build changes, restarts only that service. Rebuild in another terminal and the affected service picks up the change. +`dev` prints `ready` only once every service accepts connections on its port, so a request to a printed URL right away connects. If a service exits before it listens, or does not listen within 30 seconds, `dev` fails instead, stops the app's other services, and names the service, its port, and its log file. -`Ctrl-C` stops your app's service processes and exits. The local databases, buckets, and their data stay up, so the next `dev` is a warm start: same ports, same data. `--fresh` wipes this app's local instances and data before starting. +From here `dev` keeps running: it watches your built output and, when a service's build changes, restarts only that service. Rebuild in another terminal and the affected service picks up the change. `dev` does not print service logs. With several services running, streaming them all inline would bury the URL list and the restart notices, so logs are read separately. +## Ports + +On a fresh start, each service gets the lowest free port from 3000 up. A service gets its port before the services that call it, so in the example above `quotes` gets 3000 and `gateway`, which calls it, gets 3001. A port that another program already uses is skipped. + +A service or database keeps its port from one `dev` to the next in the same directory, even while it is stopped. If another directory has taken that port in the meantime, the instance gets the lowest free one, and `dev` prints one line naming it: + +```text no-copy +[dev] service "gateway" now uses port 3004: its previous port 3001 is in use +``` + +Because ports differ from one machine and one directory to the next, do not hard-code `localhost:3001` in scripts or notes. Ask `dev url` instead. + +## Find a running service + +From another terminal in the same directory, ask where a service of the running app answers, by its address: + +```npm +npx prisma dev url gateway +``` + +```text no-copy +✔ The service gateway is running at http://localhost:3001 +``` + +The address is the name `dev` printed next to the URL at startup. `dev url` also works for the app's databases and buckets: a database or bucket inside a module has a dotted address, such as `catalog.database`. For a database, `dev url` prints its connection string with the local credentials, and for a bucket, its S3 endpoint followed by `/`. + +When its output is captured by `$(...)` or piped, `dev url` writes the URL alone, so a script can use it directly. Check the exit status first, so a failure does not run `curl` with an empty URL: + +```bash +url=$(npx prisma dev url gateway) && curl "$url" +``` + +`dev url` prints a URL only for a node that is running. When the app is stopped, or `prisma dev` never ran in this directory, it fails with an error code a script can check; the [`dev url` reference](/cli/dev#dev-url) lists them. + +## Run it in the background + +`--detach` brings the app up as `dev` does, prints the same URLs, and then exits with code `0`, leaving the app running. Use it in scripts, CI, and coding agents, which then have no long-running process to manage: + +```npm +npm run build +npx prisma dev module.ts --detach +curl "$(npx prisma dev url gateway)" +npx prisma dev stop +``` + +A detached app does not pick up rebuilds. To apply a new build, run `prisma dev module.ts --detach` again, or run `prisma dev module.ts` in the foreground: it applies the current build to the running app, then watches for rebuilds as usual, and `Ctrl-C` stops the app. + +If a detached start fails before every service answers, `dev` stops the whole app and exits non-zero. That includes an app an earlier `--detach` left running, because the failed start has already replaced some of its services. Fix the build and run `prisma dev module.ts --detach` again. + +## Stop the app + +`Ctrl-C` stops your app's service processes and its local Postgres servers, and exits. The emulators that ran them keep running for the next start. So does `dev` ending on a failure. A detached app keeps running until you stop it: + +```npm +npx prisma dev stop +``` + +`dev stop` stops the app that `prisma dev` last ran from this directory and lists what it stopped. When nothing of the app was running, it prints `Nothing of my-app was running.` and still succeeds, with `my-app` replaced by your app's name. Use it too when `prisma dev` was killed without a chance to stop the app. + +Stopping keeps the data and the ports, so the next `dev` is a warm start: same ports, same data. + +## Each directory runs its own app + +The services, databases, and buckets `dev` runs belong to the directory you run it in. Two checkouts of the same app, such as two clones of its repository, run separate service processes on separate ports, with separate databases and separate buckets. A rebuild in one never restarts the other's services, and a row or an object written in one is not visible in the other. + +A directory keeps the local state of every app you run from it. If you run a different app from the same directory (another entry file, or the same one under another name with `--name`), `dev` first stops the previous app's services and databases, keeps their data and ports, and says so: + +```text no-copy +[dev] stopped the local services of "shop", the app run here before; its data is kept +``` + +Running `shop` again with `prisma dev` resumes it. + +A stopped service or database keeps its port reserved, and a database keeps its data, even after you delete the checkout. There is no command to remove them yet. + +## Start clean with `--fresh` + +`--fresh` deletes this app's local services, databases, and buckets, with their data, before starting. The next start creates them again, empty, and gives the services the lowest free ports. Other apps run from the same directory keep theirs. Use it when your local data is disposable, which during development it usually is: + +```npm +npx prisma dev module.ts --fresh +``` + +Run with `--fresh` too if `dev` fails after you upgrade Composer with an error such as `No provider is registered for resource type 'PrismaComposer.Database'`. Local state from an older Composer version is not converted for the new one. + +## See everything on this machine + +An emulator is the program on your machine that stands in for Prisma Compute, Prisma Postgres, or a bucket, and holds one instance for each service, database, or bucket that `dev` started. The emulators are shared by every directory on the machine. `emulator list` shows each emulator, whether it is running, and every instance it holds, with the address and directory it belongs to. It works from any directory: + +```npm +npx prisma emulator list +``` + +See the [`emulator` reference](/cli/emulator) for the output and its piped form. + ## Logs The unified CLI has no `log` command. Tail the merged logs of the already-running app with the `log` operation from `@prisma/composer/control`, the same in-process API that backs `deploy` and `dev` (see [the control API](/cli/deploy#the-control-api)): ```ts title="logs.ts" +import { fileURLToPath } from 'node:url'; import { log } from '@prisma/composer/control'; - -const result = await log({ entry: 'module.ts', tail: 20, signal: AbortSignal.timeout(60_000) }); +import prismaConfig from './prisma.config.ts'; + +const result = await log({ + entry: 'module.ts', + config: { + value: prismaConfig.composer, + file: fileURLToPath(new URL('./prisma.config.ts', import.meta.url)), + }, + tail: 20, + signal: AbortSignal.timeout(60_000), +}); if (!result.ok) throw new Error(result.failure.message); for await (const { service, line } of result.value.lines) { @@ -53,7 +165,7 @@ for await (const { service, line } of result.value.lines) { } ``` -Run it with `node logs.ts` next to a running `dev`. `log` attaches to the running app and hands back the merged stream as `lines`, an async iterable, so nothing prints until you iterate it. The `signal` ends the stream, here after a minute, so the script exits on its own; leave it out and stop with `Ctrl-C`. Each line carries the service it came from: +`log` reads the `composer` section of your `prisma.config.ts`, so the script imports it and passes it as `config`. Run it with `node logs.ts` from the directory you run `dev` in, while `dev` runs. `log` attaches to the running app and returns the merged stream as `lines`, an async iterable, so nothing prints until you iterate it. The `signal` ends the stream, here after a minute, so the script exits on its own; leave it out and stop with `Ctrl-C`. Each line carries the service it came from: ```text no-copy [quotes] serving a quote @@ -62,9 +174,9 @@ Run it with `node logs.ts` next to a running `dev`. `log` attaches to the runnin It follows live, like `tail -f`. It only reads the running app. It never builds, provisions, starts, or stops anything, so you can start and stop it freely alongside a running `dev`. -- **One service:** pass its dotted address, for example `cron.runner`, exactly as the startup output prints it. -- **How much history:** a tail option sets how many recent lines to show before going live (default 20; `0` for live-only). Each service's log is cleared when it starts fresh, so you are never scrolling back through past sessions. -- **No running app:** if you have not run `dev` (or you stopped it), the operation says so and points you at `dev`. +- **One service:** pass `address`, for example `address: 'cron.runner'`, exactly as the startup output prints it. +- **How much history:** `tail` sets how many recent lines to show before going live (default `0`, live only). Each service's log is cleared when it starts fresh, so you are never scrolling back through past sessions. +- **No running app:** if you have not run `dev` (or you stopped it), `log` succeeds with an empty `services` list and a stream that has already ended, so the script prints nothing and exits. ## What's local vs. what's real @@ -72,8 +184,7 @@ Everything above the cloud boundary is real: your actual service code, real data - **Direct RPC probes get `401` here too.** `dev` runs the deploy pipeline, so providers only accept their wired consumers, exactly as in production. Exercise a provider through a consumer, or in [tests](/composer/testing), where nothing is provisioned and every call passes through. - **Unset secrets do not stop the app.** A secret you have not set in your shell gets a local placeholder and a one-line warning. The app boots and serves. Only the code path that actually uses that secret fails, at the real external service it calls. Set the secret in your shell to exercise that path. -- **The emulators outlive a session.** They are shared, machine-wide daemons, so your data survives `Ctrl-C` and even a reboot until you pass `--fresh`. That is what makes restarts warm. Because they are shared, `dev` currently lists every app the emulators know about, including apps you started earlier and stopped, so ignore endpoints whose names are not in your `module.ts`. -- **`--fresh` currently fails for an app with a database.** The Postgres emulator declines to close the app's local server, the recreate step cannot connect, and a plain `dev` afterwards waits forever on the missing database. To recover, stop the stuck `dev`, remove the app's local server with `npx prisma dev rm pcdev--` (run it from a directory without a Prisma ORM config), delete `.prisma-composer/dev` and `.alchemy` in the project, and run `dev` again. It re-provisions from scratch. The same reset fixes a `dev` that reports ready with none of its services listed, which happens when the emulators were restarted underneath a project. +- **The emulators outlive a session.** They are shared, machine-wide programs, so your data survives `Ctrl-C` and even a reboot until you pass `--fresh`. That is what makes restarts warm. Windows is not supported yet; see [Limitations](/composer/limitations). diff --git a/apps/docs/content/docs/composer/porting-an-app.mdx b/apps/docs/content/docs/composer/porting-an-app.mdx index 844bb114346..24ac47c4206 100644 --- a/apps/docs/content/docs/composer/porting-an-app.mdx +++ b/apps/docs/content/docs/composer/porting-an-app.mdx @@ -22,7 +22,7 @@ Port this app to Prisma Composer. 3. Declare each server as a service with `compute()`, using the `node` or `nextjs` build adapter as appropriate, and compose them in a single `module.ts`. 4. Replace the `process.env` reads: the listen port becomes `service.port()` bound to `0.0.0.0`, config and credentials become fields of the service input schema, and anything another service provides becomes a typed dependency. Replace the URLs services use to reach each other with contracts. 5. If the app talks to Postgres, declare `rawPostgres()` (from `@prisma/composer-prisma-cloud`) as a dependency and build the existing client from the injected `db.url` instead of a connection-string variable. -6. Verify with `npx tsc --noEmit`, then build and run `npx prisma dev module.ts` and confirm every service boots with a local URL. Do not deploy; show me the diff first. +6. Verify with `npx tsc --noEmit`, then build and run `npx prisma dev module.ts --detach`, confirm every service boots with a local URL, and run `npx prisma dev stop`. Do not deploy; show me the diff first. ``` diff --git a/apps/docs/content/docs/guides/compute/astro-marketing-site.mdx b/apps/docs/content/docs/guides/compute/astro-marketing-site.mdx index 47366368311..4f8b687aaa6 100644 --- a/apps/docs/content/docs/guides/compute/astro-marketing-site.mdx +++ b/apps/docs/content/docs/guides/compute/astro-marketing-site.mdx @@ -253,15 +253,14 @@ npx prisma dev module.ts ``` ```text no-copy -[dev] compute emulator ready at http://127.0.0.1:4300 -... -{"kind":"endpoint","name":"web","url":"http://localhost:3032"} +dev: ready +web: http://localhost:3000 ``` -Check each route against the URL `dev` printed (your port may differ): +`dev` keeps running. From a second terminal in the same directory, check each route. `prisma dev url web` prints the URL of the `web` service, whichever port it got: ```bash -curl -s -o /dev/null -w "%{http_code}\n" http://localhost:3032/pricing +curl -s -o /dev/null -w "%{http_code}\n" "$(npx prisma dev url web)/pricing" ``` ```text no-copy @@ -350,7 +349,7 @@ Build a static Astro marketing site and deploy it to Prisma Compute. Follow http 2. Build the pages I describe (default: a shared layout in `src/layouts/Base.astro` plus home, pricing, and about pages). Keep every page static; do not set `output: "server"`. 3. Run `npx astro add node --yes` so `astro.config.mjs` uses `node({ mode: "standalone" })`. Run `npm run build` and confirm `dist/server/entry.mjs` exists. 4. Install `@prisma/composer` and `@prisma/composer-prisma-cloud`, and `prisma` as a dev dependency. Add `service.ts`, `module.ts`, and `prisma.config.ts` exactly as the guide shows, and add `/.alchemy` and `/.prisma-composer` to `.gitignore`. -5. Run `npx prisma dev module.ts` in the background, curl each page at the printed URL and confirm a 200, then stop it. +5. Run `npx prisma dev module.ts --detach`, curl each page under `$(npx prisma dev url web)` and confirm a 200, then run `npx prisma dev stop`. 6. Deploy: check `npx prisma auth whoami`; if I am not signed in, stop and ask me to run `npx prisma auth login`. Then run `npm run build` followed by `npx prisma deploy module.ts`, and curl the printed URL to confirm the home page renders. ``` diff --git a/apps/docs/content/docs/guides/deployment/cloudflare-workers.mdx b/apps/docs/content/docs/guides/deployment/cloudflare-workers.mdx index 674b3ff5bff..54b61a16429 100644 --- a/apps/docs/content/docs/guides/deployment/cloudflare-workers.mdx +++ b/apps/docs/content/docs/guides/deployment/cloudflare-workers.mdx @@ -95,7 +95,7 @@ Without `--yes`, the command asks for the contract authoring style and the schem ```json no-copy {"kind":"step-finished","step":"npm add @prisma/orm-postgres dotenv","outcome":"ok"} {"kind":"step-finished","step":"npm add -D prisma@latest","outcome":"ok"} -{"kind":"step-finished","step":"npm add -D @prisma/cli-engine@0.7.0","outcome":"ok"} +{"kind":"step-finished","step":"npm add -D @prisma/cli-engine@0.9.0","outcome":"ok"} {"kind":"step-finished","step":"Emit the contract","outcome":"ok"} {"kind":"result","envelope":{"ok":true,"result":{"target":"postgres","authoring":"psl","schemaPath":"src/prisma/contract.prisma","filesWritten":["src/prisma/contract.prisma","prisma.config.ts","src/prisma/db.ts","prisma-8.md",".env.example","tsconfig.json",".gitignore",".gitattributes","package.json","README.md"]}}} ``` diff --git a/apps/docs/content/docs/guides/deployment/docker.mdx b/apps/docs/content/docs/guides/deployment/docker.mdx index 168ec649b8c..8363a98e148 100644 --- a/apps/docs/content/docs/guides/deployment/docker.mdx +++ b/apps/docs/content/docs/guides/deployment/docker.mdx @@ -90,7 +90,7 @@ package.json declares "type": "commonjs" ... the scaffolded prisma/db.ts uses an If you want the default, set "type": "module" in package.json. ✔ npm add @prisma/orm-postgres dotenv ✔ npm add -D prisma@latest @types/node -✔ npm add -D @prisma/cli-engine@0.7.0 +✔ npm add -D @prisma/cli-engine@0.9.0 ✔ Emit the contract │ target: postgres │ authoring: psl @@ -483,13 +483,20 @@ docker compose logs server ```text no-copy server-1 | > docker-test@1.0.0 db:migrate server-1 | > prisma db migrate -server-1 | {"kind":"result","envelope":{"ok":true,"commandId":"db.migrate","result":{"ok":true,"migrationsApplied":1,"migrationsTotal":1,...,"summary":"Applied 1 migration(s) (3 operation(s)) across 1 contract space(s)",...}}} +server-1 | ... +server-1 | ✔ Applied 1 migration(s) (3 operation(s)) across 1 contract space(s) +server-1 | App space +server-1 | ├─ Create schema "public" +server-1 | ├─ Create table "User" +server-1 | ├─ Add unique constraint on "User" (email) +server-1 | └─ marker ... +server-1 | ... server-1 | > docker-test@1.0.0 start server-1 | > node src/index.ts server-1 | Server is running on http://localhost:3000 ``` -The CLI prints JSON lines when it has no terminal attached, which is what you see in container logs. Restart the server and the migration step becomes a no-op: +The CLI prints the same human-readable output in a container as in a terminal, without color. (Before `8.0.0-rc.24` it printed JSON lines when it had no terminal attached.) Restart the server and the migration step becomes a no-op: ```bash docker compose restart server @@ -497,7 +504,9 @@ docker compose logs --since 30s server ``` ```text no-copy -server-1 | ...,"summary":"Already up to date",... +server-1 | ... +server-1 | ✔ Already up to date +server-1 | ... server-1 | Server is running on http://localhost:3000 ``` diff --git a/apps/docs/content/docs/guides/deployment/pnpm-workspaces.mdx b/apps/docs/content/docs/guides/deployment/pnpm-workspaces.mdx index e31cef9cb24..9df090be55d 100644 --- a/apps/docs/content/docs/guides/deployment/pnpm-workspaces.mdx +++ b/apps/docs/content/docs/guides/deployment/pnpm-workspaces.mdx @@ -95,8 +95,8 @@ Answer the prompts: choose `PSL` for the authoring style and keep the other defa ✔ pnpm add @prisma/orm-postgres dotenv ▸ pnpm add -D prisma@latest @types/node ✔ pnpm add -D prisma@latest @types/node -▸ pnpm add -D @prisma/cli-engine@0.7.0 -✔ pnpm add -D @prisma/cli-engine@0.7.0 +▸ pnpm add -D @prisma/cli-engine@0.9.0 +✔ pnpm add -D @prisma/cli-engine@0.9.0 ▸ Emit the contract ✔ Emit the contract │ target: postgres diff --git a/apps/docs/content/docs/guides/deployment/turborepo.mdx b/apps/docs/content/docs/guides/deployment/turborepo.mdx index ef33c4f408b..d2eab5dbdde 100644 --- a/apps/docs/content/docs/guides/deployment/turborepo.mdx +++ b/apps/docs/content/docs/guides/deployment/turborepo.mdx @@ -343,7 +343,7 @@ CREATE TABLE "public"."Post" ( ... ``` -Turborepo shows the tasks in a terminal UI while they run and leaves each task's log in your terminal when it exits. Without a terminal, for example in CI, the Prisma CLI prints JSON instead; add `--format human` to the script to keep the human-readable output. See [Global flags](/cli/global-flags). +Turborepo shows the tasks in a terminal UI while they run and leaves each task's log in your terminal when it exits. Without a terminal, for example in CI, the Prisma CLI prints the same human-readable output. Before `8.0.0-rc.24` it printed JSON there; add `--format human` to the script on those versions. See [Global flags](/cli/global-flags#output-formats). The command is offline: it writes `packages/database/migrations/app/_init/` with the migration as TypeScript (`migration.ts`), the compiled operations (`ops.json`), and the history marker (`migration.json`), and prints the exact DDL it will run. Review it, then apply it: diff --git a/apps/docs/content/docs/guides/frameworks/react-router-7.mdx b/apps/docs/content/docs/guides/frameworks/react-router-7.mdx index 63130cc228b..7c2d41824b9 100644 --- a/apps/docs/content/docs/guides/frameworks/react-router-7.mdx +++ b/apps/docs/content/docs/guides/frameworks/react-router-7.mdx @@ -69,7 +69,7 @@ npx prisma@latest orm init --yes --target postgres --authoring psl Updated tsconfig.json with required compiler options. npm add @prisma/orm-postgres dotenv npm add -D prisma@latest -npm add -D @prisma/cli-engine@0.7.0 +npm add -D @prisma/cli-engine@0.9.0 Emit the contract filesWritten: src/prisma/contract.prisma, prisma.config.ts, src/prisma/db.ts, diff --git a/apps/docs/content/docs/guides/frameworks/solid-start.mdx b/apps/docs/content/docs/guides/frameworks/solid-start.mdx index 2ac4af1ea3d..2b4640b60ec 100644 --- a/apps/docs/content/docs/guides/frameworks/solid-start.mdx +++ b/apps/docs/content/docs/guides/frameworks/solid-start.mdx @@ -71,7 +71,7 @@ npx prisma@latest orm init --yes --target postgres --authoring psl Updated tsconfig.json with required compiler options. ✔ npm add @prisma/orm-postgres dotenv ✔ npm add -D prisma@latest @types/node -✔ npm add -D @prisma/cli-engine@0.7.0 +✔ npm add -D @prisma/cli-engine@0.9.0 ✔ Emit the contract │ target: postgres │ authoring: psl @@ -397,7 +397,7 @@ check: enabled Skill Package Version Installed into prisma-8 @prisma/orm-postgres 8.0.0-rc.18 .claude/skills, .cursor/skills, .agents/skills, .devin/skills prisma-composer-core-concepts @prisma/composer 0.29.1 .claude/skills, .cursor/skills, .agents/skills, .devin/skills -prisma-platform-core-concepts prisma 8.0.0-rc.23 .claude/skills, .cursor/skills, .agents/skills, .devin/skills +prisma-platform-core-concepts prisma 8.0.0-rc.24 .claude/skills, .cursor/skills, .agents/skills, .devin/skills ⚠ [INIT.CONFIG_KEPT] prisma.config.ts already exists, so init left it alone instead of writing the skills section. → Add skills: { agents: ["claude", "cursor", "agents", "devin"] } to the object passed to definePrismaConfig in prisma.config.ts. diff --git a/apps/docs/content/docs/guides/switch-to-prisma-orm/from-drizzle.mdx b/apps/docs/content/docs/guides/switch-to-prisma-orm/from-drizzle.mdx index 3008cd1fa39..468ab1823b2 100644 --- a/apps/docs/content/docs/guides/switch-to-prisma-orm/from-drizzle.mdx +++ b/apps/docs/content/docs/guides/switch-to-prisma-orm/from-drizzle.mdx @@ -176,7 +176,7 @@ Choose `PSL` as the authoring style and keep the default schema path, `src/prism ```text no-copy ✔ npm add @prisma/orm-postgres dotenv ✔ npm add -D prisma@latest -✔ npm add -D @prisma/cli-engine@0.7.0 +✔ npm add -D @prisma/cli-engine@0.9.0 ✔ Emit the contract │ target: postgres │ authoring: psl diff --git a/apps/docs/content/docs/guides/switch-to-prisma-orm/from-mongoose.mdx b/apps/docs/content/docs/guides/switch-to-prisma-orm/from-mongoose.mdx index 8f56fc6ba6b..39853a65afa 100644 --- a/apps/docs/content/docs/guides/switch-to-prisma-orm/from-mongoose.mdx +++ b/apps/docs/content/docs/guides/switch-to-prisma-orm/from-mongoose.mdx @@ -146,7 +146,7 @@ Choose `PSL` when asked for the contract authoring style and keep the default sc ```text no-copy ✔ npm add @prisma/orm-mongo dotenv ✔ npm add -D prisma@latest -✔ npm add -D @prisma/cli-engine@0.7.0 +✔ npm add -D @prisma/cli-engine@0.9.0 ✔ Emit the contract │ target: mongodb │ authoring: psl @@ -165,7 +165,7 @@ installed ├─ @prisma/orm-mongo ├─ dotenv ├─ prisma@latest (dev) -└─ @prisma/cli-engine@0.7.0 (dev) +└─ @prisma/cli-engine@0.9.0 (dev) ✔ Done. Open prisma-8.md to get started. ``` diff --git a/apps/docs/content/docs/guides/upgrade-prisma-orm/postgresql.mdx b/apps/docs/content/docs/guides/upgrade-prisma-orm/postgresql.mdx index 3a7f9667ba8..9f9bcd0b83c 100644 --- a/apps/docs/content/docs/guides/upgrade-prisma-orm/postgresql.mdx +++ b/apps/docs/content/docs/guides/upgrade-prisma-orm/postgresql.mdx @@ -228,7 +228,7 @@ After this install, `npx prisma ` runs the Prisma ORM 8 CLI and `npx pr npx prisma --version ``` -**Expected result:** the command prints `8.0.0-rc.23` or a newer version. That number does not match the version of `@prisma/orm-postgres`, because the CLI is released separately. +**Expected result:** the command prints `8.0.0-rc.24` or a newer version. That number does not match the version of `@prisma/orm-postgres`, because the CLI is released separately. ### 2.2. Create the Prisma ORM 8 config diff --git a/apps/docs/content/docs/local-development/postgres.mdx b/apps/docs/content/docs/local-development/postgres.mdx index 1fa9915b17b..952636ab51e 100644 --- a/apps/docs/content/docs/local-development/postgres.mdx +++ b/apps/docs/content/docs/local-development/postgres.mdx @@ -8,7 +8,7 @@ metaDescription: Guide to setting up local development using Prisma Postgres :::note[This guide uses Prisma ORM 7] -Local Prisma Postgres runs through the Prisma ORM 7 command-line tool, so the commands on this page are written as `npx prisma@7`. In a project that already has Prisma ORM 7 installed, `npx prisma` runs that version too. In the Prisma ORM 8 command-line tool, `prisma dev` does something else: it runs a [Prisma Composer](/composer/local-development) application on your machine. See [Release status](/orm/release-status#how-to-stay-on-prisma-orm-7) for how to stay on Prisma ORM 7. +Local Prisma Postgres runs through the Prisma ORM 7 command-line tool, so the commands on this page are written as `npx prisma@7`. In a project that already has Prisma ORM 7 installed, `npx prisma` runs that version too. In the Prisma ORM 8 command-line tool, `prisma dev` does something else: it runs a [Prisma Composer](/composer/local-development) application on your machine, and `prisma dev stop` stops that application. See [Release status](/orm/release-status#how-to-stay-on-prisma-orm-7) for how to stay on Prisma ORM 7. ::: @@ -92,7 +92,7 @@ Alternatively, you can run the server in detached mode to free up your terminal: npx prisma@7 dev --detach ``` -This starts the server in the background. Use `prisma dev ls` to see running servers and `prisma dev stop` to stop them. +This starts the server in the background. Use `npx prisma@7 dev ls` to see running servers and `npx prisma@7 dev stop default` to stop this one, which runs under the default name `default`. ### 2. Applying migrations and seeding data diff --git a/apps/docs/content/docs/orm/release-status.mdx b/apps/docs/content/docs/orm/release-status.mdx index 5cdfc73901d..c4f4feeb9f3 100644 --- a/apps/docs/content/docs/orm/release-status.mdx +++ b/apps/docs/content/docs/orm/release-status.mdx @@ -39,9 +39,9 @@ For MongoDB the library is `@prisma/orm-mongo`. [Supported databases](/orm/suppo The two packages have different version numbers, and that is normal: they are released separately, and the command-line tool gets more frequent releases. Install both at `latest`; any two `latest` versions work together, and you do not pair the numbers yourself. -| Package | `latest` on 16 October 2026 | +| Package | `latest` on 21 October 2026 | | --- | --- | -| `prisma` (the command-line tool) | `8.0.0-rc.23` | +| `prisma` (the command-line tool) | `8.0.0-rc.24` | | `@prisma/orm-postgres` (the library) | `8.0.0-rc.18` | | `@prisma/orm-mongo` (the MongoDB library) | `8.0.0-rc.18` |