# Environment variables

The Récit commands read a few environment variables: a token or a password that must stay out of a
config file and of a shell history, the address of another service, the path of a tool, or a switch
for a build. Each one below says which command reads it and what it changes. A flag of the same
command wins over its variable when both are set.

Récit sets a few more `RECIT_` variables for itself (the mode of `recit-site`, the sidecar of Récit
Studio, its signed release build): they are not listed here, and setting them by hand is not
supported.

## Account and service

| Variable                | Read by                                                                    | What it changes                                                                                                                                                          |
| ----------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `RECIT_TOKEN`           | `recit whoami`; `recit login` and `recit logout` warn when it is set       | The bearer token used before the one `recit login` saved, for CI. `recit logout` never revokes or clears it. See [Récit account](/documentation/reference/account).      |
| `RECIT_API_URL`         | `recit login`, `recit logout`, `recit whoami`, the connector, Récit Studio | The Récit service to call instead of the default one; `--api-url` wins over it. Plain `http://` is refused except on `localhost`, `127.0.0.1` and `[::1]`.               |
| `RECIT_API_TOKEN`       | the connector                                                              | The personal token the connector sends to the service; with `RECIT_API_URL`, it turns on the tools that call it. See [Connector](/documentation/integrations/connector). |
| `RECIT_STRUCTURE_TOKEN` | `recit collections publish`, `recit-site build`                            | The structure's write token, from a build secret, never from a flag or the config. See [Published collections](/documentation/reference/published-collections).          |

## Sites

| Variable              | Read by                                       | What it changes                                                                                                                                                                                                              |
| --------------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `RECIT_SITE_PASSWORD` | `recit-site build`, `recit export --prebuilt` | The password of a site sealed by `access.mode: "encrypted"`, when `access.password` names no other variable (`{ env: "…" }`). A wrong or missing one fails the build. See [Password](/documentation/configuration/password). |
| `RECIT_SITE_STRICT`   | `recit-site build`                            | Set to `1`, fails the build on a recoverable problem of the config instead of a warning, as `--strict` does; ignored by `recit-site dev`.                                                                                    |
| `RECIT_OPEN_BROWSER`  | `recit-site dev`                              | Any value opens the browser on the site once the server listens, as `--open` does.                                                                                                                                           |
| `RECIT_BUILD_DEBUG`   | `recit-site dev`, `recit-site build`          | Any value writes the code the site's Vite plugins generate to `dist/debug/`, one file per plugin, to read what a virtual module holds.                                                                                       |

A variable whose name starts with `RECIT_PUBLIC_` is handed to the pages of a site, in the browser:
it may come from the environment or from a `.env` file next to `recit.config.ts`. Never put a secret
in one. `access.password` refuses such a name for the same reason.

## Stories, renders and prints

| Variable                     | Read by                      | What it changes                                                                                                                                                                                                                                |
| ---------------------------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `RECIT_MODULES`              | `recit dev`, `recit build`   | Lends `node_modules` folders to a project that has none: absolute paths joined by `:` (`;` on Windows), searched after the project's own. A relative path or a missing folder is refused. See [CLI](/documentation/reference/cli#environment). |
| `RECIT_FFMPEG`               | `recit render`, Récit Studio | The path of the ffmpeg binary that encodes an MP4, instead of the one on the `PATH`.                                                                                                                                                           |
| `RECIT_CHROMIUM_WS_ENDPOINT` | every PDF and image print    | The WebSocket endpoint of a `playwright run-server` of the same version: every print is drawn by that Chromium, with its fonts, instead of a local one.                                                                                        |
| `RECIT_APP_TARGET_DIR`       | `recit app`                  | Moves Cargo's target folder out of the site, to share the compiled dependencies between sites; an explicit `CARGO_TARGET_DIR` wins. See [App](/documentation/configuration/app).                                                               |
| `RECIT_MCP_ROOT`             | `recit mcp`                  | The only folder the MCP tools may read and write, when the host passes no `--root`; the working directory otherwise. See [MCP](/documentation/ai/mcp).                                                                                         |
