Skip to main content

API Configuration

Configuration is loaded from TOML files with APP_ environment variable overrides.

Config files

PathUsage
config/default.tomlLocal / standalone API
config/api/default.tomlclutch-deploy Docker mount
config/{env}.tomlEnvironment-specific (via --env flag)

Environment variables use the APP_ prefix: APP_LOG_LEVEL=debug maps to log_level.

Key settings

SettingDescriptionExample
ws_addrAPI HTTP bind address0.0.0.0:3000
serve_metric_addrPrometheus metrics bind0.0.0.0:9090
clutch_node_ws_urlNode WebSocket URL (no path)ws://127.0.0.1:8081
seq_urlSeq logging URLhttp://seq:5341
seq_api_keySeq API key""
allowed_originsCORS allow-list, or **
jwt_secretJWT signing secret — see rules below32+ random chars
jwt_expiration_hoursToken lifetime (hours)6
log_levelLogging levelinfo
faucet_enabledEnable POST /faucettrue (testnet)
faucet_private_keyFaucet signing keyhex secp256k1
faucet_amount_cltCLT per faucet request1000
default_ride_request_referrerInjected referrer on requestsaddress or empty
default_ride_offer_referrerInjected referrer on offersaddress or empty

Set these to your CLT wallet to earn referrer fees on rides through your Hub. Clients cannot override referrer on the Hub API — it is server-side only. See App Developer Incentives.

jwt_secret validation

The API refuses to start on a weak jwt_secret. It is rejected if it is empty, shorter than 32 characters, or contains any placeholder marker (change-me, changeme, your-secret, your-super-secret, secret-here, placeholder, matched case-insensitively as a substring).

Generate a real one:

openssl rand -hex 32
$bytes = New-Object byte[] 32
[System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
($bytes | ForEach-Object { $_.ToString('x2') }) -join ''

Environment overrides

APP_CLUTCH_NODE_WS_URL=ws://localhost:8081
APP_JWT_SECRET=<64 hex chars from the command above>
APP_FAUCET_ENABLED=false

Docker (clutch-deploy)

The API container mounts config/api/default.toml. Override via .env in clutch-deploy:

JWT_SECRET=<64 hex chars — a placeholder here stops the API from booting>
ALLOWED_ORIGINS=http://localhost:5173

Production checklist

  • Set strong jwt_secret
  • Disable faucet (faucet_enabled = false)
  • Configure CORS / ALLOWED_ORIGINS
  • Use HTTPS via nginx reverse proxy
  • Set SEQ_API_KEY if Seq is exposed

See Security and Deployment.