Starting the Server
CLI Flags
Runtime 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
T3CODE_MODENetwork Configuration
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_PORTstring
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)
T3CODE_HOSTState and Storage
string
default:"~/.t3/userdata"
Directory path for server state, database, and configuration files.The state directory contains:
- SQLite database
- Keybindings configuration
- Session data
- Logs
T3CODE_STATE_DIRBrowser Control
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_BROWSERAuthentication
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_TOKENProject Management
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_CWDDevelopment Options
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_URLThe
--dev-url flag is primarily for T3 Code development. Most users won’t need this.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_EVENTSConfiguration Precedence
Configuration is resolved in the following order (highest to lowest priority):- CLI flags (e.g.,
--port 8080) - Environment variables (e.g.,
T3CODE_PORT=8080) - 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)
Related
Environment Variables
Complete list of environment variables
Keybindings
Customize keyboard shortcuts
