# kindgi dev

> Run the Kindgi runtime as a container + hot-reload the pack under cwd

## `kindgi dev`

**Synopsis**

```sh signature
kindgi dev [--port <n>] [--database-url <url>] [--tenant <id>] [--dev-token <token>] [--no-watch] [--open] [--path <dir>] [--reset [--yes]] [--recreate-services] [--runtime-image <ref> | --runtime-url <url>] [--log-level <level>] [--log <subsystem>=<level>]... [--log-format pretty|json] [--quiet]
```

Run the Kindgi runtime as a container + hot-reload the pack under cwd. One per pack: a second exits 3 ("already running"), saying where the first is.

**Options**

| Option                    | Default                                                                                               | Description                                                                                                                                                                                                                                 |
| ------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--database-url <value>`  | `KINDGI_DATABASE_URL` (the shell's, then the env files'), else the bundled Postgres                   | The Postgres to use. Default: `KINDGI_DATABASE_URL` (the shell's, then the env files'), else the bundled Postgres.                                                                                                                          |
| `--dev-token <value>`     | the previous run's (from `.kindgirc.json`), else a new one                                            | Pin the API token. Default: the previous run's (from `.kindgirc.json`), else a new one.                                                                                                                                                     |
| `--log <value>`           | none                                                                                                  | A subsystem's own level, `<subsystem>=<level>` (e.g. `--log=http=debug`, `--log=pack=debug`); repeat it, or give a comma list. A dotted child inherits its parent's (`pack` covers `pack.tool`). Repeatable.                                |
| `--log-format <value>`    | `pretty`                                                                                              | How log records are shown: `pretty` (the default: tagged `[runtime]` / `[pack]`, coloured on a terminal unless `NO_COLOR` is set) or `json` (each record as written, one per line on stdout, for `\| jq`; everything else stays on stderr). |
| `--log-level <value>`     | `KINDGI_LOG_LEVEL` (the shell's, then the env files'), else info; with `--quiet`, error               | The lowest level of the log records shown: error, warn, info, debug or trace. Default: `KINDGI_LOG_LEVEL` (the shell's, then the env files'), else info; with `--quiet`, error.                                                             |
| `--no-watch`              | off                                                                                                   | Start, index and register once, then exit. For smoke tests and CI.                                                                                                                                                                          |
| `--open`                  | off                                                                                                   | Open the console in your browser once Kindgi is up.                                                                                                                                                                                         |
| `--path <value>`          | the current directory                                                                                 | The pack root, with a `kindgi.config.ts` (or `.mts`), a `pyproject.toml` with `[tool.kindgi]`, or a `kindgi.config.json` (Java). Default: the current directory.                                                                            |
| `--port <value>`          | `4000`, or the next free port when it's taken                                                         | The port the runtime's API is reached on, on `127.0.0.1`. Default: `4000`, or the next free port when it's taken (another `kindgi dev`, say). A port given here that's taken is refused. Not used with `--runtime-url`.                     |
| `--recreate-services`     | off                                                                                                   | Let `docker compose` recreate the bundled Postgres if its definition changed (needs compose). By default an existing container is reused.                                                                                                   |
| `--reset`                 | off                                                                                                   | Start the project fresh: drops its database in the bundled Postgres (every pack's dev data in it), after asking, and makes a new token. A database you pass with --database-url is never dropped: only the token is new.                    |
| `--runtime-image <value>` | the image this CLI release pins                                                                       | The runtime image to run. Default: the one this CLI release pins.                                                                                                                                                                           |
| `--runtime-url <value>`   | none                                                                                                  | Use a runtime you run yourself, at this origin, instead of starting the container. Start it with the pack's `.kindgi/dev/runtime.env`.                                                                                                      |
| `--tenant <value>`        | the project database's tenant if any, else the previous run's (from `.kindgirc.json`), else a new one | Pin the tenant. Default: with the bundled Postgres, the project's own (the same for every pack and restart of the project); else the previous run's (from `.kindgirc.json`), else a new one.                                                |
| `--watch`                 | on                                                                                                    | Re-index and reload the pack on every save. On by default; `--no-watch` turns it off.                                                                                                                                                       |
| `--yes`                   | off                                                                                                   | With --reset: drop the project's database without asking (for scripts).                                                                                                                                                                     |

Every command also takes the [global flags](https://docs.kindgi.com/v0.1.8/reference/cli.md#global-flags).

**Examples**

From [Add Kindgi to a TypeScript or Node app](https://docs.kindgi.com/v0.1.8/start/existing-app-typescript.md):

```sh
pnpm exec kindgi dev
```

**See also**

- [Add Kindgi to a TypeScript or Node app](https://docs.kindgi.com/v0.1.8/start/existing-app-typescript.md)
- [Quickstart: TypeScript](https://docs.kindgi.com/v0.1.8/start/quickstart-typescript.md)
- [Build a support desk (TypeScript)](https://docs.kindgi.com/v0.1.8/tutorials/support-desk-typescript.md)
