Skip to content

Configuration reference

For the config file location and first-time creation see getting-started.md. For a full example see config/services.example.json in the repo root.

Format

{
"stackTimeoutSec": 120, // when a stack starts, seconds to wait for each member's port to be ready
"stackConcurrency": 4, // optional: max services starting/restarting/stopping at once for a stack or project (default 4; 0 or unset = default; 1 = one at a time)
"server": { "autoStart": false }, // optional: start devhub automatically when an agent session begins (default false), see agents.md; there are also requireToken and adminViaProxy, see the table below
"repos": { "my-app": "~/code/my-app" }, // optional: the repo list (name → main checkout path); worktrees come from git, and repos are also discovered when agents call devhub
"proxy": {
"host": "dev.example.com", // your dev domain; empty string = proxy disabled
"cfEnvFile": "~/.config/devhub/cf.env", // file holding CLOUDFLARE_API_TOKEN
"certDir": "~/.config/devhub/certs", // directory for certificates and the ACME account key
"rules": [] // special rules, see below
},
"tls": { // optional; omit the whole block = Let's Encrypt + Cloudflare
"mode": "letsencrypt", // "letsencrypt" (default) | "local-ca" (local self-signed CA, no domain or token needed) | "custom" (your own certFile/keyFile)
"certFile": "~/certs/dev.crt", "keyFile": "~/certs/dev.key", // needed only when mode is custom
"dnsProvider": "cloudflare", // "cloudflare" (default) or "duckdns"
"duckdnsEnvFile": "~/.config/devhub/duckdns.env", // duckdns: file holding DUCKDNS_TOKEN
"duckdnsSetIp": true, // duckdns: default true (absent = true) = devhub sets the A record when testing and requesting if it isn't 127.0.0.1; set false only if the subdomain is used for something else
"txtResolvers": { "doh": ["https://cloudflare-dns.com/dns-query", "https://dns.google/resolve"], "udp": ["1.1.1.1", "8.8.8.8"] } // duckdns: resolvers for the propagation check (optional, defaults as shown)
},
"services": {
"myApi": {
"path": "/myapp-api", "port": 5001, "stripPrefix": true, // proxy route
"role": "backend", // role suffix for display
"repo": "my-project", // repo name (a name in repos, a discovered folder name, or Orca's displayName)
"cwd": "src/Api", // subdirectory inside the worktree
"cmd": "dotnet run --launch-profile Api", // run with /bin/sh -c (cmd.exe /d /s /c on Windows)
"env": { "PORT": "5001" } // optional, environment variables
}
},
"stacks": { "My App": ["myApi", "myWeb"], "All": ["@My App", "@Other"] }
}

Field reference

