Guides · § 2.1
2.1Configuration
Everything relay.toml can do: routes, environments, secrets, and webhooks.
All project configuration lives in relay.toml at the project root. It is declarative on purpose: no code runs at config-parse time, so deploys are fast and diffs are readable.
A complete example
name = "hello-api"
region = "iad"
[routes]
dir = "routes"
[environments.staging]
domain = "hello-api-staging.relay.run"
[environments.production]
domain = "api.example.com"
[webhooks]
endpoints = [
{ url = "https://ops.example.com/hooks/relay", events = ["deploy.finished", "route.errored"] },
]Environments
Every project has staging and production. Deploys target staging by default; promotion is atomic:
relay deploy # → staging
relay promote staging # staging build → productionSecrets
Secrets are set per environment and injected as environment variables at runtime. They are never written to disk in your project.
relay secrets set STRIPE_KEY=sk_live_... --env production
relay secrets pull # writes .env.relay for local dev
relay secrets diff # local vs deployed driftMigrating from relay.config.js
The legacy JavaScript config was removed in 1.0. One command converts it:
relay migrate-configThe migration is lossless for every documented option and prints anything it could not map.