Reference

Configuration

Configuring your Monospace environment.

Monospace Server can be configured using environment variables or a config.yaml file. Environment variables are prefixed with MONOSPACE_.

Note
For nested configurations, double underscores (__) are used to separate levels.

Boolean environment variables accept true, 1, yes, or on for true and false, 0, no, or off for false, regardless of capitalization. Any other value causes a startup error that names the invalid key.

These aliases apply only to environment variables. In config.yaml, use YAML booleans; cookie_secure: "yes" is an error.

Server

VariableTypeDefaultDescription
MONOSPACE_HOSTstring127.0.0.1Address the server binds to
MONOSPACE_PORTinteger8100Port the server listens on
MONOSPACE_BASE_URLURLhttp://localhost:3000/Public base URL used in emails, OAuth redirects, and generated links
MONOSPACE_SERVE_STATIC_DIRstring—Directory to serve static files from. When unset, uses the public folder next to the server binary
MONOSPACE_SHUTDOWN_DRAIN_DELAYduration0sHow long the server keeps serving after it reports itself unready. Must be shorter than the grace period
MONOSPACE_SHUTDOWN_GRACE_PERIODduration30sTotal budget for a graceful shutdown

Durations accept human-readable strings such as 15s, 5m, and 2h 30m.


License

Monospace runs on the built-in Starter license until you configure one of the variables below. Set one or the other, never both. See Licensing for activation, revalidation, the startup usage check, and license status.

VariableTypeDefaultDescription
MONOSPACE_LICENSE__KEYstring—Key for an online license. Monospace activates it with the licensing service at startup and revalidates on the license's schedule. Requires outbound HTTPS to https://licensing.monospace.io at every startup
MONOSPACE_LICENSE__TOKENstring—Signed token for an offline license. Verified locally without contacting the licensing service. Requires a license that includes offline use

Setting both variables fails startup. When a key is activated, Monospace sends MONOSPACE_BASE_URL to the licensing service as the instance's public URL.


Cache and Redis-Compatible Storage

Caching is enabled by default, and requires Redis-compatible storage. Monospace supports Redis 7.4 and later, and Valkey 7.2 and later.

See Caching for eligible reads, freshness behavior, bypass headers, and Redis memory guidance.

Configure the connection URL

config.yaml
redis:
  url: redis://cache.example.com:6379
  prefix: "monospace:"
  connection_timeout: 2s
  response_timeout: 1s
  # Redis may be configured at runtime through Monospace.
  config_set:
    maxmemory: 100mb
    maxmemory-policy: volatile-lru

cache:
  enabled: true
  include_status_header: false
  ttl: 5m
  max_entry_size: 8m

Redis and Valkey URLs use this form:

syntax
{redis|valkey|rediss|valkeys}://[username[:password]@]host[:port][/db]
ComponentSemantics
redisConnect to Redis without TLS
valkeyConnect to Valkey without TLS
redissConnect to Redis over TLS
valkeysConnect to Valkey over TLS
usernameOptional ACL username. Percent-encode URL-reserved characters
passwordOptional password. Use :password@ when no username is required. Percent-encode URL-reserved characters
hostRequired hostname or IP address. Enclose IPv6 addresses in brackets
portOptional port. Defaults to 6379
dbOptional decimal database index. Defaults to 0; the server determines which indexes are valid

Monospace always uses RESP3. Append #insecure only to rediss or valkeys URLs for unverified TLS.