Field Description
stackTimeoutSec Default 120. Timeout in seconds for stack startup and for waiting for containers to be ready
stackConcurrency Optional positive integer, default 4 (unset or 0 = default). Upper bound on how many services a stack or project “start / restart / stop all” works on at once, so a big stack doesn’t swamp the machine. Set 1 for the old one-at-a-time behavior. Older config files without this field keep working
server.envPassthrough Optional, an array of strings. By default devhub doesn’t pass an agent session’s environment variables (ORCA_*, CLAUDE_*, *_TOKEN and so on) to the server, services and external commands; names listed here are let through as exceptions, see agents.md
server.autoStart Optional, default false. true = Claude Code’s SessionStart hook starts devhub automatically when it isn’t running; toggle it with devhub server autostart on|off or “Settings” in the UI, see agents.md
server.requireToken Optional, default false (behavior as before). true = the management API needs a token: the CLI/MCP read admin.token automatically and send X-Devhub-Token, and the web logs in with the URL from devhub server token url and exchanges it for a cookie; manage it with devhub server token on|off|regenerate|url, see development.md
server.adminViaProxy Optional, default true. false = /devhub/ on the proxy domain returns 404 and the admin UI is only at http://127.0.0.1:4999; toggle it with devhub server proxy-admin on|off or the Settings panel
repos Optional. Names map to main checkout paths; manage it with devhub repo add/remove or “Repo list” in the admin UI, see getting-started.md
containerEngine Optional, podman (default) or docker, see containers.md
services.<key> The key is the service identifier and must be unique. Only a service with path and port becomes a proxy route
path Path prefix, which must start with /. Matches both /x and /x/*, case-insensitively. /devhub can’t be used (reserved for the admin UI)
port The port the service actually listens on (1–65535); it can’t repeat another service’s
stopTimeoutSec Stop deadline (seconds, default 10, 1–300): after SIGTERM wait for the whole process group to end and the port to be released, then SIGKILL everything on timeout; while stopping you can press “Force stop” to SIGKILL immediately. For Windows behavior see windows.md
stripPrefix true: remove path before forwarding (for pure API backends); false: keep the prefix (the service itself supports a base path, such as a frontend dev server’s PUBLIC_URL)
host Optional. A subdomain; api expands to api.<proxy.host>, and the full name is also accepted. It applies only on that host name, and path can be / for all paths. The certificate must cover the subdomain, see https-proxy.md
rewritePrefix Optional. Replaces path with this prefix before forwarding (/a/x → /v2/x); can’t be combined with stripPrefix: true
requestHeaders/responseHeaders Optional. { "name": "value" }, where a null value removes the header; a responseHeaders value can also be [{ "from": "…", "to": "…" }] = substring replacement (for example to change a small part of a CSP). The old rewriteHeaders field is merged into responseHeaders when read, and only the new field remains after saving in the UI
changeOrigin Optional. true: change the upstream Host to 127.0.0.1:<port> (the original Host is kept by default)
xForwarded Optional. false: don’t send X-Forwarded-* (by default they are sent and overwritten)
timeout Optional, seconds (1–3600). Respond 504 when the upstream is idle longer than this; without it there is no timeout
repo / cwd / cmd How to start. The service’s actual working directory = the selected worktree path + cwd (must not contain ..). A row without repo or cmd shows “Not configured”
env Optional, extra environment variables (taking precedence over envFile). devhub adds ~/.local/bin to the child process’s PATH
envFile Optional (process services). .env-style files relative to the worktree, see Reproducible runtime environment
requires Optional (process services). Tool version requirements such as { "node": ">=22" }, checked before startup, see Reproducible runtime environment
role / label role is a display suffix (such as my-project · backend); label overrides the whole display name
remote Optional. When the project isn’t in Orca, the source used to look up the GitLab name, such as git.example.com/group/project
prestart Steps before startup, see below
restartAt Optional (process, container, compose). A list of times to restart the service every day, such as ["04:00", "13:30"] (server local time, 24-hour), see Scheduled restart
worktreeInit Optional. Top level: project name → { copy, deps, run } (project level); inside a service: { copy, deps, run } (service level, process services only). The first time a service starts in a new worktree, copies git-ignored config files and handles dependencies such as node_modules; the two levels are merged, see worktree initialization
dependsOn Optional. Services this one depends on, whose condition must be met before startup, see Dependencies and health checks
healthcheck Optional (process and container services). Readiness and continuous health checks; without it only the port is checked (for containers also the image’s health), see Readiness model
kind process (default), container, compose, see below
proxy.host The dev domain. Empty disables the proxy; the admin UI still works
proxy.cfEnvFile File holding CLOUDFLARE_API_TOKEN, default ~/.config/devhub/cf.env; the user enters the token in the management UI’s “Settings” (or creates the file themselves), an agent never handles it
proxy.certDir Certificate directory, default ~/.config/devhub/certs
proxy.rules Declarative special rules, taking precedence over service routes, see below
tls.mode Certificate source: letsencrypt (default; this is what you get if unset), local-ca (devhub generates a root CA and issues from it, see https-proxy.md) or custom. Old configs need no change
tls.certFile, tls.keyFile custom only: a PEM certificate and an unencrypted private key, with paths under the home directory
tls.dnsProvider DNS-01 provider: cloudflare (default, also when there is no tls block) or duckdns. Old configs need no change
tls.duckdnsEnvFile duckdns only, the file holding DUCKDNS_TOKEN, default ~/.config/devhub/duckdns.env
tls.txtResolvers duckdns only, optional. Resolvers for the propagation check: doh (DoH URLs, via the proxy) and udp (IPs), each overridable, an empty array = disabled
tls.duckdnsSetIp duckdns only, default true (absent = true; an explicit false is kept). When testing the connection and requesting a certificate, devhub sets the A record if it isn’t 127.0.0.1 and waits for it to take effect. With false devhub will not update your DNS records; set it yourself at duckdns.org
stacks Stacks: a name maps to an array of members, written as service keys; "@stack name" references another stack

When you edit a service in the UI, saving first validates that the key is unique, that path and port don’t conflict, that cmd isn’t blank, that cwd has no .., and that stacks have no circular references.

prestart

A service can define a pre-start step { "cmd", "cwd", "when", "watch" } (cwd and watch are relative to the worktree):

  • when: "always": runs on every start.
  • when: "changed": runs only when there is no earlier successful record (including after switching worktree), the git HEAD differs, or a file in watch (a folder, a file, or a glob containing *, skipping node_modules) is newer than the last success time.
  • Steps run in order, and if any fails the start aborts and shows the reason. For example npm ci with watch: ["web/package-lock.json"].

“Rebuild” forces every prestart step to run, see usage.md.

Scheduled restart

Some development servers hold a license that lasts only one day in development mode (for example, a license that expires daily), so they must be restarted every day. Set restartAt on a service (an optional list of HH:MM times) and devhub restarts it automatically every day at those times:

"services": { "api": { "restartAt": ["04:00", "13:30"], … } }
  • Times: HH:MM, 24-hour, in the local time of the machine running devhub; 4:00 is padded to 04:00, duplicates are merged and the list is sorted; at most 24 entries. They repeat daily; weekdays and cron are not supported.
  • Only running services are restarted: if the service is stopped (or stopping) at that moment nothing happens, it is not started, and nothing is logged; a port held by an outside process that devhub did not start (“occupied”) is left alone too.
  • Same flow as a manual “Restart”: stop the old one and start a new one, same worktree, prestart rules (when: changed steps that are unchanged don’t rerun), dependsOn, container pre-build, and the service’s busy lock (if it is busy, the restart fails and is recorded). It does not wait for readiness; health state is shown by the health check as usual.
  • Services claimed by an agent: skipped. A claim is an agreement to leave the service alone, so the scheduled restart is skipped and recorded (holder and time), with no catch-up and no retry; the next time slot is checked normally. Claims last at most 4 hours, so they usually expire before the next slot.
  • Missed times are not made up: if the devhub server wasn’t running, or the computer was asleep or hibernating, no missed restart is run after it comes back (and none is recorded); the server starts counting from the moment it starts. The tolerated delay is 2 minutes: a slot noticed within 2 minutes (for example right after waking) still runs, anything older counts as missed. It is checked every 30 seconds, so the actual restart can be up to about 30 seconds later than configured.
  • Records: every automatic restart (success or failure) and every skip because of a claim is written to the activity log (actor “System”, action “Scheduled restart” or “Scheduled restart skipped”, failures with the reason and duration), and process services also get a line in the service’s log ([devhub] … scheduled restart (04:00) done; a container’s log comes from the engine, so containers only have the activity log).
  • Next time shown: while the service is running, its row shows “Next restart 04:00” under the state (“tomorrow” or a date when it isn’t today); devhub status, devhub service restart-at <service> and nextRestartAt (a millisecond timestamp) in /api/state provide it too, null while stopped.
  • Where to set it: the “Scheduled restart” section of the service editor (times separated by commas or spaces); CLI/MCP use devhub service restart-at <service> add|remove|set|clear|list <HH:MM ...> (several at once, see agents.md); service update <service> --set 'restartAt=["04:00"]' works too. restart-at changes only this one field without validating the whole service and takes effect immediately, with no need to restart the service or devhub; ordinary service edits (including restartAt) also take effect immediately for this field, while the other fields still apply on the next start.
  • Backward compatible: the field is optional and services without it behave exactly as before; the config format version goes to 4 (only an optional field is added, converted automatically at startup with a backup).

The "Scheduled restart" section of the service editor

worktree initialization

A new worktree has none of the git-ignored config files (.env, appsettings.Development.json, …) and no node_modules. With worktreeInit configured, devhub fills them in the first time a service of that project is started in a worktree (right before prestart), records that in state.json, and is idempotent. Everything is optional: projects without it behave exactly as before; the main checkout itself is never touched; devhub doesn’t detect worktree creation or poll for it.

"worktreeInit": { // top level; keys are project (repo) names
"my-app": {
"copy": [".env*", "appsettings.*.json", "config/*.local"], // gitignore patterns
"deps": [ // omitted = auto-detect the root and each service's cwd
{ "path": "", "mode": "auto" }, // path is relative to the worktree, empty string = the root
{ "path": "web", "mode": "install" }
]
}
}

Project level and service level: there are two places to configure it, and they are merged at run time, so you don’t have to pick one:

Project level worktreeInit.<project> Service level services.<key>.worktreeInit
Scope shared by the whole project one process service (containers have no worktree and can’t set it)
copy list of gitignore patterns, relative to the worktree root list of gitignore patterns, relative to the service’s cwd (see below); a leading / means the worktree root
run list of commands, run in the worktree root list of commands, run in the service’s cwd (see “Commands after initialization” below)
deps [{ path, mode, cmd? }], one entry per directory a single strategy auto/install/none (none is the same as off and is stored as off) applied to the dependency directory the service’s cwd belongs to (the nearest directory walking up from cwd that has a lockfile or project file, so a monorepo lockfile at the root is found too)
  • Service-level copy is based on the service’s cwd, with gitignore semantics: a pattern without a slash (.env, appsettings.*.json) matches at any depth under cwd, and a pattern with a slash (config/*.local) is anchored at cwd; a pattern with a leading / is always the worktree root (/.env), which is how to copy files outside cwd (for example when envFile points to a parent directory). For a service whose cwd is the root the two are the same. Patterns can’t contain .., so they can’t escape the worktree. The ! negation prefix works as usual. When merging they are converted into root-anchored patterns (.env with cwd src/api → /src/api/**/.env), and “effective” on the worktree initialization page shows the converted result.
  • Merge rules: copy is the union of the project level, every service and .worktreeinclude; deps starts from the project level (when unset: the auto-detected root and each service’s cwd) and a service’s strategy overrides the entry of the directory it belongs to (the entry’s cmd is kept); when several services configure the same directory, the last one in key order wins.
  • A service level alone also enables it: with no project level at all and worktreeInit on just one service, the first start of that project’s services still initializes; projects with neither level behave exactly as before.
  • A service without deps follows the project level. To see who overrides what in the UI: the “worktree initialization” page lists each service’s override and the merged, effective result for every project.
