Skip to content

Environment Variables

Tide Commander is configured via environment variables. Create a .env file at the repo root (copy .env.example as a starting point) or export variables in your shell before running tide-commander start.

Server variables

VariableDefaultDescription
PORT5174Backend HTTP/WebSocket server port
HOST127.0.0.1Backend bind address. 127.0.0.1 means localhost-only.
VITE_PORT5173Vite dev server port (development mode only)
TIDE_SERVERhttp://localhost:$PORTServer URL used by agent hooks for internal API calls
LISTEN_ALL_INTERFACES(unset)Set to 1 to bind on 0.0.0.0 — makes Tide Commander reachable on your LAN

Authentication

VariableDefaultDescription
AUTH_TOKEN(unset)Static token required in the X-Auth-Token header for all HTTP and WebSocket connections. Generate a strong random value: openssl rand -hex 32

When AUTH_TOKEN is set, every API request and WebSocket upgrade must include the header:

Terminal window
curl -H "X-Auth-Token: YOUR_TOKEN" http://localhost:5174/api/agents

HTTPS / TLS

VariableDefaultDescription
HTTPS(unset)Set to 1 to serve the backend over HTTPS and WSS
TLS_KEY_PATH~/.tide-commander/certs/localhost-key.pemPrivate key for the backend TLS certificate
TLS_CERT_PATH~/.tide-commander/certs/localhost.pemCertificate for the backend TLS
DEV_HTTPS(unset)Set to 1 to run the Vite dev server over HTTPS
DEV_TLS_KEY_PATH(unset)Private key for the Vite dev HTTPS server
DEV_TLS_CERT_PATH(unset)Certificate for the Vite dev HTTPS server

See HTTPS & Auth for step-by-step setup using mkcert or your own CA.

Using a .env file

Create .env at the project root:

.env
PORT=5174
HOST=0.0.0.0
LISTEN_ALL_INTERFACES=1
AUTH_TOKEN=your-secret-token-here
HTTPS=1
TLS_KEY_PATH=~/.tide-commander/certs/localhost-key.pem
TLS_CERT_PATH=~/.tide-commander/certs/localhost.pem

Tide Commander loads this file automatically on startup. When running via bunx, pass variables inline:

Terminal window
PORT=8080 AUTH_TOKEN=mytoken bunx tide-commander

Or export them first:

Terminal window
export PORT=8080
export AUTH_TOKEN=mytoken
tide-commander start

CLI flags vs environment variables

Most environment variables have equivalent CLI flags for one-off usage without a .env file:

Terminal window
tide-commander --port 8080 --host 0.0.0.0
tide-commander --listen-all --port 8080
tide-commander --https --tls-key ./certs/key.pem --tls-cert ./certs/cert.pem
tide-commander --auth-token mytoken
tide-commander --generate-auth-token # prints a new token and exits

CLI flags take precedence over environment variables when both are set.