# Overview (/docs/cli) > For the complete Prisma documentation index, see [llms.txt](https://www.prisma.io/docs/llms.txt). A markdown version of any docs page is available by appending `.md` to its URL. Prisma CLI reference Location: Overview Prisma ORM ships with a unified Prisma CLI. One binary contains the ORM commands and the platform commands for [Prisma Composer](https://www.prisma.io/docs/composer), [Prisma Compute](https://www.prisma.io/docs/compute), Prisma Postgres, and object-store buckets. > [!NOTE] > Prisma ORM 7 users > > Prisma ORM 8 is a release candidate. Prisma ORM 7 remains fully supported; its docs live at [/orm/v7](https://www.prisma.io/docs/orm/v7) and its setup paths at [/v7/getting-started](https://www.prisma.io/docs/v7/getting-started). > > For what release candidate means, when the final release is expected, and how to stay on version 7, see [Release status](https://www.prisma.io/docs/orm/release-status). For the Prisma ORM 8 name of every Prisma ORM 7 API, see [Coming from Prisma ORM 7](https://www.prisma.io/docs/orm/coming-from-prisma-orm-7). The Prisma ORM CLI ships in the `prisma` package. Run it without installing: #### npm ```bash npx prisma --help npx prisma contract emit ``` #### pnpm ```bash pnpm prisma --help pnpm prisma contract emit ``` #### yarn ```bash yarn prisma --help yarn prisma contract emit ``` #### bun ```bash bunx prisma --help bunx prisma contract emit ``` With `prisma` installed in your project, these commands become plain `prisma contract emit` and so on. For a full app scaffold, follow [Create a new app with PostgreSQL](https://www.prisma.io/docs/prisma-orm/quickstart/postgresql). That path creates the project files and package scripts for you. This CLI reference is for the lower-level commands those scripts call. ## Platform commands [#platform-commands] The platform commands manage the services, databases, and buckets your app runs on. With [`deploy`](https://www.prisma.io/docs/cli/deploy) and [`dev`](https://www.prisma.io/docs/cli/dev) you deploy a [Prisma Composer](https://www.prisma.io/docs/composer) app to [Prisma Compute](https://www.prisma.io/docs/compute) and run it locally; with [`service`](https://www.prisma.io/docs/cli/service) and [`git`](https://www.prisma.io/docs/cli/git) you manage services, their versions, logs, and domains, and the repository connection. With [`postgres`](https://www.prisma.io/docs/cli/postgres) you spin up and manage [Prisma Postgres](https://www.prisma.io/docs/postgres) databases. With [`bucket`](https://www.prisma.io/docs/cli/bucket) you create blob-storage buckets and their access keys. [`auth`](https://www.prisma.io/docs/cli/auth), [`project`](https://www.prisma.io/docs/cli/project), and [`branch`](https://www.prisma.io/docs/cli/branch) handle the account, project, and branch plumbing around them. Each command group has its own page in this section. Deployments are created by `deploy`, by a git push once you [set up deploy on push](https://www.prisma.io/docs/compute/deploy-on-push), or from the [Console](https://pris.ly/pdp), and each deploy produces a service **version**. ## Common workflows [#common-workflows] Platform users deploy apps, create databases, and provision buckets with the [platform commands](#platform-commands), while ORM users manage their schema, contracts, and migrations with the ORM and migration commands. ### Deploy an app [#deploy-an-app] Sign in, then build and deploy a [Prisma Composer](https://www.prisma.io/docs/composer) app. `deploy` creates the project on its first run, and a new project needs a region, set in the deploy config or as `PRISMA_REGION`; see [`deploy`](https://www.prisma.io/docs/cli/deploy). #### npm ```bash npx prisma auth login npm run build npx prisma deploy ``` #### pnpm ```bash pnpm prisma auth login pnpm run build pnpm prisma deploy ``` #### yarn ```bash yarn prisma auth login yarn build yarn prisma deploy ``` #### bun ```bash bunx prisma auth login bun run build bunx prisma deploy ``` To deploy on every push, also connect the repository with [`git connect`](https://www.prisma.io/docs/cli/git) and add the deploy workflow; see [Deploy on push](https://www.prisma.io/docs/compute/deploy-on-push). Follow a deploy with [`service logs`](https://www.prisma.io/docs/cli/service) and manage the result with the [`service` commands](https://www.prisma.io/docs/cli/service). ### Create a database [#create-a-database] #### npm ```bash npx prisma postgres create mydb npx prisma postgres connection create mydb ``` #### pnpm ```bash pnpm prisma postgres create mydb pnpm prisma postgres connection create mydb ``` #### yarn ```bash yarn prisma postgres create mydb yarn prisma postgres connection create mydb ``` #### bun ```bash bunx prisma postgres create mydb bunx prisma postgres connection create mydb ``` `postgres create` prints a one-time connection URL; `postgres connection create` mints another when you need one. See [`postgres`](https://www.prisma.io/docs/cli/postgres). ### Create a bucket [#create-a-bucket] #### npm ```bash npx prisma bucket create --name my-bucket npx prisma bucket key create ``` #### pnpm ```bash pnpm prisma bucket create --name my-bucket pnpm prisma bucket key create ``` #### yarn ```bash yarn prisma bucket create --name my-bucket yarn prisma bucket key create ``` #### bun ```bash bunx prisma bucket create --name my-bucket bunx prisma bucket key create ``` `bucket key create` prints the key's one-time credentials. See [`bucket`](https://www.prisma.io/docs/cli/bucket). ### Start in an existing project [#start-in-an-existing-project] #### npm ```bash npx prisma@latest orm init --target postgres --authoring psl npx prisma contract emit npx prisma db init --db "$DATABASE_URL" --advance-ref db ``` #### pnpm ```bash pnpm dlx prisma@latest orm init --target postgres --authoring psl pnpm prisma contract emit pnpm prisma db init --db "$DATABASE_URL" --advance-ref db ``` #### yarn ```bash yarn dlx prisma@latest orm init --target postgres --authoring psl yarn prisma contract emit yarn prisma db init --db "$DATABASE_URL" --advance-ref db ``` #### bun ```bash bunx prisma@latest orm init --target postgres --authoring psl bunx prisma contract emit bunx prisma db init --db "$DATABASE_URL" --advance-ref db ``` The [ref](https://www.prisma.io/docs/cli/migration-ref) named `db` is a file in your repository, `migrations/app/refs/db.json`, that records which version of your contract your development database has, and [`migration plan`](https://www.prisma.io/docs/cli/migration-plan) starts from that version. When you leave `--db` off and let the connection come from `prisma.config.ts`, `db init` and `db update` point the `db` ref at the state they applied. When you pass `--db`, they leave the ref alone, so add `--advance-ref db` as above. Without it, an existing `db` ref keeps naming an older state, and a later `migration plan` starts from that out-of-date contract. If the ref was never created, `migration plan` refuses with `MIGRATION.PLAN_ORIGIN_UNKNOWN` as soon as migrations exist on disk. ### Adopt an existing database [#adopt-an-existing-database] Use this when the database already has tables and you want Prisma ORM to describe them instead of creating them. Run it in a project that `orm init` set up. `contract infer` reads the tables and writes them to `src/prisma/contract.prisma`, replacing the starter contract that `contract emit` reads, so commit or copy any changes you made to it first. In general, it writes `contract.prisma` in the folder where `contract emit` writes its files. If your contract is a `contract.ts` file, `contract emit` keeps reading that file until you set `contract` in `prisma.config.ts` to the new `contract.prisma`. #### npm ```bash npx prisma contract infer --db "$DATABASE_URL" npx prisma contract emit npx prisma db sign --db "$DATABASE_URL" npx prisma db verify --db "$DATABASE_URL" ``` #### pnpm ```bash pnpm prisma contract infer --db "$DATABASE_URL" pnpm prisma contract emit pnpm prisma db sign --db "$DATABASE_URL" pnpm prisma db verify --db "$DATABASE_URL" ``` #### yarn ```bash yarn prisma contract infer --db "$DATABASE_URL" yarn prisma contract emit yarn prisma db sign --db "$DATABASE_URL" yarn prisma db verify --db "$DATABASE_URL" ``` #### bun ```bash bunx prisma contract infer --db "$DATABASE_URL" bunx prisma contract emit bunx prisma db sign --db "$DATABASE_URL" bunx prisma db verify --db "$DATABASE_URL" ``` If you pass `--output` to write the file somewhere else, set `contract` in `prisma.config.ts` to the same path, or `contract emit` keeps reading the old file. `db sign` also sets the `db` ref to the signed contract, so the next `migration plan` starts from the database you adopted. Pass `--no-advance-ref` to sign without changing any ref. ### Use checked-in migrations [#use-checked-in-migrations] #### npm ```bash npx prisma contract emit npx prisma migration plan --name add_users npx prisma migration status --db "$DATABASE_URL" npx prisma db migrate --db "$DATABASE_URL" --advance-ref db npx prisma db verify --db "$DATABASE_URL" ``` #### pnpm ```bash pnpm prisma contract emit pnpm prisma migration plan --name add_users pnpm prisma migration status --db "$DATABASE_URL" pnpm prisma db migrate --db "$DATABASE_URL" --advance-ref db pnpm prisma db verify --db "$DATABASE_URL" ``` #### yarn ```bash yarn prisma contract emit yarn prisma migration plan --name add_users yarn prisma migration status --db "$DATABASE_URL" yarn prisma db migrate --db "$DATABASE_URL" --advance-ref db yarn prisma db verify --db "$DATABASE_URL" ``` #### bun ```bash bunx prisma contract emit bunx prisma migration plan --name add_users bunx prisma migration status --db "$DATABASE_URL" bunx prisma db migrate --db "$DATABASE_URL" --advance-ref db bunx prisma db verify --db "$DATABASE_URL" ``` When `db migrate` takes its connection from `prisma.config.ts` and does not detect CI, it updates the `db` ref, so the next `migration plan` starts from what you just applied. With `--db`, as above, or in CI, it changes no ref unless you pass `--advance-ref db`. A deployment should not change the refs in your repository. If it reads its connection from `prisma.config.ts` and does not run as a CI job, pass `--no-advance-ref`: #### npm ```bash npx prisma db migrate --no-advance-ref ``` #### pnpm ```bash pnpm prisma db migrate --no-advance-ref ``` #### yarn ```bash yarn prisma db migrate --no-advance-ref ``` #### bun ```bash bunx prisma db migrate --no-advance-ref ``` If you keep a ref for each environment, such as `prod`, run `npx prisma db migrate --to --no-advance-ref` instead. ## Agent skills [#agent-skills] Prisma packages ship [agent skills](https://www.prisma.io/docs/ai/tools/skills): instructions that teach AI coding agents the installed version's commands and APIs. [`init`](https://www.prisma.io/docs/cli/init) prepares a repository once, and [`skills sync`](https://www.prisma.io/docs/cli/skills) keeps the installed copies matching your package versions. Install after `init`, so the `prisma` dev dependency it adds is in `node_modules`: #### npm ```bash npx prisma@latest init npm install npx prisma skills sync ``` #### pnpm ```bash pnpm dlx prisma@latest init pnpm install pnpm prisma skills sync ``` #### yarn ```bash yarn dlx prisma@latest init yarn install yarn prisma skills sync ``` #### bun ```bash bunx --bun prisma@latest init bun install bunx prisma skills sync ``` ## Other commands [#other-commands] A few commands have no page of their own yet. `contract format` formats your `contract.prisma` in place, with the indentation and line endings that [`formatter`](https://www.prisma.io/docs/cli/configuration#schema-formatting) sets. It also formats a Prisma ORM 7 `schema.prisma` that your config reads with `prisma7Schema(...)`. `lsp` starts the Prisma ORM language server, which your editor runs for you, as [Editor support](https://www.prisma.io/docs/orm/contract-authoring/editor-support) describes. The `migration` group also has commands that only read and change nothing. Run any of them with `--help` for what each option does: - `migration list` lists the migrations on disk, for each [contract space](https://www.prisma.io/docs/orm/migrations/the-migration-graph#terms-used-on-this-page). Options: `--space`, `--ascii`, `--legend`. - `migration log` lists the migrations the database has actually applied, and when, from the database's own record of them. Options: `--db`, `--utc`, `--ascii`. - `migration graph` draws the chain of migrations. Options: `--space`, `--dot` for Graphviz output, `--ascii`, `--legend`. - `migration check [target]` checks that no `ops.json` or `migration.json` was edited by hand, and that every ref names a contract state that exists. Option: `--space`. ## Global flags [#global-flags] Every command accepts the same set of output, prompt, and config flags. They are documented on [Global flags](https://www.prisma.io/docs/cli/global-flags). ## Related pages - [Choose a Prisma ORM setup path](https://www.prisma.io/docs/getting-started): Pick the Prisma ORM quickstart that matches where you are starting from. - [Console](https://www.prisma.io/docs/console): Learn how to use the Console to manage and integrate Prisma products into your application. - [Introduction to Prisma ORM](https://www.prisma.io/docs/prisma-orm): Prisma ORM 8 is a release candidate. - [Local development](https://www.prisma.io/docs/local-development): Run the whole Prisma stack on your machine, with your app on Bun, a local Prisma Postgres database, and local object storage. - [Overview](https://www.prisma.io/docs/guides): Practical, step-by-step guides for building with Prisma ORM and deploying to Prisma Compute, each one run end to end before it ships.