# `jadpo dev`

Run the app and reload on every save.

Run the application in the interpreter and serve its routes on a local port (3000 unless --port says otherwise). Each save is checked again, and once it checks cleanly the new version serves the next request; while a save has errors, the last good version keeps serving. Each request is one line, with its request id. The database is the one --url names, or else a disposable PostgreSQL started for the session; pending migrations are applied as they appear. With --no-run it only checks on every save and writes build/.

```text
jadpo dev
```

## Flags

- `--port <port>`: Listen on this port; 0 picks a free one
- `--url <url>`: Use this database, not a disposable one
- `--no-run`: Only check on every save; serve nothing
- `--fake <connection>`: Fake this connection for this session
- `--sandbox <operation>`: Let this operation through to its sandbox

## On every command

- `--json`: Print data for tools instead of text
- `--help`: Show every flag, with examples
- `--color <when>`: Choose when to use colour

`jadpo dev --json` writes one JSON document to standard output instead of text, with the same exit code. The document has `schemaVersion`, `command` (`"dev"`), `ok`, `data` (what the command produced, `null` when it failed) and `diagnostics` (each error with its `rule`, `reason`, `next` and `help`). A command that needs a terminal refuses `--json` and names the flags that do the same job.

## Examples

```text
# Serve the project you are in on http://localhost:3000
jadpo dev
# Serve it on another port, with your own database
jadpo dev --port 8080 --url postgresql://localhost/app_dev
# Print each request as a line of data for tools
jadpo dev --json
```

## Errors

- [`cli.dev_arguments`](../errors/cli.dev_arguments.md): Dev command has invalid arguments
- [`cli.dev_port_invalid`](../errors/cli.dev_port_invalid.md): Development port is invalid
- [`cli.dev_start_failed`](../errors/cli.dev_start_failed.md): Development server could not start
- [`toolchain.project_not_found`](../errors/toolchain.project_not_found.md): Project could not be found