VariableTypeDefaultDescription
MONOSPACE_REDIS__URLURL—Redis or Valkey connection URL in the format documented above
MONOSPACE_REDIS__PREFIXstringmonospace:Prefix for keys created by Monospace. An empty value is valid
MONOSPACE_REDIS__CONNECTION_TIMEOUTduration2sTimeout for each connection attempt. Set to 0s to disable
MONOSPACE_REDIS__RESPONSE_TIMEOUTduration1sTimeout for each command response. Set to 0s to disable
MONOSPACE_REDIS__CONFIG_SET__*string—Values applied with CONFIG SET during startup
MONOSPACE_CACHE__ENABLEDbooleantrueEnable query result caching
MONOSPACE_CACHE__INCLUDE_STATUS_HEADERbooleanfalseInclude the RFC 9211 Cache-Status response header on cache-aware REST reads. CORS exposes the header automatically when enabled
MONOSPACE_CACHE__TTLduration5mMaximum cache entry age. 0s uses an effective TTL of 365 days so entries remain eligible for volatile eviction
MONOSPACE_CACHE__MAX_ENTRY_SIZEbyte size8mMaximum encoded query result stored in Redis. Set to 0 to remove the Monospace-imposed limit

Configure TLS settings

Use rediss or valkeys for TLS. The default trusted roots verify the server certificate unless you configure a custom CA.

This configuration replaces the default trusted roots and supplies a mutual TLS identity:

config.yaml
redis:
  url: rediss://cache.example.com:6379
  tls:
    ca_cert: !file /run/secrets/redis-ca.pem
    client_cert: !file /run/secrets/redis-client.pem
    client_key: !file /run/secrets/redis-client-key.pem
    client_key_password: change-me

Certificate fields accept PEM or DER content as base64, or a file reference. Client keys accept PKCS#8, PKCS#1 RSA, and SEC1 EC in PEM or DER form. Encrypted PKCS#8 keys require client_key_password.

Appending #insecure to a TLS URL disables certificate and hostname verification, and disables SNI.

VariableTypeDefaultDescription
MONOSPACE_REDIS__TLS__CA_CERTstringDefault trusted rootsCustom CA certificate content encoded as base64
MONOSPACE_REDIS__TLS__CA_CERT__FILEstring—Path to a custom CA certificate
MONOSPACE_REDIS__TLS__CLIENT_CERTstring—Client certificate chain encoded as base64
MONOSPACE_REDIS__TLS__CLIENT_CERT__FILEstring—Path to a client certificate chain
MONOSPACE_REDIS__TLS__CLIENT_KEYstring—Client private key encoded as base64
MONOSPACE_REDIS__TLS__CLIENT_KEY__FILEstring—Path to a client private key
MONOSPACE_REDIS__TLS__CLIENT_KEY_PASSWORDstring—Password for an encrypted PKCS#8 client key

Transactions

Monospace logs one warning when a transaction remains open beyond the configured threshold after attempting a mutation. This warning identifies long-running transactions that delay query-cache invalidation and retain data-source resources.

config.yaml
transaction:
  long_running_mutation_warning_threshold: 30s
VariableTypeDefaultDescription
MONOSPACE_TRANSACTION__LONG_RUNNING_MUTATION_WARNING_THRESHOLDduration or null30sTime after the first attempted mutation before Monospace warns once about the open transaction. Set to 0s or YAML null to disable

System Database

Configures the database Monospace uses to store its own metadata (workspaces, roles, policies, etc.). Currently supports PostgreSQL.

VariableTypeDefaultDescription
MONOSPACE_SYSTEM_DATABASE__PROVIDERstring—Database provider. Currently: postgres

PostgreSQL Provider

VariableTypeDefaultDescription
MONOSPACE_SYSTEM_DATABASE__HOSTstring—Database hostname
MONOSPACE_SYSTEM_DATABASE__PORTinteger—Database port
MONOSPACE_SYSTEM_DATABASE__USERstring—Database username
MONOSPACE_SYSTEM_DATABASE__PASSWORDstring—Database password
MONOSPACE_SYSTEM_DATABASE__DBNAMEstring—Database name

SSL Configuration

VariableTypeDefaultDescription
MONOSPACE_SYSTEM_DATABASE__SSL__MODEstringrequireSSL mode: disable, prefer, require, verify-ca, verify-full
MONOSPACE_SYSTEM_DATABASE__SSL__CA_CERTstring—CA certificate (base64-encoded or file path)
MONOSPACE_SYSTEM_DATABASE__SSL__CLIENT_CERTstring—Client certificate (base64-encoded)
MONOSPACE_SYSTEM_DATABASE__SSL__CLIENT_KEYstring—Client private key (base64-encoded)
MONOSPACE_SYSTEM_DATABASE__SSL__CLIENT_KEY_PASSWORDstring—Password for encrypted client key

