# Configuration

> The environment variables the Trajectonomics CLI reads.

The CLI is configured through environment variables; there is no configuration file. A flag beats
the environment: `--json` beats `TRAJ_FORMAT`.

Only the environment of the shell that runs `traj` counts. A `.env` or `bunfig.toml` file in the
directory you run it from is never read, so a cloned project cannot point `traj` at another ledger.
`bunx` is the one exception: Bun reads `bunfig.toml` itself before `traj` starts, so use the install
script or `npx` inside a directory you do not trust.

## TRAJ_HOME

The data directory, default `~/.traj`. It holds `traj.db`, the SQLite database, and the npm
launcher's `bin/` cache of downloaded binaries. Override it to keep several ledgers apart, and see
[Your data](https://docs.trajectonomics.com/cli/data/) for the directory's contents, backups and removal:

```bash
TRAJ_HOME=/tmp/traj traj init --json
```

## TRAJ_FORMAT

`human` (the default) or `json`. `--json` takes precedence over the environment. An unrecognized
value falls back to `human` and is reported as text with exit code 2.

## TRAJ_DEBUG

Set to `1` to print diagnostics for unexpected errors on stderr.

## Building from source

`TRAJ_BINARY_PATH` points the npm launcher at a binary you built yourself. Building the CLI from
source is for contributors, described in the
[repository](https://github.com/trajectonomics/trajectonomics/tree/main/apps/cli), not here.

Previous: [Agent](https://docs.trajectonomics.com/cli/agent/) · Next: [Commands](https://docs.trajectonomics.com/cli/commands/).

Part of the [Docs index](https://docs.trajectonomics.com/llms.txt).
