Starting the Server
CLI Flags
Runtime Mode
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
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_PORTHost 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
Directory path for server state, database, and configuration files.The state directory contains:
- SQLite database
- Keybindings configuration
- Session data
- Logs
T3CODE_STATE_DIRBrowser Control
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
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
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
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.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
| Configuration | Default Value | Desktop Mode Default |
|---|---|---|
| Mode | web | desktop |
| Port | 3773 | 3773 |
| Host | undefined (all interfaces) | 127.0.0.1 |
| State Directory | ~/.t3/userdata | ~/.t3/userdata |
| No Browser | false | true |
| Auth Token | undefined | undefined |
| Auto Bootstrap | true | false |
| Log WebSocket Events | false | false |
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