File Storage

Configures where Monospace stores uploaded files and assets.

VariableTypeDefaultDescription
MONOSPACE_SYSTEM_FILE_STORAGE__PROVIDERstring—Storage provider: local or s3
MONOSPACE_REDIRECT_ASSET_READbooleanfalseRedirect asset reads to the file storage provider instead of proxying through the server
MONOSPACE_ASSET_PRESIGNED_URL_TTLduration1hValidity period for presigned asset URLs (e.g., 15m, 1h, 60s)

Local Provider

VariableTypeDefaultDescription
MONOSPACE_SYSTEM_FILE_STORAGE__ROOT_PATHstring—Absolute path to the directory where files are stored
MONOSPACE_SYSTEM_FILE_STORAGE__SHAREDbooleanfalseMarks the path as a mount shared by every replica. Required for local storage in clustered mode

S3 Provider

Compatible with AWS S3 and S3-compatible services (MinIO, Cloudflare R2, etc.).

VariableTypeDefaultDescription
MONOSPACE_SYSTEM_FILE_STORAGE__BUCKETstring—S3 bucket name
MONOSPACE_SYSTEM_FILE_STORAGE__ACCESS_KEY_IDstring—AWS access key ID
MONOSPACE_SYSTEM_FILE_STORAGE__SECRET_ACCESS_KEYstring—AWS secret access key
MONOSPACE_SYSTEM_FILE_STORAGE__REGIONstringautoAWS region
MONOSPACE_SYSTEM_FILE_STORAGE__ENDPOINTstring—Custom endpoint URL (for S3-compatible services)
MONOSPACE_SYSTEM_FILE_STORAGE__ROOT_PATHstring—Prefix path within the bucket

Email

Configures outbound email for invitations, password resets, and notifications.

VariableTypeDefaultDescription
MONOSPACE_SYSTEM_EMAILER__PROVIDERstring—Email provider: smtp
MONOSPACE_SYSTEM_EMAILER__FROM_ADDRESSstring—Sender email address in the "From" header
MONOSPACE_SYSTEM_EMAILER__FROM_NAMEstring—Display name in the "From" header

SMTP Provider

VariableTypeDefaultDescription
MONOSPACE_SYSTEM_EMAILER__HOSTstring—SMTP server hostname
MONOSPACE_SYSTEM_EMAILER__PORTinteger—SMTP server port (typically 25, 465, or 587)
MONOSPACE_SYSTEM_EMAILER__USERNAMEstring—SMTP authentication username
MONOSPACE_SYSTEM_EMAILER__PASSWORDstring—SMTP authentication password
MONOSPACE_SYSTEM_EMAILER__TLS_OFFbooleanfalseSet to true to disable TLS

Message Queue (RabbitMQ)

Monospace uses RabbitMQ for internal event processing.

VariableTypeDefaultDescription
MONOSPACE_RABBITMQ__HOSTstring—RabbitMQ hostname
MONOSPACE_RABBITMQ__PORTinteger—RabbitMQ port, for example 5672
MONOSPACE_RABBITMQ__USERstring—RabbitMQ username
MONOSPACE_RABBITMQ__PASSWORDstring—RabbitMQ password
MONOSPACE_RABBITMQ__VHOSTstring/RabbitMQ virtual host
MONOSPACE_RABBITMQ__USE_TLSbooleanfalseUse AMQPS instead of AMQP

Clustering

Runs several replicas against one system database. Requires PostgreSQL, RabbitMQ, and shared file storage. Clustered mode is on by default. See Horizontal Scaling for the deployment requirements.

