Skip to main content
T3 Code can be configured using environment variables. These are particularly useful for:
  • Docker deployments
  • CI/CD pipelines
  • System-wide configuration
  • Desktop app internal configuration
CLI flags take precedence over environment variables. See Server Options for CLI flag documentation.

Server Configuration

T3CODE_MODE

T3CODE_MODE
'web' | 'desktop'
default:"web"
Sets the runtime mode.
  • web: Network mode with dynamic port allocation
  • desktop: Secure loopback mode for desktop app

T3CODE_PORT

T3CODE_PORT
number
default:"3773"
Port number for the HTTP/WebSocket server (1-65535).

T3CODE_HOST

T3CODE_HOST
string
default:"undefined | 127.0.0.1 (desktop mode)"
Network interface or IP address to bind to.Examples:
  • 127.0.0.1 - Local connections only
  • 0.0.0.0 - All IPv4 interfaces
  • :: - All IPv6 interfaces
  • Specific IP (e.g., 192.168.1.100)

T3CODE_STATE_DIR

T3CODE_STATE_DIR
string
default:"~/.t3/userdata"
Directory for storing state, database, and configuration files.

T3CODE_NO_BROWSER

T3CODE_NO_BROWSER
boolean
default:"false | true (desktop mode)"
Disable automatic browser opening on startup.

T3CODE_AUTH_TOKEN

T3CODE_AUTH_TOKEN
string
default:"undefined"
Authentication token for WebSocket connections.
Never commit auth tokens to version control. Use secrets management for production deployments.

T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD

T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD
boolean
default:"true (web) | false (desktop)"
Automatically create a project for the current working directory on startup.

T3CODE_LOG_WS_EVENTS

T3CODE_LOG_WS_EVENTS
boolean
default:"false | true (if VITE_DEV_SERVER_URL set)"
Enable verbose logging for WebSocket events.

Development Variables

VITE_DEV_SERVER_URL

VITE_DEV_SERVER_URL
URL
default:"undefined"
Development server URL for proxying to Vite dev server.Used during T3 Code development to enable hot module replacement. Not needed for normal usage.

T3CODE_DEV_INSTANCE

T3CODE_DEV_INSTANCE
string
default:"undefined"
Instance identifier for development mode.When set, automatically shifts all ports by a deterministic offset based on the instance name. This allows running multiple development instances without port conflicts.
T3CODE_DEV_INSTANCE is used by T3 Code’s development scripts. It hashes the instance name to generate a port offset.

T3CODE_PORT_OFFSET

T3CODE_PORT_OFFSET
number
default:"0"
Numeric port offset for development mode.Provides manual control over port shifting instead of using the hashed offset from T3CODE_DEV_INSTANCE.

Desktop App Variables

These variables are used internally by the desktop app and typically don’t need manual configuration.

T3CODE_DESKTOP_WS_URL

T3CODE_DESKTOP_WS_URL
URL
default:"undefined"
WebSocket URL for desktop app to connect to the backend server.Automatically set by the desktop app during startup.

T3CODE_DESKTOP_UPDATE_GITHUB_TOKEN

T3CODE_DESKTOP_UPDATE_GITHUB_TOKEN
string
default:"undefined"
GitHub token for accessing update releases.Used for accessing updates from private repositories during development.

T3CODE_DISABLE_AUTO_UPDATE

T3CODE_DISABLE_AUTO_UPDATE
'1' | undefined
default:"undefined"
Disable automatic updates in the desktop app.Set to 1 to disable auto-updates.

T3CODE_COMMIT_HASH

T3CODE_COMMIT_HASH
string
default:"undefined"
Git commit hash for version tracking.Automatically set during build. Used by the updater to determine the current version.

Docker Example

Configuration via environment variables is ideal for containerized deployments:
docker-compose.yml

CI/CD Example

.github/workflows/test.yml

Systemd Service Example

/etc/systemd/system/t3code.service

Security Best Practices

  • Use strong, randomly generated tokens
  • Store tokens in secrets management systems
  • Rotate tokens periodically
  • Never commit tokens to version control
  • Use different tokens for different environments
  • Use 127.0.0.1 for local-only access
  • Use 0.0.0.0 with authentication for remote access
  • Consider using a reverse proxy (nginx, Caddy) with HTTPS
  • Use firewall rules to restrict access
  • Set appropriate filesystem permissions
  • Keep state directory outside web root
  • Back up state directory regularly
  • Use separate state directories for different environments

Troubleshooting

Port Already in Use

Permission Denied for State Directory

Cannot Connect Remotely

Server Options

CLI flags and detailed configuration

Keybindings

Customize keyboard shortcuts