Skip to content
DocsChangelogv0.7.8

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.

Terminal window
denvig gateway <subcommand>
Option Description
--project The project slug to run against. Defaults to the current directory.
--json Output in JSON format.

Show the current gateway configuration status — the nginx process state, the config paths, and every running service routed through the gateway across all projects:

Terminal window
denvig gateway status

status 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.

Reconcile launchctl with denvig’s recorded state (~/.denvig/state.json) and rebuild every nginx config from the current service definitions:

Terminal window
denvig gateway configure

Run this after editing service http settings in your config, or any time the gateway and your running services drift out of sync.

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:

Terminal window
cat ~/.denvig/nginx.conf

The 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.

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: true

When 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.