VariableTypeDefaultDescription
MONOSPACE_CLUSTER__ENABLEDbooleantrueTurns clustered mode and its startup validation on or off
MONOSPACE_CLUSTER__REPLICA_IDstring—Identifies the replica in logs and health output. Falls back to HOSTNAME
MONOSPACE_CLUSTER__CACHE_RECONCILE_INTERVALduration5mHow often a replica checks the system database for changes it has not applied yet
MONOSPACE_CLUSTER__CACHE_RELOAD_TIMEOUTduration15sHow long a replica may fail to pick up changes before it reports itself unready
MONOSPACE_CLUSTER__STARTUP_LOCK_TIMEOUTduration5mHow long a replica waits for another replica to finish migrating
MONOSPACE_CLUSTER__METADATA_LOCK_TIMEOUTduration15sHow long a schema or settings write waits for a concurrent write to finish
MONOSPACE_CLUSTER_MAINTENANCEstringunsetAny value allows MONOSPACE_FORCE_RESET in clustered mode. Setting it to the release version approves destructive migrations

Durations accept human-readable strings such as 15s, 5m, and 2h 30m.


Authentication & Tokens

VariableTypeDefaultDescription
MONOSPACE_ACCESS_TOKEN_TTLduration15mAccess token validity period
MONOSPACE_REFRESH_TOKEN_TTLduration7daysRefresh token validity period
MONOSPACE_RESET_PASSWORD_TOKEN_TTLduration15mPassword reset token validity period
MONOSPACE_RESET_PASSWORD_COOLDOWN_TTLduration30sCooldown before a user can request another password reset
MONOSPACE_INVITE_TOKEN_TTLduration7daysInvite token validity period
MONOSPACE_JWT_LEEWAYinteger60JWT clock skew tolerance in seconds
MONOSPACE_JWT_PRIVATE_KEYstring—Ed25519 private key for JWT signing, as PEM content
MONOSPACE_JWT_PRIVATE_KEY__FILEstring—Path to a PEM file containing the JWT private key
MONOSPACE_JWT_PUBLIC_KEYstring—Ed25519 public key for JWT verification, as PEM content
MONOSPACE_JWT_PUBLIC_KEY__FILEstring—Path to a PEM file containing the JWT public key

Duration values use human-readable format: 15m, 30s, 7days, 1h, etc.


Cookies

VariableTypeDefaultDescription
MONOSPACE_SESSION_COOKIE_NAMEstringmonospace_sessionName of the session cookie
MONOSPACE_REFRESH_COOKIE_NAMEstringmonospace_refreshName of the refresh token cookie
MONOSPACE_COOKIE_SECUREbooleantrueSet the Secure flag on cookies. Set to false for local development over HTTP

Limits

VariableTypeDefaultDescription
MONOSPACE_QUERY_LIMIT_DEFAULTinteger100Default page size when no limit is specified
MONOSPACE_QUERY_LIMIT_MAXinteger—Maximum allowed page size. No limit if unset
MONOSPACE_QUERY_BATCH_SIZEinteger—Batch size for bulk operations
MONOSPACE_QUERY_LIMIT_MAX_FEDERATEDinteger1000Maximum limit for a query whose filter follows a relation into a different data source. Such a query fails when its limit exceeds this value
MONOSPACE_MAX_PAYLOAD_SIZEstring2mMaximum request payload size, except for file uploads. Supports g, m, k suffixes (bytes without suffix)
MONOSPACE_MAX_FILE_PAYLOAD_SIZEstring5mMaximum file upload request size. Replaces MONOSPACE_MAX_PAYLOAD_SIZE on the asset upload endpoints. Supports g, m, k suffixes (bytes without suffix)

Extensions

Extensions are in preview. See Extensions for how Monospace loads them.

VariableTypeDefaultDescription
MONOSPACE_EXTENSIONS__INSTALL_LOCATIONstring./extensionsDirectory scanned at startup for installed extensions. A relative path resolves against the server's working directory
MONOSPACE_EXTENSIONS__AUTO_RELOADbooleanfalseWatches the install location and restarts the data sources whose extension changed. A change to an entry's query capabilities applies only after a restart or a workspace rebuild

