# Configuration (https://docs.neuralisapp.com/enterprise/configuration)

Configuration follows one discipline: the instance should be governable from
the admin UI at runtime, with as little reason to touch a server as possible.
It is split into four tiers:

1. **`.env`** holds only what the process needs to boot.
2. **Platform settings** hold runtime values an admin edits from the UI.
3. **The credential store** holds every long-lived secret.
4. **The generated `docker-compose.yml`** holds the Docker topology.

For a runtime value the precedence is: the stored platform value, then an
environment fallback, then the built-in default.

## Tier 1: `.env`, boot-critical only [#tier-1-env-boot-critical-only]

`npx neuralis setup` writes the environment file, and the process reads it at
start; changing it needs a restart. The session secret is not in it: setup
writes it into the data home (`app/config/session-secret.key`) beside the
credential keys, so it travels with the users it signs in.

| Variable | Purpose |
|---|---|
| `NEXTAUTH_URL` | The public app URL, with `APP_URL` beside it; setup writes both from the public origin you give it. Undeclared, the host answers on loopback only. See [the public origin](https://docs.neuralisapp.com/enterprise/deployment.md#the-public-origin) |
| `NEURALIS_APP_PORT` / `MCP_HTTP_PORT` | App and external-MCP ports (`3100` / `3101`) |
| `NEURALIS_HOME` | Data root (in the container: `/.neuralis`) |
| `NEURALIS_HOST_HOME` | The host-side path of the data root, required in Docker so file metadata carries host paths |
| `QDRANT_URL` | Vector database endpoint |
| `QDRANT_API_KEY` | The vector database key. Setup mints it for the compose-managed and binary modes and asks for it with an external instance. It lives here rather than in the credential store because the vector client starts before any credential can be decrypted. It is sent only to the vector database, never to the embedding host. A mismatch is not a boot failure: the platform serves without search and indexing and logs an unauthorized line until the key matches |
| `NEURALIS_CODEX_LOOPBACK` | Docker only: `on` publishes the ChatGPT sign-in callback on the host's `127.0.0.1:1455` (default `off`) |
| `QDRANT_DASHBOARD` | Qdrant's static dashboard on the loopback port (`on` / `off`, default `on`) |
| `NEURALIS_BUILTINS` | Optional list of package ids to load instead of the discovered builtin set |
| `NEURALIS_BUILD_NPMRC` | Optional `.npmrc` for a private registry when the install builds its own image: scope lines only, mounted as a build secret. See [your own packages](https://docs.neuralisapp.com/enterprise/deployment.md#your-own-packages) |

## Tier 2: platform settings [#tier-2-platform-settings]

Runtime settings live in one schema-validated file in the platform zone
(`app/config/platform.json`) and are edited from the Admin widget's
**Config** tab. Every key is declared by the package that consumes it, with a
type, a default and bounds; the tab shows each key's declaring package and
whether its value comes from the default, an environment fallback or an admin
override. Edits are validated, written atomically and mostly apply at runtime;
a key that applies on restart says so in its description. The declaration
contract and the keys each package ships are on
[Config settings](https://docs.neuralisapp.com/package-system/config-settings.md); the configuration routes
need `platform.config`, which no role holds by default.

## Tier 3: the credential store [#tier-3-the-credential-store]

Anything secret (provider API keys, OAuth tokens, MCP keys, skill-declared and
custom secrets) belongs in the encrypted credential store, never in `.env` or
platform settings. It is scoped platform, project, user and agent, resolved
most-specific-wins, and managed from the admin Credentials tab. See
[Credentials](https://docs.neuralisapp.com/package-system/credentials.md).

**Model providers are credentials.** First-run setup asks for provider keys and
writes them straight into the store; the runtime reads provider keys from the
store only, with no environment fallback, and the compose file carries no key.
A project can carry its own key that overrides the platform default. Custom LLM
endpoints (your own hardware, or a keyed remote gateway) are registered in the
Credentials tab; a keyed endpoint's models are offered only to callers for whom
its key resolves. ChatGPT/Codex is connected through a sign-in flow instead of a
pasted key. The catalog is on
[Providers and models](https://docs.neuralisapp.com/agent-core/providers-and-models.md).

## Tier 4: the generated `docker-compose.yml` [#tier-4-the-generated-docker-composeyml]

`npx neuralis setup` generates the compose file next to `.env` with
machine-specific values; `npx neuralis setup --compose-only` regenerates it
without asking anything. It is never hand-edited and carries no secret (its one
`.env` interpolation is `QDRANT_API_KEY`). Machine-local extra mounts live in
`docker-compose.override.yml`, which survives regeneration. See
[Deployment](https://docs.neuralisapp.com/enterprise/deployment.md).

## Logs: two planes [#logs-two-planes]

| | Docker / console | Files on disk |
|---|---|---|
| Where | container stdout (`docker logs`) | package logs, per-agent run logs, and the host's `app/logs/audit.jsonl` and `app/logs/routes.jsonl` |
| Lifetime | until the container restarts | rotated by size and age, survives restarts |
| Level key | `logLevel` (and `routeConsoleLogLevel` for route lines) | `packageLogLevel` (+ `packageLogLevelOverrides`), `routeLogLevel` |
| Takes effect | on restart | live, on the next line |
| Readable in-product | no | yes: the admin Logs tab |

- **`packageLogLevel`** (default `info`) governs every package's file log;
  **`packageLogLevelOverrides`** sets exceptions as `<package>=<level>` pairs.
- **`routeLogLevel`** (default `warn`) governs the route log: one line per
  package-route dispatch with pattern, method, status, duration, caller and the
  gate that refused a call. At `warn` it keeps refusals, faults and every
  dispatch slower than **`routeSlowMs`** (default 1000 ms); `info` on a busy
  workspace rotates the file away within hours, so raise it only for a debugging
  window.
- **`logLevel`** governs only container stdout.
- **The process monitor** writes one `perf.slow` warning to stdout when the
  process's CPU exceeds `perfProcessCpuWarnPercent` (default 80) or an
  event-loop stall reaches `perfEventLoopLagWarnMs` (default 200 ms) within a
  sample window.

Because file levels apply live, the loop is: raise the level, reproduce, read,
put it back. Each plane has its own rotation keys (`routeLogMax*` and
`packageLogMax*`). The audit log is the exception: `auditLogMaxBytes` (25 MB)
only decides when a new generation starts; no generation is ever deleted.

## What is hot and what needs a restart [#what-is-hot-and-what-needs-a-restart]

| Change | Takes effect |
|---|---|
| Platform settings | On the next read, except keys whose description says they apply on restart |
| File log levels, `routeSlowMs`, `perfSlowToolMs` | Live, on the next log line |
| `logLevel` | Process restart |
| Credential writes and deletions | Immediately, on the next stream |
| Role and feature grant changes | Immediately, on the next request |
| `.env` changes | Process restart |
| New or upgraded packages | An image update for builtin packages; a rescan for project packages |