Reference

Environment variables

Every setting Charter reads from the environment, with its default.

Charter needs almost no extra configuration for a local project. For most setups you may follow the Quickstart Compose file, or run charter setup then charter dev. Setup writes a Compose Postgres DATABASE_URL into .env. If that variable is still unset, charter dev derives a matching URL and starts Compose Postgres when needed, then listens on 127.0.0.1:3000.

Of course, you may wish to review the variables below before you rely on Charter in production. The sections that follow group common paths first, then list every setting by topic.

How they load#

Before it parses arguments, charter loads one env file. It takes the path given to --env-file, then CHARTER_ENV_FILE, then ./.env if that exists. A variable already set in your shell beats the same key in the file.

  • Each line is KEY=VALUE. # comments, an export prefix and quotes around the value are all allowed
  • KEY= with nothing after it leaves the variable unset, so blank placeholders in a template do no harm
  • A line without = fails with config.env_file_malformed, which names the file and line
  • If Charter can't read the --env-file path, it fails with config.env_file_unreadable. A missing ./.env is fine
Info

Each value has to fit on one line. Set multi-line values, such as a PEM certificate, in the real environment instead.

Flags and values#

Many variables have a matching command-line flag, shown in brackets below. If you give both, the flag wins.

  • Booleans accept 1, true, on, yes and 0, false, off, no, in any case. A flag-backed boolean rejects anything else as a usage error
  • The email and password settings work differently. They match only the exact lowercase string given for each, and treat anything else as the default
  • Numbers are whole numbers. A bad value for a flag-backed or serve-only number stops startup with an error. A bad TTL or password length falls back to the default without a warning
  • Lists are comma-separated. Charter trims the spaces and drops blank entries

Common paths#

Goal Variables to set
Reach Postgres DATABASE_URL (required for most commands; charter dev can derive it)
Bind the HTTP server CHARTER_HOST, CHARTER_PORT, and often CHARTER_BASE_URL
Sign sessions in production COOKIE_SIGNING_KEY (and optionally TOKEN_SIGNING_KEY)
Create the first operator without a shell CHARTER_SETUP_TOKEN
Serve TLS directly CHARTER_TLS_CERT, CHARTER_TLS_KEY, and often CHARTER_HEALTH_ADDR
Export telemetry OTEL_EXPORTER_OTLP_ENDPOINT (see OpenTelemetry)

Database#

  • DATABASE_URL is the Postgres connection URL, starting postgres:// or postgresql://. Required for every database-backed command except charter dev, which can derive a Compose URL when it is unset. It has no flag, which keeps credentials out of shell history and ps
  • DATABASE_MAX_CONNECTIONS sizes the connection pool. Default 10. Only charter serve reads it
  • CHARTER_STATEMENT_TIMEOUT_MS sets a Postgres statement_timeout on pooled connections. Unset by default. Only charter serve reads it

Postgres version, connection checklist, and the privileges the database role needs: Requirements.

Server#

  • CHARTER_HOST (--host) is the bind address. It defaults to 0.0.0.0 for charter serve and 127.0.0.1 for charter dev
  • CHARTER_PORT (--port) is the port. Default 3000
  • CHARTER_HTTP_WORKERS sets the number of HTTP worker threads. Default is one per core. Only charter serve reads it
  • CHARTER_API_NAME is the name shown on the docs page. Default Charter API. charter setup also uses it to name the MCP server in its hints, lowercased with separators turned into _. If it's unset there, the name is charter
  • CHARTER_BASE_URL is the server's public URL. Default http://localhost:3000. Charter builds the OAuth redirect URL from it, sends people there after login, and trusts it as an origin. Set it whenever Charter runs anywhere but localhost

TLS#

Only charter serve reads these. Without them it serves plain HTTP, which is what you want behind a proxy that handles TLS.

  • CHARTER_TLS_CERT (--tls-cert) is the certificate chain. Set it together with CHARTER_TLS_KEY
  • CHARTER_TLS_KEY (--tls-key) is the matching private key
  • CHARTER_TLS_CLIENT_CA (--tls-client-ca) turns on client certificates. Charter refuses any connection whose certificate this CA didn't sign. It's optional
  • CHARTER_HEALTH_ADDR (--health-addr) is a host:port for a plain HTTP listener that serves only GET /healthz. You need it once TLS is on, and it has to differ from the API address

Each TLS value is either a file path or the PEM text itself. Charter treats anything containing -----BEGIN as PEM. Line breaks inside it can be real newlines or the two characters \n.

Turning features off#

