Configuration Reference¶
Config File¶
prox looks for prox.yaml in the current directory by default. Use --config to specify a different path.
Minimal Example¶
Full Example¶
api:
port: 5555
host: 127.0.0.1
env_file: .env
processes:
# Simple form - string command
web: npm run dev
worker: python worker.py
# Expanded form - full configuration
api:
cmd: go run ./cmd/server
env:
PORT: "8080"
DEBUG: "true"
env_file: .env.api
healthcheck:
cmd: curl -f http://localhost:8080/health
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
Top-Level Fields¶
| Field | Type | Default | Description |
|---|---|---|---|
api.port |
int | dynamic | HTTP API port (auto-assigned if not specified or port in use) |
api.host |
string | 127.0.0.1 |
API bind address |
env_file |
string | — | Global .env file path, loaded for all processes |
processes |
map | required | Process definitions |
Process Fields¶
Processes can be defined in simple form (string) or expanded form (object).
Simple Form¶
Expanded Form¶
| Field | Type | Default | Description |
|---|---|---|---|
cmd |
string | required | Command to run |
env |
map | — | Environment variables for this process |
env_file |
string | — | Process-specific .env file |
healthcheck |
object | — | Health check configuration |
Health Check Fields¶
| Field | Type | Default | Description |
|---|---|---|---|
cmd |
string | required | Command to run for health check |
interval |
duration | 10s |
Time between health checks |
timeout |
duration | 5s |
Timeout for each check |
retries |
int | 3 |
Consecutive failures before marking unhealthy |
start_period |
duration | 30s |
Grace period after startup before checks begin |
Environment Variable Precedence¶
Environment variables are loaded in this order (later values override earlier):
- System environment
- Global
env_file(if specified) - Process-specific
env_file(if specified) - Process-specific
envmap (if specified)
Duration Format¶
Duration fields accept Go duration strings:
5s- 5 seconds10m- 10 minutes1h30m- 1 hour 30 minutes
Runtime State¶
When prox is running (in either foreground or daemon mode), runtime state is stored in the .prox/ directory within your project:
| File | Description |
|---|---|
.prox/prox.state |
JSON file with port, PID, host, start time, config path |
.prox/prox.pid |
Process ID with file locking to prevent multiple instances |
.prox/prox.log |
Daemon logs (stdout/stderr redirected here in background mode) |
When running in daemon mode (prox up -d), all output that would normally go to stdout/stderr is redirected to .prox/prox.log. This is useful for debugging startup issues or reviewing daemon activity.
State File Format:
{
"pid": 12345,
"port": 5555,
"host": "127.0.0.1",
"started_at": "2024-01-15T10:30:00Z",
"config_file": "prox.yaml"
}
CLI commands automatically discover the API address by reading .prox/prox.state. This enables:
- Running multiple prox instances (different projects) simultaneously
- Dynamic port allocation without port conflicts
- No need to specify
--addrfor local commands
The .prox/ directory is project-local, so add it to your .gitignore:
HTTPS Proxy Configuration¶
prox can act as an HTTPS reverse proxy, providing friendly subdomain URLs for your services.
Proxy Example¶
processes:
frontend: npm run dev
backend: go run ./cmd/server
proxy:
enabled: true
https_port: 6789
domain: local.myapp.dev
services:
app: 3000 # Simple: subdomain → port
api: # Expanded: with options
port: 8000
host: localhost
certs:
dir: ~/.prox/certs
auto_generate: true
With this configuration:
- https://app.local.myapp.dev:6789 → http://localhost:3000
- https://api.local.myapp.dev:6789 → http://localhost:8000
Proxy Fields¶
| Field | Type | Default | Description |
|---|---|---|---|
proxy.enabled |
bool | false |
Enable HTTPS reverse proxy |
proxy.https_port |
int | 6789 |
Port for the HTTPS proxy server |
proxy.domain |
string | required | Base domain for subdomain routing |
Service Fields¶
Services can be defined in simple form (port only) or expanded form (object).
Simple Form¶
Expanded Form¶
| Field | Type | Default | Description |
|---|---|---|---|
port |
int | required | Target port to proxy to |
host |
string | localhost |
Target host to proxy to |
Certificate Fields¶
| Field | Type | Default | Description |
|---|---|---|---|
certs.dir |
string | ~/.prox/certs |
Directory for storing certificates |
certs.auto_generate |
bool | true |
Automatically generate certificates using mkcert |
Prerequisites¶
The proxy requires mkcert for certificate generation:
# macOS
brew install mkcert
# Linux
# See https://github.com/FiloSottile/mkcert#installation
# Install the CA (run once)
mkcert -install
DNS Setup¶
Add entries to /etc/hosts for your subdomains:
Security Note¶
Commands in prox.yaml are executed via shell. Only use configuration files from trusted sources, similar to Makefiles or Procfiles.
When binding to non-localhost interfaces (host: 0.0.0.0), authentication is automatically enabled. A bearer token is generated and stored in ~/.prox/token.