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, anexportprefix 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 withconfig.env_file_malformed, which names the file and line - If Charter can't read the
--env-filepath, it fails withconfig.env_file_unreadable. A missing./.envis 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,yesand0,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_URLis the Postgres connection URL, startingpostgres://orpostgresql://. Required for every database-backed command exceptcharter dev, which can derive a Compose URL when it is unset. It has no flag, which keeps credentials out of shell history andpsDATABASE_MAX_CONNECTIONSsizes the connection pool. Default10. Onlycharter servereads itCHARTER_STATEMENT_TIMEOUT_MSsets a Postgresstatement_timeouton pooled connections. Unset by default. Onlycharter servereads it
Postgres version, connection checklist, and the privileges the database role needs: Requirements.
Server#
CHARTER_HOST(--host) is the bind address. It defaults to0.0.0.0forcharter serveand127.0.0.1forcharter devCHARTER_PORT(--port) is the port. Default3000CHARTER_HTTP_WORKERSsets the number of HTTP worker threads. Default is one per core. Onlycharter servereads itCHARTER_API_NAMEis the name shown on the docs page. DefaultCharter API.charter setupalso uses it to name the MCP server in its hints, lowercased with separators turned into_. If it's unset there, the name ischarterCHARTER_BASE_URLis the server's public URL. Defaulthttp://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 withCHARTER_TLS_KEYCHARTER_TLS_KEY(--tls-key) is the matching private keyCHARTER_TLS_CLIENT_CA(--tls-client-ca) turns on client certificates. Charter refuses any connection whose certificate this CA didn't sign. It's optionalCHARTER_HEALTH_ADDR(--health-addr) is ahost:portfor a plain HTTP listener that serves onlyGET /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/docsCHARTER_DISABLE_OPENAPI(--no-openapi) removes/openapi.json,/openapi.yaml, and/.well-known/api-catalogCHARTER_DISABLE_LLMS(--no-llms) removes/llms.txtand/llms-full.txtCHARTER_DISABLE_REGISTRY(--no-registry) removes/registryCHARTER_DISABLE_MCP_SERVER(--no-mcp) removes/mcpand/v1/mcpCHARTER_DISABLE_CONSOLE(--no-console) removes/console, in builds that include the consoleCHARTER_DISABLE_ORGANIZATIONS(--no-organizations) removes/api/orgson Pro builds (also turns off invitations and org SSO)CHARTER_DISABLE_INVITATIONS(--no-invitations) disables invitation create/accept on Pro buildsCHARTER_DISABLE_SSO(--no-sso) disables org OIDC SSO on Pro buildsCHARTER_DISABLE_SCHEMA_INIT(--no-schema-init) stops Charter creating tables at startup, for databases you migrate separately. Bothcharter serveandcharter mcpread it
Environment and signing keys#
APP_ENVnames the kind of deployment. Charter recognizesproductionandprod,development,devandlocal, andtest,testingandci, in any case. Anything else, or nothing, counts as unspecifiedCOOKIE_SIGNING_KEYsigns session cookies and must be at least 64 bytes. Generate one withopenssl rand -base64 64TOKEN_SIGNING_KEYsigns the access tokens Charter issues. It must be 32 bytes, raw or base64 (openssl rand -base64 32). By default Charter derives it fromCOOKIE_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_SECONDSis how long a sign-in session lasts. Default604800, which is 7 daysACCESS_TOKEN_TTL_SECONDSis how long an access token lasts. Default900, which is 15 minutesCHARTER_DEFAULT_ROLEis the role a new user gets when nobody names one. DefaultuserCHARTER_TRUSTED_ORIGINSlists extra origins that OAuth sign-in may redirect back to, on top ofCHARTER_BASE_URL. Empty by defaultCHARTER_TRUSTED_PROXIESlists the proxy IP addresses whoseX-Forwarded-ForandX-Real-Ipheaders 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_LOGINset tofalseturns off email sign-up and sign-in. On by defaultENABLE_PASSWORD_SIGNUPset tofalseturns off sign-up but leaves sign-in working. On by defaultREQUIRE_EMAIL_VERIFICATIONset totrueblocks sign-in until the user verifies their email. Off by defaultPASSWORD_MIN_LENGTHis the shortest password allowed, in characters. Default12PASSWORD_REQUIRE_UPPERCASE,PASSWORD_REQUIRE_LOWERCASE,PASSWORD_REQUIRE_NUMBERandPASSWORD_REQUIRE_SPECIALeach add a rule when set totrue. 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_IDandAUTH_GOOGLE_CLIENT_SECRETturn on Google sign-inAUTH_GITHUB_CLIENT_IDandAUTH_GITHUB_CLIENT_SECRETturn on GitHub sign-inAUTH_GOOGLE_AUTH_URL,AUTH_GOOGLE_TOKEN_URLandAUTH_GOOGLE_USERINFO_URLpoint Google sign-in at different endpoints, such as a staging or test identity provider. GitHub has the same three, startingAUTH_GITHUB_
Mail#
Outbound email for organization invitations. Choose a mailer, set a From address, and configure that transport.
MAIL_MAILER:smtporlog(default; writes to logs)MAIL_FROM_ADDRESS: required whenMAIL_MAILER=smtpMAIL_FROM_NAME: defaults toCharterMAIL_URL: optional SMTP DSN; when set, wins over the host variablesMAIL_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_TARGETSlets 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) stopscharter serverunning a workerCHARTER_WORKER_CONCURRENCY(--worker-concurrency) is how many jobs theserveworker runs at once. Default4CHARTER_WORK_QUEUES(--queue) lists the queuescharter worktakes jobs from. By default it takes from every built-in queueCHARTER_WORK_CONCURRENCY(--concurrency) is how many jobscharter workruns at once. Default4CHARTER_WORK_VISIBILITY_TIMEOUT(--visibility-timeout) is how many seconds a job can run before another worker retries it. Default300
MCP#
CHARTER_MCP_ROLEis the role Admin MCPget_recordandlist_recordsuse for permission checks. It has no default. While it's unset, those two tools refuse to read anything. Resource MCP ignores it and usesCHARTER_API_KEY/ Bearer auth insteadCHARTER_API_KEYis thecrt_…key (or access token)charter mcp apiacts as. Prefer the env over--api-keyso the secret stays off the process argvCHARTER_MCP_STRICTmakes Charter accept only clients on MCP protocol2026-07-28. Off by default
Telemetry and logs#
Step-by-step export setup: OpenTelemetry.
OTEL_EXPORTER_OTLP_ENDPOINTsends 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 runningRUST_LOGsets log filters, such asinfo,charter_server=debug. The default isinfo, ordebugwith-vandtracewith-vv. A validRUST_LOGoverrides-v. Charter ignores an invalid oneCHARTER_OTEL_CAPTURE_SQLrecords 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 nothingCHARTER_VERBOSE(-v) sets log detail, from0to255. Each repeat of the flag adds one, while the variable sets the level directlyCHARTER_CONFIG_PATH(--pathoncharter import config,--configoncharter dev) is the registry file. Defaultcharter.tomlCHARTER_EXPORT_PATH(--path) is wherecharter exportwrites. Defaultcharter.toml. The command still refuses to replace a file that already existsCHARTER_NO_WATCH(--no-watch) stopscharter devfrom keeping the registry file in step with the database. Leave it unset to keep watching on. Set it totrueto turn watching off
charter setup also checks PATH, and PATHEXT on Windows, to see whether the claude, codex and gemini CLIs are installed.