Each of these removes routes from the server. They all default to off.

  • CHARTER_DISABLE_DOCS (--no-docs) removes /docs
  • CHARTER_DISABLE_OPENAPI (--no-openapi) removes /openapi.json, /openapi.yaml, and /.well-known/api-catalog
  • CHARTER_DISABLE_LLMS (--no-llms) removes /llms.txt and /llms-full.txt
  • CHARTER_DISABLE_REGISTRY (--no-registry) removes /registry
  • CHARTER_DISABLE_MCP_SERVER (--no-mcp) removes /mcp and /v1/mcp
  • CHARTER_DISABLE_CONSOLE (--no-console) removes /console, in builds that include the console
  • CHARTER_DISABLE_ORGANIZATIONS (--no-organizations) removes /api/orgs on Pro builds (also turns off invitations and org SSO)
  • CHARTER_DISABLE_INVITATIONS (--no-invitations) disables invitation create/accept on Pro builds
  • CHARTER_DISABLE_SSO (--no-sso) disables org OIDC SSO on Pro builds
  • CHARTER_DISABLE_SCHEMA_INIT (--no-schema-init) stops Charter creating tables at startup, for databases you migrate separately. Both charter serve and charter mcp read it

Environment and signing keys#

  • APP_ENV names the kind of deployment. Charter recognizes production and prod, development, dev and local, and test, testing and ci, in any case. Anything else, or nothing, counts as unspecified
  • COOKIE_SIGNING_KEY signs session cookies and must be at least 64 bytes. Generate one with openssl rand -base64 64
  • TOKEN_SIGNING_KEY signs the access tokens Charter issues. It must be 32 bytes, raw or base64 (openssl rand -base64 32). By default Charter derives it from COOKIE_SIGNING_KEY
Warning

Charter ships a development cookie key, and anyone can read it in the source. Charter only uses it when three things are true. COOKIE_SIGNING_KEY is unset, APP_ENV isn't production, and the server is bound to a loopback address. In any other case the server won't start without a key of its own.

Charter marks cookies Secure whenever the server is bound beyond loopback or APP_ENV is production. charter dev won't run when APP_ENV is production. It also won't take a non-loopback --host unless COOKIE_SIGNING_KEY is set.

First operator#

CHARTER_SETUP_TOKEN opens /setup on charter serve so you can create the first operator without a shell in the container. Generate one with openssl rand -base64 32. It has to be at least 32 characters, or the server refuses to start. It has no command-line flag, which keeps it out of shell history and process listings.

Leave it unset and /setup is not served. charter dev ignores it and seeds its own operator instead.

On the page, enter the secret, a name, and an email. Charter shows an API key once. Copy it then. The page stores only a hash of the key, and the setup secret cannot be used again, even if the variable is still set and every operator is later removed. The operator has no password. Send the key as Authorization: Bearer followed by the key. The console sign-in page will not accept this account.

Warning

A shorter secret is refused at startup. Changing the variable after a successful setup does not open the page again.

Sessions and access#

  • SESSION_TTL_SECONDS is how long a sign-in session lasts. Default 604800, which is 7 days
  • ACCESS_TOKEN_TTL_SECONDS is how long an access token lasts. Default 900, which is 15 minutes
  • CHARTER_DEFAULT_ROLE is the role a new user gets when nobody names one. Default user
  • CHARTER_TRUSTED_ORIGINS lists extra origins that OAuth sign-in may redirect back to, on top of CHARTER_BASE_URL. Empty by default
  • CHARTER_TRUSTED_PROXIES lists the proxy IP addresses whose X-Forwarded-For and X-Real-Ip headers Charter trusts for rate limiting. Empty by default, so Charter trusts none. Charter logs and skips any entry that isn't an IP address

Email and password sign-in#

Warning

These only respond to the exact lowercase string listed. TRUE or 1 does nothing.

  • ENABLE_EMAIL_PASSWORD_LOGIN set to false turns off email sign-up and sign-in. On by default
  • ENABLE_PASSWORD_SIGNUP set to false turns off sign-up but leaves sign-in working. On by default
  • REQUIRE_EMAIL_VERIFICATION set to true blocks sign-in until the user verifies their email. Off by default
  • PASSWORD_MIN_LENGTH is the shortest password allowed, in characters. Default 12
  • PASSWORD_REQUIRE_UPPERCASE, PASSWORD_REQUIRE_LOWERCASE, PASSWORD_REQUIRE_NUMBER and PASSWORD_REQUIRE_SPECIAL each add a rule when set to true. All off by default