"services": {
"api": { "repo": "my-app", "cwd": "src/api", "cmd": "dotnet10 run",
"worktreeInit": { "copy": ["appsettings.Local.json"], "deps": "install" } } // service level: copy is relative to cwd (src/api)
}

Where to set it: the worktree initialization button in the header (project level: view, edit and see the merged result); the “worktree initialization” section of the service editor (service level; both places have “Fill in suggestions”); in the CLI, the project level with worktree-init set and the service level with service update <service> --set 'worktreeInit={...}'.

Copying config files (copy):

  • Copied from the project’s main checkout into the worktree. Only files that are git-ignored and match a pattern are copied: tracked files and files not yet added to git are not; build output and caches such as node_modules, bin, obj, dist, build, .next and .venv are always excluded. Patterns use the same syntax as .gitignore (git does the matching itself), and a .worktreeinclude in the project root (a Claude Code and Codex convention, also gitignore syntax) is read as well and merged with copy.
  • An existing destination is never overwritten; paths can’t escape the worktree (.. and absolute paths are rejected, and nothing is written if a symlink along the destination points outside the worktree); sources that are symlinks or larger than 10 MB are skipped; at most 1000 files per run. File permissions are preserved.
  • The log ([devhub] worktree 初始化:複製 <path>) records paths only, never contents.
  • Runs only when there is no record, the patterns (including .worktreeinclude) changed, or on a manual apply; later edits to config files in the main checkout are not synced automatically.

