Back to Prisma

dev

apps/docs/content/docs/cli/dev/index.mdx

latest2.4 KB
Original Source

The prisma dev command starts a local Prisma Postgres database that you can run Prisma ORM commands against. It's useful for development and testing and allows easy migration to Prisma Postgres in production.

Usage

bash
prisma dev [options]

Options

OptionDescriptionDefault
-n, --nameName of the server (helps isolate state between projects)default
-p, --portMain port number the Prisma Dev server will listen on51213
-P, --db-portPort number the database server will listen on51214
--shadow-db-portPort number the shadow database server will listen on51215
-d, --detachRun the server in the backgroundfalse
--debugEnable debug loggingfalse

Subcommands

CommandDescription
prisma dev lsList available servers
prisma dev rmRemove servers
prisma dev startStart one or more stopped servers
prisma dev stopStop servers

Examples

Start a local Prisma Postgres server

npm
npx prisma dev

Output:

text
✔  Great Success!

   Your  prisma dev  server default is ready and listening on ports 63567-63569.

╭──────────────────────────────────╮
│[q]uit  [h]ttp url  [t]cp urls    │
╰──────────────────────────────────╯

Start with a specific name

Create a named instance for project isolation:

npm
npx prisma dev --name="mydbname"

Run in detached mode

Run the server in the background:

npm
npx prisma dev --detach

This frees up your terminal. Use prisma dev ls to see running servers and prisma dev stop to stop them.

Specify custom ports

npm
npx prisma dev --port 5000 --db-port 5001 --shadow-db-port 5002