denvig gateway
The gateway command manages a local nginx-based reverse proxy that routes
traffic to your development services using custom domains and TLS. It maps a
friendly domain such as api.local to whichever service currently owns it.
denvig gateway <subcommand>Global options
Section titled “Global options”| Option | Description |
|---|---|
--project |
The project slug to run against. Defaults to the current directory. |
--json |
Output in JSON format. |
Subcommands
Section titled “Subcommands”status
Section titled “status”Show the current gateway configuration status — the nginx process state, the config paths, and every running service routed through the gateway across all projects:
denvig gateway statusstatus is the default subcommand, so denvig gateway on its own does the same
thing. It lists the same services, in the same format, as gateway configure.
configure
Section titled “configure”Reconcile launchctl with denvig’s recorded state (~/.denvig/state.json) and
rebuild every nginx config from the current service definitions:
denvig gateway configureRun this after editing service http settings in your config, or any time the
gateway and your running services drift out of sync.
Generated nginx config
Section titled “Generated nginx config”Every routed service is written into a single ~/.denvig/nginx.conf, sorted by
domain. Each server block is annotated with the service it belongs to and the
location of its logs, so you can read the file directly to see exactly what the
gateway is serving:
cat ~/.denvig/nginx.confThe main nginx.conf that denvig generates, in the parent of the
gateway.configsPath directory, includes
this file.
Requests that don’t map to a running service are never handed to an unrelated app:
- A domain whose service is stopped shows a “Service Unavailable” page, even if another app is listening on the same port.
- HTTPS requests for a domain with no matching service or certificate are rejected.
How domains are configured
Section titled “How domains are configured”Domains come from each service’s http configuration.
A service with an http.domain is routed through the gateway; with
http.secure: true it is served over HTTPS using a certificate from the
local CA.
services: api: command: pnpm dev http: port: 3000 domain: api.local secure: trueWhen you start a service you can override
the configured domains for that run with --domains, which claims the domain from
any current owner and hands it back on stop. This is the mechanism behind swapping
a domain between worktrees.