Dependencies (deps): one entry per directory, mode is auto (default), install or off. Without deps, the worktree root and the cwd of each of the project’s services are auto-detected, all as auto.

Manager Detected by Install command
npm package.json + package-lock.json npm ci --prefer-offline
pnpm package.json + pnpm-lock.yaml pnpm install --frozen-lockfile
yarn package.json + yarn.lock yarn install --frozen-lockfile (--immutable for yarn 2+)
dotnet, uv, go *.sln/*.csproj, uv.lock, go.sum dotnet restore, uv sync --frozen, go mod download
  • auto for node (npm, pnpm, yarn): if the worktree’s lockfile equals the main checkout’s and the main checkout is installed (has a node_modules) → node_modules is linked to the main checkout’s directory (instant, no disk use); if they differ → the link is removed first, then a real install runs. It is checked before every start, so when switching branches changes the lockfile it converts to an install automatically, and back to a link when it matches again. It never installs while a link is in place (that would modify the main checkout’s node_modules): the link is always removed before installing and checked once more.
  • A node_modules that devhub didn’t create is left alone: a real directory already in the worktree is kept as is (reported as kept in the log and result); only one devhub installed itself is swapped for a link when the lockfile becomes the same.
  • install: always a real install, never a link. Some tools reject paths outside the worktree (for example Next.js/Turbopack); set install for that directory. off: do nothing. cmd overrides the install command (for example { "path": "web", "mode": "install", "cmd": "npm ci" }).
  • For the other ecosystems (dotnet, uv, go) auto only prints the suggested command in the log (once per lockfile), runs nothing and links nothing; mode: "install" runs it (once per lockfile).
  • A failed install (with its exit code) aborts that start and keeps the log; fix it and start again to retry. A hand-written worktreeInit with errors stops that project’s services from starting (400, the message names the field) rather than being skipped silently.
  • Limitation: the link only compares lockfiles and doesn’t check that the main checkout’s node_modules is actually in sync with its own lockfile (if the main checkout forgot to npm ci, the worktree links to stale contents).

Commands after initialization (run): for local-only setup that copying and linking can’t handle, for example a file that is tracked by git but modified in the main checkout and hidden with git update-index --skip-worktree (a new worktree gets the git version). Both the project level and the service level take an optional run: a list of command strings (one per entry, no newlines).

"worktreeInit": { "my-app": { "run": ["echo init $DEVHUB_WORKTREE"] } }, // project level: runs in the worktree root
"services": {
"web": { "repo": "my-app", "cwd": "src/frontend", "cmd": "npm run dev",
"worktreeInit": { "run": [
"cp \"$DEVHUB_MAIN_CHECKOUT/src/frontend/next.config.ts\" next.config.ts",
"git update-index --skip-worktree next.config.ts" // service level: runs in the service cwd (src/frontend)
] } }
}
  • When and in what order: run in order after copying config files and syncing dependencies. Merging follows copy: project level first, then service level (services sorted by key), each level in list order. Not run when dependencies failed.

  • Once per worktree: recorded in state.json only after every command succeeded, and not run again (editing run doesn’t re-run it for an already initialized worktree); worktree-init apply --force re-runs it, so make commands safe to repeat. Never runs in the main checkout.

  • Environment: the same shell as prestart (sh -c on POSIX, cmd.exe /c on Windows, so write cmd syntax there, with %VAR% variables); the service’s environment (sanitized variables plus the service’s env/envFile; a missing envFile doesn’t block it). Extra variables: DEVHUB_MAIN_CHECKOUT (main checkout path), DEVHUB_WORKTREE (worktree path), DEVHUB_REPO (project name); the service level adds DEVHUB_SERVICE (service key) and DEVHUB_SERVICE_CWD (absolute path of the service cwd).

  • Failure: a command that exits non-zero stops the rest, marks initialization as failed and the service does not start (same as a failing prestart); the message names which command and its exit code, the output goes to the service log (worktree-init.log for apply), and the operator sees the failure message in the audit log; nothing is recorded, so the next start retries. A single command times out after 10 minutes; on timeout it is killed and counts as a failure.

  • Difference from prestart: run is “once per worktree” setup (before the envFile/requires checks, so it can supply required files); prestart is a build step that runs “on every start” under its when rule (after those checks).

  • Security: commands come from your own config file, trusted like prestart, with no sandbox; the log prints only the command and directory, never environment variable values. Don’t put secrets in commands.

  • Windows: directory links are junctions, which need neither Developer Mode nor administrator rights; if creating one fails it falls back to a real install and says so in the log.

Auto-suggest (per service): suggestions work from the configured services: only projects that have services are looked at (projects without services aren’t listed), and the scope is the cwd level of each service (subdirectories aren’t searched) plus its declared envFile: git-ignored files matching config patterns such as .env*, appsettings*.json, *.local and *.local.*; for dependencies, the nearest lockfile or project-file directory walking up from cwd. The whole repo is never scanned, only paths are listed and file contents are never read. For one service use devhub worktree-init suggest --service <service> (or “Fill in suggestions” in the service editor, which can use an unsaved cwd/envFile); for a project use suggest <project>/--all. Layering: config files and dependency directories that belong to a single service’s cwd are suggested for that service’s service level (serviceProposals, patterns relative to the service cwd, deps set to auto); the project-level proposal only holds items shared by several services or located outside a service’s cwd (an envFile pointing elsewhere) and can go straight into set. For a single-service project the proposal is usually empty.

Letting an agent help set it up: devhub worktree-init suggest --all produces candidates for every project that has services (projects that already have settings are marked and never overwritten automatically); after reviewing, write them all with devhub worktree-init set --all --file <the suggested JSON> or one by one with set <project>; for a single service run suggest --service <service> and write the service level with service update; for existing worktrees use devhub worktree-init apply <project> --worktree <path> (--force redoes copies and links and reinstalls dependencies devhub installed earlier). See agents.md.

Stacks

A member of stacks can be a service key or "@stack name" (references another stack, and can nest). Startup runs in parallel along the dependsOn graph: members with no dependencies, or whose dependencies are ready, start together and each waits for its own port (timeout stackTimeoutSec; how many run at once is capped by stackConcurrency). Members without dependsOn between them are treated as independent and start together, no longer one by one in member order — write dependsOn where order matters, or set stackConcurrency to 1 to go back to one at a time (dependency order first, otherwise member order). For how to operate them see usage.md.

Dependencies and health checks

Both fields are optional, and without them behavior is exactly as in older versions. Field names follow docker compose (the depends_on condition and the healthcheck interval/timeout/retries/start_period); times are always in seconds and fields end in Sec.

"shopApi": {
"dependsOn": { "shopDb": "service_healthy" }, // shorthand ["shopDb"] = service_started
"healthcheck": { "http": "/health" } // one line is enough
}

dependsOn: ["a", "b"] or { "a": "service_healthy" } ({ "a": { "condition": "service_healthy" } } is also accepted).

condition Meaning
service_started (default) The dependency’s port is listening (for containers, it is running)
service_healthy The dependency’s health check passes; equivalent to service_started when the dependency has no healthcheck; for container services it looks at the health the engine reports (including readyCmd)
  • When a stack starts or restarts, members are scheduled along the dependency graph: a member starts as soon as its dependencies meet their conditions (it doesn’t wait for unrelated members), with at most stackConcurrency running at once; a dependency that isn’t in the stack is pulled in automatically (like compose) and stopped together when the stack stops (kept if it still belongs to another running stack). “Start all” on a project works the same way. On restart, the stop phase runs in parallel in reverse dependency order (downstream first) and the start phase begins only after all stops finish; a member that failed to stop, and the members tied to it, don’t start, while the rest restart normally. Stopping a stack or project is also downstream-first and parallel; one failed stop doesn’t interrupt the others.
  • Before a downstream service starts, devhub waits for each dependency to meet its condition (timeout stackTimeoutSec). On failure, everything that depends on it (directly or indirectly) doesn’t start and is marked blocked with the reason, unrelated members finish as usual, and the overall result is failed, listing the failed and the blocked services. The error names the reason, for example web not started: dependency db did not reach service_healthy within 120 seconds (http /health HTTP 503); if the dependency itself exits first it fails immediately. (The actual message is in Chinese: web 未啟動:依賴 db 未達 service_healthy,120 秒內未通過(http /health HTTP 503).)
  • When you start a service on its own, its dependencies must already be ready, otherwise it returns 409 (devhub CLI exit 1) and says who to start first; devhub doesn’t start dependencies for you.
  • Validation on save: dependencies must exist, may not depend on themselves and may not form a cycle (the error message includes the path, such as dependency cycle: a → b → a). When a handwritten config has a cycle, starting returns 400 with the same message. A service that others depend on can’t be deleted.
  • service_completed_successfully isn’t supported yet (devhub manages long-running services); the error message explains.

healthcheck (process services): choose one of http, tcp and exec.

"healthcheck": { "http": "/health" } // GET 127.0.0.1:<port>/health, passes on 200–399
"healthcheck": { "http": { "path": "/ping", "status": [200, 204] } } // accepts only the listed status codes
"healthcheck": { "tcp": true } // can connect to the service port; you can also write another port number
"healthcheck": { "exec": "curl -fs localhost:5000/ping", "intervalSec": 10, "retries": 5, "startPeriodSec": 30 }
Field Default Range Description
intervalSec 5 1–3600 Probe interval
timeoutSec 3 1–60 Timeout of a single probe (an exec timeout terminates the command)
retries 3 1–20 How many consecutive failures count as unhealthy
startPeriodSec 0 0–3600 Start grace period: failures within this time before the first success aren’t counted
  • exec runs through a shell in the worktree the service runs in (plus cwd), and exit 0 passes. http/tcp connect straight to the service port without going through the devhub proxy.
  • States: starting (before the first success) → healthy → unhealthy (consecutive failures reach retries); one success returns it to healthy. It is shown in the service matrix’s state column (hover over unhealthy for the last error) and in health and healthError of devhub status --json. A process service without healthcheck has no health field. Probing is driven by the background snapshot (every 2.5 seconds while someone has the UI open or calls the API) and doesn’t happen when nobody is querying; unhealthy is informational only, and a service is never restarted automatically.
  • Container services can also set healthcheck (exec runs inside the container, http/tcp connect from the host to the published port); a compose service’s health check is written in the compose file and devhub reads the result the engine reports. See the next section and containers.md.

Service editor: dependency and health check fields

Readiness model

There is only one definition of “ready”: the service state is running and health is neither starting nor unhealthy. The UI, devhub status --json (ready, health, healthError), service_healthy in dependsOn and stack startup waits all use the same test; the sources only differ in how they get health:

Service Ready conditions (in order) health comes from
Process port listening → if there is a healthcheck, it must pass healthcheck (probed by devhub)
Container (kind: container) container running → if the image has a healthcheck, it must be healthy → port listening → if there is a healthcheck, it must pass Reported by the engine, merged with devhub’s healthcheck (any unhealthy → unhealthy, any starting → starting)
compose all members running → no member health in progress or failing → port listening Member health reported by the engine

Field correspondence (moving toward process-compose’s readiness_probe and docker compose’s healthcheck):

Field Applies to Description
healthcheck Process, container The unified probe settings (http/tcp/exec plus interval/timeout/retries/start_period). A process’s exec runs in the worktree; a container’s exec runs inside the container (whitespace-separated arguments, not through a shell), and http/tcp connect from the host to the published port
readyCmd Container The old form, equivalent to healthcheck: { "exec": "<readyCmd>", "timeoutSec": 15 }; old configs need no change and behave the same; use either it or healthcheck (writing both is rejected). New configs should use healthcheck
The image’s HEALTHCHECK Container, compose Run by the engine; devhub reads the result and nothing needs configuring

There is exactly one difference: with the old readyCmd, the state stayed “Starting” until it passed; now it matches process services: starting before it passes, unhealthy after consecutive failures reach retries (default 3) (the state is still running, with no automatic restart), and back to healthy once it recovers.

Not done: process-compose splits readiness (can it take traffic) and liveness (restart on failure) into two probe sets; devhub has only one set, and unhealthy never restarts a service automatically. In development, automatic restarts often hide problems; use devhub restart when you need one.

Reproducible runtime environment

The goal is that “a different machine, a different worktree or a different agent gets the same service environment”. All of it is optional, and without it behavior is as before; when you want it, it is a line or two:

"shopApi": {
"envFile": [".env", ".env.local"], // relative to the worktree; later files override earlier ones
"env": { "PORT": "5601" }, // takes precedence over envFile
"requires": { "node": ">=22", "dotnet": "10" } // check tool versions before startup
}

Environment snapshot

envFile (process services): a string or a list; an item can be written as { "path": ".env.local", "required": false } (the file may be missing). Paths are relative to the worktree (not cwd) and must not contain ...

  • Precedence (low → high): the inherited environment cleaned by devhub (see agents.md) → envFile (later files in the list win) → the config’s env.
  • Format: KEY=VALUE, export KEY=VALUE, # comments, single quotes (literal) and double quotes (supporting \n \t \" \\); in an unquoted value, whitespace followed by # is an inline comment. No variable expansion ($HOME is kept literally). A malformed file reports only the file name and line number and never echoes the content.
  • If a required file is missing, unreadable or malformed, the service doesn’t start (400), and the message says which file.
  • Container services have no worktree and keep using environment; envFile isn’t supported.

requires (process services): { "tool": "version requirement" }. Version requirement syntax: 22 (prefix match, 22.x.y), 22.1, >=22, >=22.1 <24, ^22.1 (same major and not lower), ~22.1 (same minor and not lower). Tool names are arbitrary (node, dotnet, python, go, java…, with nodejs/golang treated as aliases); versions are obtained with <tool> --version (python uses python3, go uses go version, java uses java -version), using the PATH from when devhub started.

  • On a mismatch the service doesn’t start (400), with a message containing the requirement, the current version and suggestions, for example needs node >=22 (source requires): currently 20.1.0; try: nvm install 22 && nvm use 22, fnm use 22, mise use node@22, asdf install nodejs 22; when mise is detected it also suggests changing cmd to mise exec node@22 -- <original command>. devhub never installs or switches versions automatically. (The actual message is in Chinese.)
  • After switching versions, restart devhub so that services see the new PATH (devhub inherits the environment from when it started).
  • Auto-detection: without requires, devhub also reads mise.toml/.mise.toml ([tools]), .tool-versions, .nvmrc, .node-version and global.json (sdk.version, approximating its rollForward rule as “same major, not lower”) in the service’s cwd and the worktree root, and for the same tool the first one found wins (cwd first). A detected mismatch only warns (written to that service’s log and the environment snapshot) and doesn’t block startup: old configs never declared requirements, so they mustn’t suddenly stop starting just because the repo has a .nvmrc. Forms that can’t be compared, such as lts/* and system, are skipped. To block, write requires explicitly.

Supported tools and version files

Only the known tools below are checked; other tools found by auto-detection are skipped. Tool names in requires can be anything; those not listed use <tool> --version.

Tool Version command
node, dotnet, deno, bun, npm, pnpm, yarn, ruby, php <tool> --version
python python3 --version, then python --version on failure
go go version
java java -version
rust rustc --version

Aliases: nodejs is treated as node, golang as go.

Auto-detected version file (in order; first found wins per tool) Tool and content
mise.toml, .mise.toml every known tool under [tools]
.tool-versions asdf format, every known tool
.nvmrc, .node-version node
global.json dotnet (sdk.version, same major and not lower)
Tool Suggested way to switch on a mismatch
node nvm install, fnm use
all mise use, asdf install
dotnet install the given SDK and make it reachable on PATH
mise detected also mise exec <tool>@<version> -- <original command>

Environment snapshot: shows “the environment the service will actually use”, which helps with reproduction and handing over to an agent. The service editor’s “Environment snapshot” button (based on the saved settings), devhub env <service> and the MCP devhub_observe action env (old name devhub_env) all give the same data (GET /api/services/:key/env): the worktree and cwd, the declared environment variables and where each comes from (env or which envFile), whether the envFile exists, whether requires and the tool versions detected from version files match, and the readiness probe. Values of variables whose names contain token/secret/password/key/credential/auth are masked as *** (the same rule as devhub config export); problems in the config are listed under errors rather than failing, which makes it easy to see why it won’t start. A process service needs a worktree: selected, running, or given with --worktree/--here.

When you need the toolchain fully pinned: devhub only checks versions and doesn’t manage tools. To pin even compilers, libraries and system packages into a reproducible environment (the same declaration yielding a bit-for-bit identical environment on every machine), use devenv (Nix) or mise/asdf to prepare the environment first, and let devhub start the services; devhub doesn’t integrate with Nix.

Container services

A service gets one more kind: process (default, the original behavior), container or compose. The engine defaults to podman; to use Docker set "containerEngine": "docker" at the top level.

{
"services": {
"postgres": {
"kind": "container",
"container": "some-postgres", // name of an existing container (only A-Za-z0-9_.- allowed)
"port": 5432, // optional; with a port, readiness waits for it to listen
"healthcheck": { "exec": "pg_isready -h 127.0.0.1 -p 5432" }, // optional; runs inside the container, ready only on success (the old form "readyCmd": "…" still works, see "Readiness model")
"stopTimeoutSec": 20,
"image": "docker.io/library/postgres:16", // optional; used to create the container only when it doesn't exist
"createArgs": ["-p", "5432:5432", "-e", "POSTGRES_PASSWORD=change-me"] // optional; used only at creation, one item per argument
},
"api": {
"kind": "container",
"container": "my-api",
"repo": "my-app", // with repo, the build path is relative to the selected worktree
"build": "./api", // build from a Containerfile/Dockerfile; the minimal form, details below
"dependsOn": ["postgres"], // starts only after postgres is ready; stack members without dependsOn start together
"port": 8080 // without ports, defaults to 8080:8080
},
"billing-mq": {
"kind": "compose",
"project": "billing-mq", // compose project name (-p)
"repo": "billing", // optional; with repo, composeFile is relative to the selected worktree, otherwise it must be absolute
"composeFile": "deploy/compose.yml",
"port": 15673
}
},
"stacks": { "Demo API": ["postgres", "api"] } // api waits for postgres via dependsOn
}
  • path and port are both optional: a TCP service (a database) has no path and only shows its port; a proxy route exists only when path is set.
  • The same container name or compose project name can’t be used by two services.
  • For behavior and limitations see containers.md.

Build from a Containerfile/Dockerfile (kind: "container", field names follow Docker Compose):

"build": "./api" // context; finds Containerfile automatically, then Dockerfile
"build": { "context": "./api", "file": "Containerfile.dev", "args": { "NODE_ENV": "development" }, "target": "dev" }
"ports": ["8080:80"], "environment": { "LOG_LEVEL": "debug" }, "volumes": ["data:/var/lib/app", "./seed:/seed"]
Field Description
build A string = the context, or an object {context, file, args, target}. With repo, paths are relative to the selected worktree (no ..; switching worktree builds that worktree’s files); without repo, the context must be an absolute path. file is relative to the context; without it devhub looks for Containerfile then Dockerfile
image Optional. With build it is the image name; if omitted it is named automatically devhub/<repo>-<key>:<worktree folder> (devhub/<key>:latest without a repo)
ports Optional, host:container. With build and no ports, port:port is published by default
environment Optional, {name: value}
volumes Optional, source:container path[:ro]; the source can be a volume name, an absolute path, or, with build, a ./path relative to the worktree

Like createArgs, ports, environment and volumes are used only when the container is created; without build they can also be used with image (the container is created only if it doesn’t exist). createArgs can still carry other run arguments. A compose service doesn’t use build (the build is written in the compose file).

proxy.rules

Each has a path (an exact match by default, or a prefix match with prefix: true) and exactly one action:

  • respond: respond directly, for example { "path": "/web/env-config.js", "respond": { "status": 200, "headers": { "Content-Type": "application/javascript" }, "body": "window.__env__ = {...};" } }.
  • redirect: for example { "path": "/web", "redirect": { "to": "/web/", "status": 302, "keepQuery": true } }, which adds the trailing slash for a frontend.
  • proxy: forward to the given port, optionally stripping a given prefix, for example the HMR WebSocket: { "path": "/web/ws", "proxy": { "port": 5201, "stripPrefix": "/web" } }. It also accepts rewritePrefix, requestHeaders, responseHeaders, changeOrigin, xForwarded and timeout, with the same meaning as the service fields.

Environment variables

These take precedence over the config file.

Environment variable Default Description
DEVHUB_PORT 4999 Admin UI port, bound to 127.0.0.1 only
DEVHUB_HTTPS_PORT / DEVHUB_HTTP_PORT 443 / 80 Reverse proxy listening ports
DEVHUB_PROXY enabled Set to off to disable the reverse proxy
DEVHUB_CONFIG ~/.config/devhub/services.json Config file location
DEVHUB_CF_ENV the configured proxy.cfEnvFile cf.env path; you can also set CLOUDFLARE_API_TOKEN directly
DEVHUB_CA_DIR ~/.config/devhub/ca Directory of the local CA’s (local-ca) root certificate and private key
DEVHUB_CERT_ROOT the configured proxy.certDir Certificate directory
DEVHUB_DNS_PROVIDER the configured tls.dnsProvider Overrides the DNS provider
DEVHUB_DUCKDNS_ENV / DUCKDNS_TOKEN the configured tls.duckdnsEnvFile DuckDNS env file path; or provide the token directly as an environment variable
HTTPS_PROXY / HTTP_PROXY / NO_PROXY none Send outbound connections through a corporate proxy, see https-proxy.md
DEVHUB_ACME_ENV production Set to staging to use Let’s Encrypt staging (for validating the flow; the certificate is stored in certs/staging/ and browsers don’t trust it)
DEVHUB_STATE_DIR ./.devhub State and log directory
ORCA_CLI_COMMAND orca Orca CLI command
DEVHUB_URL http://127.0.0.1:4999 CLI connection address; only http on 127.0.0.1/localhost is accepted, see agents.md
DEVHUB_ACTOR / DEVHUB_SESSION agent / derived automatically The CLI’s actor and session labels, see agents.md

Config format version

services.json and state.json each carry an integer schemaVersion at the top level (missing means 0, the format before 0.4.0); you don’t write it by hand, devhub maintains it.

  • Old formats are converted automatically: when the server starts and finds an old format, it first backs it up as services.json.bak-<time> (the same for state.json), then converts and writes it back, and the start-up message and server.log record what was converted; conversion is idempotent. The current conversions: the old response-header field rewriteHeaders (including the one inside proxy.rules[].proxy) is merged into responseHeaders, with responseHeaders winning when a header appears in both; the old container field readyCmd is rewritten as healthcheck: { "exec": "…", "timeoutSec": 15 } (when healthcheck already exists, readyCmd is simply dropped). Behavior is the same as before the conversion. schemaVersion 2 adds the optional top-level worktreeInit (and a worktreeInit record in the state file) and needs no data conversion; the bump makes older devhub versions refuse to write, so they don’t silently drop the field. schemaVersion 3 adds the optional service-level services.<key>.worktreeInit, likewise without data conversion. schemaVersion 4 adds the optional service restartAt (scheduled restarts), likewise without data conversion. schemaVersion 5 adds the optional run to worktreeInit (both levels), also without data conversion.
  • A newer format is refused: when a file written by a newer devhub is opened with an older one (for example after a downgrade), the server refuses to start, writes nothing and makes no backup, and the message says to update devhub first; commands that edit the config such as devhub server autostart and server token refuse too. To downgrade, restore the matching .bak-* backup.
  • Saving from the UI or API stamps the current schemaVersion; if the file on disk is an old format (written back by an older version, or restored by hand) it is backed up first.