# dev (/docs/cli/dev)
> 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.
Bring a Composer application up entirely on this machine, with no cloud credentials.
Location: CLI > dev
`dev` brings a [Prisma Composer](https://www.prisma.io/docs/composer) application up entirely on this machine. It loads the module whose default export is the application root, named by `entry` in the `composer` section of `prisma.config.ts`, 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 app and restarts a service when its build changes. See [Local development](https://www.prisma.io/docs/composer/local-development).
Like [`deploy`](https://www.prisma.io/docs/cli/deploy), `dev` runs your *built* output, so build first. Two kinds of service run a dev server instead of the built output: a Next.js service, which runs `next dev`, and a service whose `node()` build has a `dev` option. `dev` is the command as an array of arguments, run in the directory of the module that declares the service:
```typescript
build: node({
module: import.meta.url,
entry: '../dist/server.mjs',
dev: ['bun', '--watch', 'server.ts'],
}),
```
The command gets the service's environment plus `PORT` and `HOST`, and must listen on `PORT`. `dev` prints the dev server's output prefixed with the service's address.
`dev` does not run on Windows yet. There it fails with `DEV.PLATFORM_UNSUPPORTED`.
## Usage [#usage]
#### npm
```bash
npx prisma dev
npx prisma dev --fresh
npx prisma dev --environment test --fresh
npx prisma dev --detach
npx prisma dev url my-app.gateway
npx prisma dev stop
```
#### pnpm
```bash
pnpm prisma dev
pnpm prisma dev --fresh
pnpm prisma dev --environment test --fresh
pnpm prisma dev --detach
pnpm prisma dev url my-app.gateway
pnpm prisma dev stop
```
#### yarn
```bash
yarn prisma dev
yarn prisma dev --fresh
yarn prisma dev --environment test --fresh
yarn prisma dev --detach
yarn prisma dev url my-app.gateway
yarn prisma dev stop
```
#### bun
```bash
bunx prisma dev
bunx prisma dev --fresh
bunx prisma dev --environment test --fresh
bunx prisma dev --detach
bunx prisma dev url my-app.gateway
bunx prisma dev stop
```
## Commands [#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` 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 [#flags]
| Flag | Description |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--entry ` | Load the app from this module instead of the `entry` in `prisma.config.ts` |
| `--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 |
| `--environment ` | The environment to run as (default: `dev`). Each environment is a separate local copy of the app, so a second one, such as `test`, runs alongside `dev` and leaves its data alone |
| `--fresh` | Before starting, delete this app's local services, databases, and buckets in the environment, with their data. Other apps and environments 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.
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 --detach` again after a build, or run `prisma dev` 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`, `--name`, and `--environment`. Give `dev url` and `dev stop` the same `--environment`.
## dev url [#dev-url]
`dev url ` prints the local URL of one node of the app that `prisma dev` runs from the current directory, in the environment `dev` unless you pass `--environment`. A node is a service, database, or bucket in the app, and its address is its path from the app's name, with dots between the names, such as `my-app.gateway` or, for a database inside a `catalog` module, `my-app.catalog.database`.
#### npm
```bash
npx prisma dev url my-app.gateway
```
#### pnpm
```bash
pnpm prisma dev url my-app.gateway
```
#### yarn
```bash
yarn prisma dev url my-app.gateway
```
#### bun
```bash
bunx prisma dev url my-app.gateway
```
```text no-copy
✔ The service my-app.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 my-app.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 that app in that environment in this directory |
| `DEV.ENVIRONMENT_NAME_MISMATCH` | The environment's local folder belongs to an environment whose name differs only in case, such as `dev` for `--environment Dev` on macOS |
| `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` or by `prisma dev` ending. A service that keeps crashing is reported this way too, with the path of its log |
## dev stop [#dev-stop]
`dev stop` stops the app that `prisma dev` ran from the current directory. Give it the same `--environment`, `--name` and `--entry` you gave `prisma dev`; without `--environment` it stops the environment `dev`. It stops its service processes and local database servers, as `Ctrl-C` does in a foreground `prisma dev`.
#### npm
```bash
npx prisma dev stop
```
#### pnpm
```bash
pnpm prisma dev stop
```
#### yarn
```bash
yarn prisma dev stop
```
#### bun
```bash
bunx 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 [#global-flags]
The Prisma CLI's [global flags](https://www.prisma.io/docs/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](https://www.prisma.io/docs/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`](https://www.prisma.io/docs/cli/emulator).
## Next steps [#next-steps]
- [Local development](https://www.prisma.io/docs/composer/local-development): ports, what persists, and running in the background.
- [`deploy`](https://www.prisma.io/docs/cli/deploy): the same application, on Prisma Compute.
## Related pages
- [auth](https://www.prisma.io/docs/cli/auth): Sign in to your Prisma account from the CLI, sign out, and manage workspace sessions.
- [branch](https://www.prisma.io/docs/cli/branch): List platform branches for a project.
- [bucket](https://www.prisma.io/docs/cli/bucket): Create and manage object-store buckets.
- [Configuration](https://www.prisma.io/docs/cli/configuration): Configure Prisma ORM CLI commands with prisma.config.ts and global flags.
- [contract emit](https://www.prisma.io/docs/cli/contract-emit): Emit Prisma ORM contract artifacts.