Documentation

First `vectron.toml`

Understand the smallest useful Vectron configuration and how paths, ports, and environment variables behave.

Minimal example

[[process]]
name = "web"
command = "npm run dev"

What this does

  • [[process]] declares one supervised process
  • name defines the stable identifier used in status, logs, restart targets, and file names
  • command defines the child process to launch

Defaults involved here

  • global: optional table
  • log_dir: default .vectron/logs
  • port_start: default 5000
  • port_step: default 100
  • shutdown_timeout_secs: default 90
  • instances: default 1
  • log_mode: effective default console
  • log_format: effective default text
  • show_timestamps: effective default true
  • port_env: field default none; effective port variable PORT unless overridden

Path resolution

Paths such as log_dir, working_dir, and env_file are resolved relative to the directory that contains vectron.toml.

This means that moving the config file changes the meaning of those relative paths.

When you need a port

Vectron allocates a port for each process instance. When a process has an allocated port, Vectron exports it as PORT by default.

If your app reads PORT from its environment, the minimal config can stay unchanged:

[[process]]
name = "web"
command = "npm run dev"

Use port_env only when the child process expects another variable name:

[[process]]
name = "web"
command = "npm run dev"
port_env = "APP_PORT"

port_env changes the environment variable name. It does not interpolate values inside command. If a command must expand $PORT directly in its arguments, run it through a shell explicitly.

Process naming

Choose stable names. They appear in:

  • vectron status
  • vectron restart <target>
  • vectron logs --target <target>
  • log file names under .vectron/logs

Next useful additions

After the minimal config, the most common next steps are:

  • add instances = N
  • set group = "name" and optional labels = [...]
  • add [process.env]
  • define readiness with [process.readiness]
  • define log_format = "json" or log_format = "logfmt"

Use the full reference for vectron.toml for exact field behavior and defaults. Use Examples when you want complete patterns that are still short enough to adapt.