Configuration Reference
Complete reference for router.yaml. Generated from routerd init.
All sections are optional — sensible defaults are applied automatically. The router operates in federation mode : subgraph URLs, schemas, and routing rules come from the supergraph bundle pushed via the control plane, not from this file. This file controls router-level behavior only.
Generated Default
Run routerd init to generate a production-ready router.yaml:
# HyperRoute Router Configuration
# ================================
#
# The router operates in push-based mode:
# - Router starts empty (no schema loaded)
# - Push snapshots via: POST /control-plane/snapshots
# - Activate snapshots via: POST /control-plane/activate
#
# Environment variables:
# RUST_LOG - Log level (debug, info, warn, error)
# LOG_FORMAT - Log format (json, pretty)
# OTEL_EXPORTER_OTLP_ENDPOINT - OTLP collector (e.g., http://localhost:4317)
# OTEL_SERVICE_NAME - Service name in traces (default: hyperroute-router)
mode: federation
server:
host: 0.0.0.0
port: 4000
Everything below the server block is optional. If omitted, the defaults documented here apply.
Top-Level Keys
Key Type Default Description modestring federationAlways federation. Bundle-driven routing. schemaobject nullGraphQL SDL location. Optional when using bundles. serverobject required HTTP server bind settings limitsobject defaults below Concurrency and dedup limits persisted_opsobject disabled Persisted (allowlisted) operations federationobject defaults below Entity batching and plan cache multi_tenantobject disabled Multi-tenant isolation authobject disabled Authentication and authorization shutdownobject defaults below Graceful shutdown behavior securityobject defaults below Query validation and introspection observabilityobject defaults below Metrics, tracing, logs, slow queries subscriptionsobject disabled Real-time subscriptions (SSE / graphql-ws) http2object enabled HTTP/2 upstream connection pool pollobject disabled @poll directive for stateless real-timepii_detectionobject disabled PII detection and masking time_travelobject disabled Time Travel debugging schema_rate_limitobject disabled Field-level rate limiting connection_affinityobject disabled Upstream connection affinity n_plus_one_preventionobject enabled N+1 query auto-prevention
server
server:
host: 0.0.0.0
port: 4000
Field Type Default Description hoststring 0.0.0.0Bind address portu16 4000HTTP listen port. Override with PORT env var.
limits
limits:
max_concurrency_per_upstream: 100
max_total_concurrency: 500
max_inflight_fetches: 10000
max_waiters_per_fetch: 1000
Field Type Default Description max_concurrency_per_upstreamusize 100Semaphore per upstream max_total_concurrencyusize 500Global semaphore across all upstreams max_inflight_fetchesusize 10000Max in-flight dedup entries. 0 disables dedup. max_waiters_per_fetchusize 1000Max waiters coalesced on a single fetch
persisted_ops
persisted_ops:
enabled: false
allowlist_path: null
mode: disabled
Field Type Default Description enabledbool falseEnable persisted operations allowlist_pathstring nullPath to JSON allowlist file modestring disabledenforce — block unknown ops. observe — log unknown. disabled — allow all.
federation
federation:
entity_batching:
enabled: false
max_entities_per_batch: 200
max_batch_wait_micros: 500
max_entity_cache_entries: 2000
plan_cache_capacity: 0
Field Type Default Description plan_cache_capacityusize 0LRU cache slots for query plans. 0 = unbounded.
federation.entity_batching
Field Type Default Description enabledbool falseEnable entity batching max_entities_per_batchusize 200Batch fires at this size max_batch_wait_microsu64 500Max wait before batch fires max_entity_cache_entriesusize 2000Per-request entity result cache
multi_tenant
multi_tenant:
enabled: false
resolution_strategy: header
default_tenant: default
header_name: x-tenant-id
jwt_claim_path: tenant_id
default_limits:
max_qps: 1000
max_concurrent_requests: 100
max_subscriptions: 50
max_cache_entries: 10000
tenants: {}
Field Type Default Description enabledbool falseEnable multi-tenant isolation resolution_strategystring headerheader, jwt, or api_keydefault_tenantstring defaultFallback tenant ID header_namestring x-tenant-idTenant header (when strategy = header) jwt_claim_pathstring tenant_idJWT claim for tenant (when strategy = jwt) tenantsmap {}Per-tenant limit overrides
multi_tenant.default_limits
Field Type Default Description max_qpsu64 1000Max queries per second max_concurrent_requestsu64 100Max concurrent requests max_subscriptionsu64 50Max active subscriptions max_cache_entriesu64 10000Max cache entries
auth
auth:
enabled: false
strategy: jwt
jwt:
secret: null
algorithm: HS256
issuer: null
audience: null
required_claims: []
tenant_claim: tenant_id
roles_claim: roles
api_key:
header_name: x-api-key
keys: []
authorization:
enabled: false
rules: []
Field Type Default Description enabledbool falseEnable authentication strategystring jwtjwt or api_key
auth.jwt
Field Type Default Description secretstring nullHMAC secret or public key. Supports ${ENV_VAR} algorithmstring HS256HS256, RS256, ES256, etc.issuerstring nullExpected iss claim audiencestring nullExpected aud claim required_claimsstring[] []Claims that must be present tenant_claimstring tenant_idClaim used for tenant resolution roles_claimstring rolesClaim used for role-based auth
auth.api_key
Field Type Default Description header_namestring x-api-keyHeader containing the API key keysstring[] []Allowed API keys
auth.authorization
Field Type Default Description enabledbool falseEnable authorization rules rulesarray []Authorization rules
shutdown
shutdown:
drain_timeout_secs: 30
force_shutdown_after_secs: 35
log_active_requests: true
Field Type Default Description drain_timeout_secsu64 30Grace period for in-flight requests force_shutdown_after_secsu64 35Hard kill after drain log_active_requestsbool trueLog active requests during drain
security
security:
max_query_depth: 15
max_query_complexity: 5000
max_query_length: 500000
max_aliases_per_field: 15
enable_introspection: false
allow_argument_sampling: false
allow_variable_logging: false
redact_headers:
- authorization
- cookie
- x-api-key
log_body: false
Field Type Default Description max_query_depthusize 15Maximum query nesting depth max_query_complexityusize 5000Maximum complexity score max_query_lengthusize 500000Maximum query string (bytes) max_aliases_per_fieldusize 15Maximum aliases per field enable_introspectionbool falseAllow introspection queries allow_argument_samplingbool falseSample query arguments in traces allow_variable_loggingbool falseLog query variables redact_headersstring[] [authorization, cookie, x-api-key]Headers redacted from logs log_bodybool falseLog request/response bodies
observability
observability.metrics
observability:
metrics:
enabled: true
listen_host: 0.0.0.0
listen_port: 9091
path: /metrics
buckets_ms:
- 1.0
- 2.0
- 5.0
- 10.0
- 25.0
- 50.0
- 100.0
- 250.0
- 500.0
- 1000.0
- 2500.0
- 5000.0
label_op_name: true
max_ops_tracked: 2000
Field Type Default Description enabledbool trueEnable Prometheus metrics export listen_hoststring 0.0.0.0Metrics server bind address listen_portu16 9091Metrics server port pathstring /metricsScrape endpoint path buckets_msf64[] [1, 2, 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000]Histogram buckets (ms) label_op_namebool trueAdd operation name label to metrics max_ops_trackedusize 2000Max unique operations tracked (prevents cardinality explosion)
observability.tracing
tracing:
enabled: false
otlp_endpoint: null
service_name: hyperroute-router
sampling_rate: 1.0
propagation: w3c
Field Type Default Description enabledbool falseEnable OTLP trace export otlp_endpointstring nullOTLP gRPC endpoint. Override with OTEL_EXPORTER_OTLP_ENDPOINT env var. service_namestring hyperroute-routerService name in traces. Override with OTEL_SERVICE_NAME. sampling_ratef64 1.0Trace sampling rate (0.0–1.0) propagationstring w3cContext propagation: w3c, b3, or jaeger
observability.slow_queries
slow_queries:
enabled: true
threshold_ms: 250
sample_rate: 1.0
store_last_n: 5000
include_plan: true
Field Type Default Description enabledbool trueEnable slow query tracking threshold_msu64 250Queries slower than this are flagged sample_ratef64 1.0Sampling rate for slow query capture store_last_nusize 5000Ring buffer of recent slow queries include_planbool trueInclude query plan in slow query data
observability.logs
logs:
structured: true
slow_query_event: true
Field Type Default Description structuredbool trueUse structured JSON logging slow_query_eventbool trueEmit log events for slow queries
observability.execution_intelligence
execution_intelligence:
enabled: true
sampling_rate: 1.0
include_in_response: false
subgraph_spans: true
entity_spans: true
Field Type Default Description enabledbool trueEnable execution intelligence spans sampling_ratef64 1.0Span sampling rate include_in_responsebool falseInclude execution details in GraphQL response extensions subgraph_spansbool trueEmit per-subgraph spans entity_spansbool trueEmit per-entity spans
subscriptions
subscriptions:
enabled: false
client_transport: sse
sse:
path: /graphql/stream
heartbeat_interval_ms: 15000
max_event_bytes: 262144
upstream_ws:
protocol: graphql-ws
connect_timeout_ms: 5000
keepalive_interval_ms: 15000
reconnect:
min_backoff_ms: 200
max_backoff_ms: 10000
max_retries: 5
jitter: true
limits:
max_active_total: 20000
max_active_per_tenant: 2000
max_active_per_ip: 200
max_active_per_connection: 50
max_pending_events_per_subscription: 200
max_event_rate_per_subscription_per_sec: 50
Field Type Default Description enabledbool falseEnable subscription support client_transportstring ssesse or graphql-ws
subscriptions.sse
Field Type Default Description pathstring /graphql/streamSSE endpoint path heartbeat_interval_msu64 15000Heartbeat interval max_event_bytesusize 262144Max event payload size (256 KB)
subscriptions.upstream_ws
Field Type Default Description protocolstring graphql-wsWebSocket sub-protocol connect_timeout_msu64 5000Connection timeout keepalive_interval_msu64 15000Ping/pong keepalive interval
subscriptions.upstream_ws.reconnect
Field Type Default Description min_backoff_msu64 200Initial backoff delay max_backoff_msu64 10000Maximum backoff cap max_retriesu32 5Max reconnect attempts jitterbool trueApply jitter to backoff
subscriptions.limits
Field Type Default Description max_active_totalusize 20000Global subscription limit max_active_per_tenantusize 2000Per-tenant limit max_active_per_ipusize 200Per-IP limit max_active_per_connectionusize 50Per-connection limit max_pending_events_per_subscriptionusize 200Event backpressure buffer max_event_rate_per_subscription_per_secu32 50Max events/sec per subscription
http2
http2:
enabled: true
pool_max_idle_per_host: 100
pool_idle_timeout_secs: 300
tcp_keepalive_secs: 30
initial_window_size: 1048560
max_frame_size: 16384
adaptive_window: true
max_concurrent_streams: 1000
connect_timeout_ms: 5000
request_timeout_ms: 30000
preconnect: true
Field Type Default Description enabledbool trueEnable HTTP/2 for upstream connections pool_max_idle_per_hostusize 100Max idle connections per host pool_idle_timeout_secsu64 300Idle connection timeout tcp_keepalive_secsu64 30TCP keepalive interval initial_window_sizeu32 1048560Initial HTTP/2 window size (~1 MB) max_frame_sizeu32 16384Max HTTP/2 frame size (16 KB) adaptive_windowbool trueAuto-tune window size max_concurrent_streamsu32 1000Max concurrent streams per connection connect_timeout_msu64 5000Connection establishment timeout request_timeout_msu64 30000Per-request timeout preconnectbool truePreconnect to known subgraphs on startup
poll
poll:
enabled: false
min_interval_secs: 1
max_interval_secs: 300
default_interval_secs: 5
max_per_connection: 5
max_global: 5000
Field Type Default Description enabledbool falseEnable @poll directive min_interval_secsu64 1Minimum poll interval (prevents abuse) max_interval_secsu64 300Maximum poll interval default_interval_secsu64 5Default when client omits interval max_per_connectionusize 5Max poll streams per WebSocket connection max_globalusize 5000Global max poll streams
pii_detection
pii_detection:
enabled: false
default_action: mask
hash_secret: ''
patterns:
- type: email
action: mask
mask_char: '*'
visible_chars: 3
require_scope: read:email
- type: phone
action: mask
mask_char: '*'
visible_chars: 4
require_scope: read:pii
- type: ssn
action: redact
mask_char: '*'
visible_chars: 4
require_scope: read:pii
- type: credit_card
action: mask
mask_char: '*'
visible_chars: 4
require_scope: read:payment
field_rules: []
audit:
enabled: false
log_access: true
log_masked: false
Field Type Default Description enabledbool falseEnable PII detection and masking default_actionstring maskDefault action: mask, redact, hash, block, or log hash_secretstring ""HMAC-SHA256 secret for hash action. Supports ${ENV_VAR}. field_rulesarray []Per-field override rules
pii_detection.patterns[]
Built-in patterns detect common PII types. Each pattern can be overridden:
Field Type Description typestring PII type: email, phone, ssn, credit_card actionstring mask, redact, hash, block, or logmask_charstring Character used for masking visible_charsusize Number of trailing characters left visible require_scopestring OAuth scope required to see unmasked value
pii_detection.audit
Field Type Default Description enabledbool falseEnable PII audit logging log_accessbool trueLog PII field access log_maskedbool falseLog masked values (for debugging)
time_travel
time_travel:
enabled: false
recording:
enabled: false
sample_rate: 0.1
storage: memory
storage_path: .hyperroute/time-travel
retention_days: 30
exclude_variables:
- password
- token
- secret
exclude_headers:
- authorization
- cookie
- x-api-key
max_response_size: 1048576
replay:
enabled: true
max_concurrent: 10
timeout_ms: 30000
ℹ️ In production, use storage: otel to export recordings via OpenTelemetry. The router does not own storage — your observability platform captures and stores the recordings.
Field Type Default Description enabledbool falseEnable time travel debugging
time_travel.recording
Field Type Default Description enabledbool falseEnable recording sample_ratef64 0.1Sampling rate (10%) storagestring memorymemory for dev, otel for productionstorage_pathstring .hyperroute/time-travelLocal storage path (memory mode) retention_daysu32 30Retention period exclude_variablesstring[] [password, token, secret]Variables stripped from recordings exclude_headersstring[] [authorization, cookie, x-api-key]Headers stripped from recordings max_response_sizeusize 1048576Max recorded response size (1 MB)
time_travel.replay
Field Type Default Description enabledbool trueEnable replay max_concurrentusize 10Max concurrent replays timeout_msu64 30000Replay timeout
schema_rate_limit
schema_rate_limit:
enabled: false
field_limits: {}
type_limits: {}
depth_limits: []
subgraph_limits: {}
defaults:
requests_per_minute: 1000
requests_per_second: 100
max_depth: 15
Field Type Default Description enabledbool falseEnable schema-aware rate limiting field_limitsmap {}Per-field limits ("Type.field" → rate config) type_limitsmap {}Per-type limits depth_limitsarray []Depth-based limits subgraph_limitsmap {}Per-subgraph limits
schema_rate_limit.defaults
Field Type Default Description requests_per_minuteu64 1000Default per-minute limit requests_per_secondu64 100Default per-second limit max_depthusize 15Default max depth
connection_affinity
connection_affinity:
enabled: false
strategies: {}
health_check:
interval_seconds: 30
timeout_seconds: 5
unhealthy_threshold: 3
healthy_threshold: 2
path: /health
global:
max_bindings: 100000
pool_size_per_instance: 50
connection_reuse: true
Field Type Default Description enabledbool falseEnable affinity routing strategiesmap {}Per-subgraph strategy: session, consistent_hash, round_robin, least_connections
ℹ️ Subgraph names in strategies reference subgraphs from the bundle , not from this file.
connection_affinity.health_check
Field Type Default Description interval_secondsu64 30Health check interval timeout_secondsu64 5Health check timeout unhealthy_thresholdu32 3Failures before marking unhealthy healthy_thresholdu32 2Successes before marking healthy pathstring /healthHealth check endpoint path
connection_affinity.global
Field Type Default Description max_bindingsusize 100000Max affinity bindings in memory pool_size_per_instanceusize 50Connection pool per upstream instance connection_reusebool trueReuse connections across requests
n_plus_one_prevention
n_plus_one_prevention:
enabled: true
max_batch_size: 100
batch_window_ms: 5
deduplication_enabled: true
adaptive_batching: false
max_retries: 2
log_patterns: true
Field Type Default Description enabledbool trueEnable N+1 auto-prevention (enabled by default) max_batch_sizeusize 100Maximum batch size batch_window_msu64 5Batch collection window (ms) deduplication_enabledbool trueDeduplicate entities within batches adaptive_batchingbool falseLearn cardinality patterns over time max_retriesu32 2Retry failed batches log_patternsbool trueLog detected N+1 patterns
Environment Variables
Variable Overrides Description RUST_LOG— Log level (debug, info, warn, error) LOG_FORMAT— Log format (json, pretty) OTEL_EXPORTER_OTLP_ENDPOINTobservability.tracing.otlp_endpointOTLP collector endpoint OTEL_SERVICE_NAMEobservability.tracing.service_nameService name in traces PII_HMAC_SECRETpii_detection.hash_secretHMAC secret for PII hashing PORTserver.portHTTP listen port HOSTserver.hostBind address
All inject header values and hash_secret support ${ENV_VAR} expansion.