Social login#

A provider turns on only when both its client ID and its secret are set. If either is missing, it stays off.

  • AUTH_GOOGLE_CLIENT_ID and AUTH_GOOGLE_CLIENT_SECRET turn on Google sign-in
  • AUTH_GITHUB_CLIENT_ID and AUTH_GITHUB_CLIENT_SECRET turn on GitHub sign-in
  • AUTH_GOOGLE_AUTH_URL, AUTH_GOOGLE_TOKEN_URL and AUTH_GOOGLE_USERINFO_URL point Google sign-in at different endpoints, such as a staging or test identity provider. GitHub has the same three, starting AUTH_GITHUB_

Mail#

Outbound email for organization invitations. Choose a mailer, set a From address, and configure that transport.

  • MAIL_MAILER: smtp or log (default; writes to logs)
  • MAIL_FROM_ADDRESS: required when MAIL_MAILER=smtp
  • MAIL_FROM_NAME: defaults to Charter
  • MAIL_URL: optional SMTP DSN; when set, wins over the host variables
  • MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD, MAIL_SCHEME, MAIL_EHLO_DOMAIN: SMTP settings

Production Pro installs with invitations enabled need MAIL_MAILER=smtp and a valid From, or the server will not start.

Webhooks#

  • CHARTER_WEBHOOK_ALLOW_INTERNAL_TARGETS lets webhooks reach loopback, private and link-local addresses, which Charter blocks by default
Danger

With this on, a webhook can send requests to services on Charter's own network that are not meant to be reachable from outside. Only turn it on for targets you control, such as a local test server.

Background worker#

charter serve runs a job worker in the same process unless you turn it off. charter work runs a worker on its own.

  • CHARTER_DISABLE_WORKER (--no-worker) stops charter serve running a worker
  • CHARTER_WORKER_CONCURRENCY (--worker-concurrency) is how many jobs the serve worker runs at once. Default 4
  • CHARTER_WORK_QUEUES (--queue) lists the queues charter work takes jobs from. By default it takes from every built-in queue
  • CHARTER_WORK_CONCURRENCY (--concurrency) is how many jobs charter work runs at once. Default 4
  • CHARTER_WORK_VISIBILITY_TIMEOUT (--visibility-timeout) is how many seconds a job can run before another worker retries it. Default 300

MCP#

  • CHARTER_MCP_ROLE is the role Admin MCP get_record and list_records use for permission checks. It has no default. While it's unset, those two tools refuse to read anything. Resource MCP ignores it and uses CHARTER_API_KEY / Bearer auth instead
  • CHARTER_API_KEY is the crt_… key (or access token) charter mcp api acts as. Prefer the env over --api-key so the secret stays off the process argv
  • CHARTER_MCP_STRICT makes Charter accept only clients on MCP protocol 2026-07-28. Off by default

Telemetry and logs#

Step-by-step export setup: OpenTelemetry.

  • OTEL_EXPORTER_OTLP_ENDPOINT sends traces, metrics and logs to this OpenTelemetry endpoint. When it's unset, logs only go to stderr. If the exporter fails to start, Charter logs a warning and keeps running
  • RUST_LOG sets log filters, such as info,charter_server=debug. The default is info, or debug with -v and trace with -vv. A valid RUST_LOG overrides -v. Charter ignores an invalid one
  • CHARTER_OTEL_CAPTURE_SQL records SQL text on database spans. It's off by default because query text can include values from your rows

The standard OTEL_EXPORTER_OTLP_* settings for headers, protocol, timeout and compression also work, and so does OTEL_RESOURCE_ATTRIBUTES. OTEL_SERVICE_NAME doesn't, because Charter always sets the service name to charter.

CLI#

  • CHARTER_ENV_FILE (--env-file) picks the env file to load. Set it in the real environment, since setting it inside an env file does nothing
  • CHARTER_VERBOSE (-v) sets log detail, from 0 to 255. Each repeat of the flag adds one, while the variable sets the level directly
  • CHARTER_CONFIG_PATH (--path on charter import config, --config on charter dev) is the registry file. Default charter.toml
  • CHARTER_EXPORT_PATH (--path) is where charter export writes. Default charter.toml. The command still refuses to replace a file that already exists
  • CHARTER_NO_WATCH (--no-watch) stops charter dev from keeping the registry file in step with the database. Leave it unset to keep watching on. Set it to true to turn watching off

charter setup also checks PATH, and PATHEXT on Windows, to see whether the claude, codex and gemini CLIs are installed.