Encryption (KMS)

Configures the Key Management Service used to encrypt sensitive values stored in the database.

VariableTypeDefaultDescription
MONOSPACE_KMS__TYPEstring—KMS type. Currently: monospace (local encryption)
MONOSPACE_KMS__MASTER_KEYstring—Base64-encoded master encryption key
MONOSPACE_KMS__MASTER_KEY__FILEstring—Path to a file containing the master key

Content Security Policy

VariableTypeDefaultDescription
MONOSPACE_CONTENT_SECURITY_POLICY__ENABLEDbooleantrueEnable Content-Security-Policy headers
MONOSPACE_CONTENT_SECURITY_POLICY__DIRECTIVES__*string—Override individual CSP directives

CORS

Controls the Cross-Origin Resource Sharing headers the engine sends. CORS is disabled by default — the engine sends no CORS headers until you enable it. Enable it to let browser clients on other origins call your API.

VariableTypeDefaultDescription
MONOSPACE_CORS__ENABLEDbooleanfalseSend CORS headers. The variables below apply only when enabled
MONOSPACE_CORS__ORIGINstring—Allowed origins. Use true to mirror the request origin, * for any origin, or a comma-separated list of origins
MONOSPACE_CORS__METHODSstringGET, POST, PATCH, DELETEAllowed request methods
MONOSPACE_CORS__ALLOWED_HEADERSstringContent-Type, Authorization, Cache-ControlAllowed request headers. * allows any header
MONOSPACE_CORS__EXPOSED_HEADERSstringContent-RangeResponse headers exposed to the browser
MONOSPACE_CORS__CREDENTIALSbooleantrueAllow credentialed requests (cookies, Authorization header)
MONOSPACE_CORS__MAX_AGEduration18000sHow long a browser may cache the preflight response

The default methods, headers, credentials, and max age above apply when MONOSPACE_CORS__ENABLED is true and the variable is left unset.

Caution
A wildcard origin, method, or header cannot be combined with MONOSPACE_CORS__CREDENTIALS=true. The engine rejects this configuration at startup. Name explicit origins when you need to allow credentials.

Observability

VariableTypeDefaultDescription
MONOSPACE_LOGstringinfoLog level filter using tracing EnvFilter syntax. Examples: debug, info,aide=warn, monospace=trace
MONOSPACE_LOG_FORMATstringjsonLog output format: compact, full, pretty, or json. An invalid value fails startup
MONOSPACE_ENABLE_OTEL_EXPORTbooleanfalseExport traces and metrics to an OpenTelemetry collector

When MONOSPACE_ENABLE_OTEL_EXPORT is enabled, configure the collector endpoint using standard OpenTelemetry environment variables (e.g., OTEL_EXPORTER_OTLP_ENDPOINT). Traces and metrics are exported over OTLP/HTTP.

Metrics cover query execution and inbound HTTP requests.

MetricTypeDescription
monospace.connector.query.durationhistogramDuration of a query executed against a data source, in seconds
monospace.connector.queries.activeup-down counterConnector queries currently executing
monospace.connector.pool.connectionsgaugeConnection-pool size by state
monospace.connector.pool.wait_requestsgaugeCallers waiting for a pooled connection
http.server.request.durationhistogramDuration of inbound HTTP requests, in seconds
http.server.active_requestsup-down counterInbound HTTP requests currently in flight

Telemetry

VariableTypeDefaultDescription
MONOSPACE_TELEMETRY__ENABLEDbooleantrue in production-like modeSet to false to disable scheduled anonymous usage telemetry only when the active license permits opting out
MONOSPACE_INSTANCE_OWNER_SYNC_ENABLEDbooleantrueSet to false to opt out of syncing instance-owner details for compliance telemetry

The Starter license requires scheduled telemetry. When the active license requires it, Monospace ignores MONOSPACE_TELEMETRY__ENABLED=false and logs a warning.


MonospaceThe governed API layer for every app, person, and agent.

Copyright © 2026 Monospace Inc.