Skip to main content

Overview

The T3 Code CLI provides powerful options for running the server with custom configurations. Use it for development, production deployments, remote access, and CI/CD integration.

Basic Usage

Start the server with default settings:
This starts the server on the first available port (starting at 8080) and opens your default browser.

CLI Flags

Mode

Set the runtime mode:
Desktop mode differences:
  • Binds to 127.0.0.1 by default (security)
  • Disables automatic browser opening
  • Uses fixed port (8080)

Port

Specify the HTTP/WebSocket server port:
In web mode, if the port is taken, the server finds the next available port. In desktop mode, it fails if the port is occupied.

Host

Bind to a specific network interface:
Binding to 0.0.0.0 or [::] exposes the server to your network. Use --auth-token for security.

State Directory

Customize where T3 Code stores data:
State directory contains:
  • SQLite database (projects, threads, messages)
  • keybindings.json configuration
  • Checkpoint metadata
  • Session state
Default locations:
  • macOS: ~/Library/Application Support/T3 Code
  • Windows: %APPDATA%\T3 Code
  • Linux: ~/.config/t3-code

Development URL

Proxy to a Vite dev server during development:
Useful when developing the web interface.

Browser Control

Disable automatic browser opening:

Authentication

Require a token for WebSocket connections:
The web interface must provide this token in the WebSocket URL:
Auth tokens are essential when binding to non-localhost interfaces.

Project Bootstrapping

Automatically create a project for the current directory:
The server creates a project named after the directory and starts a thread.

WebSocket Logging

Enable detailed WebSocket event logging:
Useful for debugging connection issues and event flow.

Environment Variables

All flags have environment variable equivalents:
CLI flags override environment variables.

Common Scenarios

Local Development

Remote Access

1

Bind to all interfaces

2

Add authentication

3

Share the URL

Tailscale Setup

Access from any device on your Tailnet:

Production Deployment

Docker Container

Run:

Systemd Service

Enable and start:

Security Best Practices

Always use authentication when exposing the server beyond localhost.

Generate Strong Tokens

Restrict Network Access

Use firewall rules to limit connections:

Use Reverse Proxy

Run behind nginx or Caddy for HTTPS:

Debugging

Verbose Logging

Enable debug logs:

Connection Issues

Test WebSocket connection:

Port Conflicts

Find process using a port:
Kill the conflicting process or choose a different port.

Performance Tuning

State Directory on SSD

Store state on fast storage for better database performance:

Limit Concurrent Sessions

The server handles multiple projects and threads efficiently, but heavy workloads benefit from dedicated resources:
  • Light use (1-2 active threads): 2GB RAM, 2 CPU cores
  • Medium use (3-5 active threads): 4GB RAM, 4 CPU cores
  • Heavy use (6+ active threads): 8GB RAM, 8 CPU cores

Next Steps