Configuration
Monospace Server can be configured using environment variables or a config.yaml file. Environment variables are prefixed with MONOSPACE_.
__) 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
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_HOST | string | 127.0.0.1 | Address the server binds to |
MONOSPACE_PORT | integer | 8100 | Port the server listens on |
MONOSPACE_BASE_URL | URL | http://localhost:3000/ | Public base URL used in emails, OAuth redirects, and generated links |
MONOSPACE_SERVE_STATIC_DIR | string | — | Directory to serve static files from. When unset, uses the public folder next to the server binary |
MONOSPACE_SHUTDOWN_DRAIN_DELAY | duration | 0s | How long the server keeps serving after it reports itself unready. Must be shorter than the grace period |
MONOSPACE_SHUTDOWN_GRACE_PERIOD | duration | 30s | Total 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.
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_LICENSE__KEY | string | — | 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__TOKEN | string | — | 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
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:
{redis|valkey|rediss|valkeys}://[username[:password]@]host[:port][/db]
| Component | Semantics |
|---|---|
redis | Connect to Redis without TLS |
valkey | Connect to Valkey without TLS |
rediss | Connect to Redis over TLS |
valkeys | Connect to Valkey over TLS |
username | Optional ACL username. Percent-encode URL-reserved characters |
password | Optional password. Use :password@ when no username is required. Percent-encode URL-reserved characters |
host | Required hostname or IP address. Enclose IPv6 addresses in brackets |
port | Optional port. Defaults to 6379 |
db | Optional 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.
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_REDIS__URL | URL | — | Redis or Valkey connection URL in the format documented above |
MONOSPACE_REDIS__PREFIX | string | monospace: | Prefix for keys created by Monospace. An empty value is valid |
MONOSPACE_REDIS__CONNECTION_TIMEOUT | duration | 2s | Timeout for each connection attempt. Set to 0s to disable |
MONOSPACE_REDIS__RESPONSE_TIMEOUT | duration | 1s | Timeout for each command response. Set to 0s to disable |
MONOSPACE_REDIS__CONFIG_SET__* | string | — | Values applied with CONFIG SET during startup |
MONOSPACE_CACHE__ENABLED | boolean | true | Enable query result caching |
MONOSPACE_CACHE__INCLUDE_STATUS_HEADER | boolean | false | Include the RFC 9211 Cache-Status response header on cache-aware REST reads. CORS exposes the header automatically when enabled |
MONOSPACE_CACHE__TTL | duration | 5m | Maximum cache entry age. 0s uses an effective TTL of 365 days so entries remain eligible for volatile eviction |
MONOSPACE_CACHE__MAX_ENTRY_SIZE | byte size | 8m | Maximum 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:
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.
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_REDIS__TLS__CA_CERT | string | Default trusted roots | Custom CA certificate content encoded as base64 |
MONOSPACE_REDIS__TLS__CA_CERT__FILE | string | — | Path to a custom CA certificate |
MONOSPACE_REDIS__TLS__CLIENT_CERT | string | — | Client certificate chain encoded as base64 |
MONOSPACE_REDIS__TLS__CLIENT_CERT__FILE | string | — | Path to a client certificate chain |
MONOSPACE_REDIS__TLS__CLIENT_KEY | string | — | Client private key encoded as base64 |
MONOSPACE_REDIS__TLS__CLIENT_KEY__FILE | string | — | Path to a client private key |
MONOSPACE_REDIS__TLS__CLIENT_KEY_PASSWORD | string | — | 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.
transaction:
long_running_mutation_warning_threshold: 30s
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_TRANSACTION__LONG_RUNNING_MUTATION_WARNING_THRESHOLD | duration or null | 30s | Time 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.
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_SYSTEM_DATABASE__PROVIDER | string | — | Database provider. Currently: postgres |
PostgreSQL Provider
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_SYSTEM_DATABASE__HOST | string | — | Database hostname |
MONOSPACE_SYSTEM_DATABASE__PORT | integer | — | Database port |
MONOSPACE_SYSTEM_DATABASE__USER | string | — | Database username |
MONOSPACE_SYSTEM_DATABASE__PASSWORD | string | — | Database password |
MONOSPACE_SYSTEM_DATABASE__DBNAME | string | — | Database name |
SSL Configuration
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_SYSTEM_DATABASE__SSL__MODE | string | require | SSL mode: disable, prefer, require, verify-ca, verify-full |
MONOSPACE_SYSTEM_DATABASE__SSL__CA_CERT | string | — | CA certificate (base64-encoded or file path) |
MONOSPACE_SYSTEM_DATABASE__SSL__CLIENT_CERT | string | — | Client certificate (base64-encoded) |
MONOSPACE_SYSTEM_DATABASE__SSL__CLIENT_KEY | string | — | Client private key (base64-encoded) |
MONOSPACE_SYSTEM_DATABASE__SSL__CLIENT_KEY_PASSWORD | string | — | Password for encrypted client key |
File Storage
Configures where Monospace stores uploaded files and assets.
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_SYSTEM_FILE_STORAGE__PROVIDER | string | — | Storage provider: local or s3 |
MONOSPACE_REDIRECT_ASSET_READ | boolean | false | Redirect asset reads to the file storage provider instead of proxying through the server |
MONOSPACE_ASSET_PRESIGNED_URL_TTL | duration | 1h | Validity period for presigned asset URLs (e.g., 15m, 1h, 60s) |
Local Provider
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_SYSTEM_FILE_STORAGE__ROOT_PATH | string | — | Absolute path to the directory where files are stored |
MONOSPACE_SYSTEM_FILE_STORAGE__SHARED | boolean | false | Marks 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.).
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_SYSTEM_FILE_STORAGE__BUCKET | string | — | S3 bucket name |
MONOSPACE_SYSTEM_FILE_STORAGE__ACCESS_KEY_ID | string | — | AWS access key ID |
MONOSPACE_SYSTEM_FILE_STORAGE__SECRET_ACCESS_KEY | string | — | AWS secret access key |
MONOSPACE_SYSTEM_FILE_STORAGE__REGION | string | auto | AWS region |
MONOSPACE_SYSTEM_FILE_STORAGE__ENDPOINT | string | — | Custom endpoint URL (for S3-compatible services) |
MONOSPACE_SYSTEM_FILE_STORAGE__ROOT_PATH | string | — | Prefix path within the bucket |
Configures outbound email for invitations, password resets, and notifications.
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_SYSTEM_EMAILER__PROVIDER | string | — | Email provider: smtp |
MONOSPACE_SYSTEM_EMAILER__FROM_ADDRESS | string | — | Sender email address in the "From" header |
MONOSPACE_SYSTEM_EMAILER__FROM_NAME | string | — | Display name in the "From" header |
SMTP Provider
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_SYSTEM_EMAILER__HOST | string | — | SMTP server hostname |
MONOSPACE_SYSTEM_EMAILER__PORT | integer | — | SMTP server port (typically 25, 465, or 587) |
MONOSPACE_SYSTEM_EMAILER__USERNAME | string | — | SMTP authentication username |
MONOSPACE_SYSTEM_EMAILER__PASSWORD | string | — | SMTP authentication password |
MONOSPACE_SYSTEM_EMAILER__TLS_OFF | boolean | false | Set to true to disable TLS |
Message Queue (RabbitMQ)
Monospace uses RabbitMQ for internal event processing.
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_RABBITMQ__HOST | string | — | RabbitMQ hostname |
MONOSPACE_RABBITMQ__PORT | integer | — | RabbitMQ port, for example 5672 |
MONOSPACE_RABBITMQ__USER | string | — | RabbitMQ username |
MONOSPACE_RABBITMQ__PASSWORD | string | — | RabbitMQ password |
MONOSPACE_RABBITMQ__VHOST | string | / | RabbitMQ virtual host |
MONOSPACE_RABBITMQ__USE_TLS | boolean | false | Use 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.
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_CLUSTER__ENABLED | boolean | true | Turns clustered mode and its startup validation on or off |
MONOSPACE_CLUSTER__REPLICA_ID | string | — | Identifies the replica in logs and health output. Falls back to HOSTNAME |
MONOSPACE_CLUSTER__CACHE_RECONCILE_INTERVAL | duration | 5m | How often a replica checks the system database for changes it has not applied yet |
MONOSPACE_CLUSTER__CACHE_RELOAD_TIMEOUT | duration | 15s | How long a replica may fail to pick up changes before it reports itself unready |
MONOSPACE_CLUSTER__STARTUP_LOCK_TIMEOUT | duration | 5m | How long a replica waits for another replica to finish migrating |
MONOSPACE_CLUSTER__METADATA_LOCK_TIMEOUT | duration | 15s | How long a schema or settings write waits for a concurrent write to finish |
MONOSPACE_CLUSTER_MAINTENANCE | string | unset | Any 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
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_ACCESS_TOKEN_TTL | duration | 15m | Access token validity period |
MONOSPACE_REFRESH_TOKEN_TTL | duration | 7days | Refresh token validity period |
MONOSPACE_RESET_PASSWORD_TOKEN_TTL | duration | 15m | Password reset token validity period |
MONOSPACE_RESET_PASSWORD_COOLDOWN_TTL | duration | 30s | Cooldown before a user can request another password reset |
MONOSPACE_INVITE_TOKEN_TTL | duration | 7days | Invite token validity period |
MONOSPACE_JWT_LEEWAY | integer | 60 | JWT clock skew tolerance in seconds |
MONOSPACE_JWT_PRIVATE_KEY | string | — | Ed25519 private key for JWT signing, as PEM content |
MONOSPACE_JWT_PRIVATE_KEY__FILE | string | — | Path to a PEM file containing the JWT private key |
MONOSPACE_JWT_PUBLIC_KEY | string | — | Ed25519 public key for JWT verification, as PEM content |
MONOSPACE_JWT_PUBLIC_KEY__FILE | string | — | Path to a PEM file containing the JWT public key |
Duration values use human-readable format: 15m, 30s, 7days, 1h, etc.
Cookies
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_SESSION_COOKIE_NAME | string | monospace_session | Name of the session cookie |
MONOSPACE_REFRESH_COOKIE_NAME | string | monospace_refresh | Name of the refresh token cookie |
MONOSPACE_COOKIE_SECURE | boolean | true | Set the Secure flag on cookies. Set to false for local development over HTTP |
Limits
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_QUERY_LIMIT_DEFAULT | integer | 100 | Default page size when no limit is specified |
MONOSPACE_QUERY_LIMIT_MAX | integer | — | Maximum allowed page size. No limit if unset |
MONOSPACE_QUERY_BATCH_SIZE | integer | — | Batch size for bulk operations |
MONOSPACE_QUERY_LIMIT_MAX_FEDERATED | integer | 1000 | Maximum 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_SIZE | string | 2m | Maximum request payload size, except for file uploads. Supports g, m, k suffixes (bytes without suffix) |
MONOSPACE_MAX_FILE_PAYLOAD_SIZE | string | 5m | Maximum 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.
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_EXTENSIONS__INSTALL_LOCATION | string | ./extensions | Directory scanned at startup for installed extensions. A relative path resolves against the server's working directory |
MONOSPACE_EXTENSIONS__AUTO_RELOAD | boolean | false | Watches 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.
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_KMS__TYPE | string | — | KMS type. Currently: monospace (local encryption) |
MONOSPACE_KMS__MASTER_KEY | string | — | Base64-encoded master encryption key |
MONOSPACE_KMS__MASTER_KEY__FILE | string | — | Path to a file containing the master key |
Content Security Policy
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_CONTENT_SECURITY_POLICY__ENABLED | boolean | true | Enable 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.
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_CORS__ENABLED | boolean | false | Send CORS headers. The variables below apply only when enabled |
MONOSPACE_CORS__ORIGIN | string | — | Allowed origins. Use true to mirror the request origin, * for any origin, or a comma-separated list of origins |
MONOSPACE_CORS__METHODS | string | GET, POST, PATCH, DELETE | Allowed request methods |
MONOSPACE_CORS__ALLOWED_HEADERS | string | Content-Type, Authorization, Cache-Control | Allowed request headers. * allows any header |
MONOSPACE_CORS__EXPOSED_HEADERS | string | Content-Range | Response headers exposed to the browser |
MONOSPACE_CORS__CREDENTIALS | boolean | true | Allow credentialed requests (cookies, Authorization header) |
MONOSPACE_CORS__MAX_AGE | duration | 18000s | How 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.
MONOSPACE_CORS__CREDENTIALS=true. The engine rejects this configuration at startup. Name explicit origins when you need to allow credentials.Observability
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_LOG | string | info | Log level filter using tracing EnvFilter syntax. Examples: debug, info,aide=warn, monospace=trace |
MONOSPACE_LOG_FORMAT | string | json | Log output format: compact, full, pretty, or json. An invalid value fails startup |
MONOSPACE_ENABLE_OTEL_EXPORT | boolean | false | Export 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.
| Metric | Type | Description |
|---|---|---|
monospace.connector.query.duration | histogram | Duration of a query executed against a data source, in seconds |
monospace.connector.queries.active | up-down counter | Connector queries currently executing |
monospace.connector.pool.connections | gauge | Connection-pool size by state |
monospace.connector.pool.wait_requests | gauge | Callers waiting for a pooled connection |
http.server.request.duration | histogram | Duration of inbound HTTP requests, in seconds |
http.server.active_requests | up-down counter | Inbound HTTP requests currently in flight |
Telemetry
| Variable | Type | Default | Description |
|---|---|---|---|
MONOSPACE_TELEMETRY__ENABLED | boolean | true in production-like mode | Set to false to disable scheduled anonymous usage telemetry only when the active license permits opting out |
MONOSPACE_INSTANCE_OWNER_SYNC_ENABLED | boolean | true | Set 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.