Skip to main content
T3 Code server accepts configuration through CLI flags and environment variables. CLI flags take precedence over environment variables.

Starting the Server

CLI Flags

Runtime Mode

--mode
'web' | 'desktop'
default:"web"
Runtime mode for the server.
  • web: Allows dynamic port allocation and network binding (default)
  • desktop: Uses loopback defaults (127.0.0.1) for security
Environment variable: T3CODE_MODE

Network Configuration

--port
number
default:"3773"
Port for the HTTP/WebSocket server. Must be between 1 and 65535.In web mode, if the port is unavailable, the server will automatically find an available port starting from the default.Environment variable: T3CODE_PORT
--host
string
Host or network interface to bind the server to.Common values:
  • 127.0.0.1 - Loopback only (local connections)
  • 0.0.0.0 - All IPv4 interfaces
  • :: - All IPv6 interfaces
  • Specific IP address (e.g., Tailnet IP)
Environment variable: T3CODE_HOST

State and Storage

--state-dir
string
default:"~/.t3/userdata"
Directory path for server state, database, and configuration files.The state directory contains:
  • SQLite database
  • Keybindings configuration
  • Session data
  • Logs
Environment variable: T3CODE_STATE_DIR

Browser Control

--no-browser
boolean
default:"false (true in desktop mode)"
Disable automatic browser opening on server startup.By default, the server opens your default browser when starting in web mode. Desktop mode automatically sets this to true.Environment variable: T3CODE_NO_BROWSER

Authentication

--auth-token
string
default:"undefined"
Authentication token required for WebSocket connections.When set, clients must provide this token to establish WebSocket connections. Useful for securing remote access.Alias: --tokenEnvironment variable: T3CODE_AUTH_TOKEN
Keep your auth token secret. Anyone with the token can connect to your T3 Code server.

Project Management

--auto-bootstrap-project-from-cwd
boolean
default:"true (web mode) | false (desktop mode)"
Automatically create a project for the current working directory on startup if one doesn’t exist.When enabled, T3 Code will create a project entry for the directory where you run the server.Environment variable: T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD

Development Options

--dev-url
URL
default:"undefined"
Development web server URL to proxy or redirect to.Used during development to connect to a Vite dev server instead of serving static files. Enables hot module replacement and fast refresh.Environment variable: VITE_DEV_SERVER_URL
The --dev-url flag is primarily for T3 Code development. Most users won’t need this.
--log-websocket-events
boolean
default:"false (true if dev-url is set)"
Emit server-side logs for outbound WebSocket push traffic.Useful for debugging WebSocket communication issues. Automatically enabled when using --dev-url.Alias: --log-ws-eventsEnvironment variable: T3CODE_LOG_WS_EVENTS

Configuration Precedence

Configuration is resolved in the following order (highest to lowest priority):
  1. CLI flags (e.g., --port 8080)
  2. Environment variables (e.g., T3CODE_PORT=8080)
  3. Default values

Default Values

Common Configurations

Local Development

Remote Access

Multiple Instances

CI/CD Environment

Desktop App

The desktop app automatically configures:
  • --mode desktop
  • --no-browser
  • --host 127.0.0.1
  • --auth-token (automatically generated)
You don’t need to set these manually when using the desktop app.

Environment Variables

Complete list of environment variables

Keybindings

Customize keyboard shortcuts