CLI Reference
Basic usage
Just run the command - no arguments needed:
npx termbridgeThis starts everything: local server, tmux session, and the default Cloudflare tunnel.
Running termbridge without a subcommand is equivalent to termbridge start.
You can also run termbridge start explicitly with all flags:
termbridge start --port 8080 --proxy 5173 --session dev --kill-on-exit --no-qr --tunnel cloudflareFlags
| Flag | What it does | Default |
|---|---|---|
--port <port> | Use a specific port instead of a random one | Random |
--proxy <port> | Proxy a local dev server (enables Terminal/Preview views) | - |
--session <name> | Name your tmux session | Auto-generated |
--kill-on-exit | Clean up tmux sessions when Termbridge exits | Off |
--no-qr | Don't print the QR code (useful for scripts) | Off |
--no-tunnel | Disable the tunnel (requires --public-url) | Off |
--public-url <url> | Public URL when tunnel is disabled | - |
--tunnel cloudflare | Tunnel provider (cloudflare or none) | cloudflare |
--backend <backend> | Terminal backend (tmux or sandbox-daytona) | tmux |
--tunnel-token <token> | Use a named Cloudflare Tunnel token (requires --port) | - |
--tunnel-url <url> | Public URL for the named tunnel (required with --tunnel-token) | - |
--sandbox-daytona-repo <url> | Repo URL for Daytona sandbox | - |
--sandbox-daytona-branch <branch> | Branch for Daytona sandbox | - |
--sandbox-daytona-path <path> | Repo path in the sandbox | - |
--sandbox-daytona-name <name> | Sandbox name | - |
--sandbox-daytona-preview-port <port> | Preview port in the sandbox | - |
--sandbox-daytona-public | Create a public sandbox | Off |
--sandbox-daytona-direct | Run the server inside the Daytona sandbox (no tunnel) | Off |
Examples
Attach to an existing tmux session
If you already have a tmux session running:
termbridge --session my-sessionFixed port and custom session
termbridge --port 8080 --session codexClean exit (no leftover sessions)
termbridge --kill-on-exitScripting (no QR output)
termbridge --no-qrProxy a Vite dev server
# Start your Vite app first
cd my-app && npm run dev # runs on port 5173
# Then start Termbridge with proxy
termbridge --proxy 5173Use the Views button to switch between Terminal and Preview. Preview loads your app through the proxy with HMR support.
Named Cloudflare tunnel (token-based)
If you have a Cloudflare account and want to avoid trycloudflare rate limits:
termbridge --port 8080 --tunnel-token <TOKEN> --tunnel-url https://term.example.comDisable the tunnel (bring your own public URL)
termbridge --no-tunnel --public-url https://example.comEnvironment variables
Core settings
| Variable | What it does |
|---|---|
TERMBRIDGE_SESSIONS=2 | Create multiple tmux sessions on startup |
TERMBRIDGE_PUBLIC_URL=https://example.com | Public URL when tunnel is disabled |
TERMBRIDGE_TUNNEL=none | Disable the tunnel |
TERMBRIDGE_TUNNEL_TOKEN=<token> | Named tunnel token (requires TERMBRIDGE_TUNNEL_URL) |
TERMBRIDGE_TUNNEL_URL=https://term.example.com | Public URL for the named tunnel |
Development
| Variable | What it does |
|---|---|
TERMBRIDGE_INSECURE_COOKIE=1 | Allow HTTP cookies (local dev only) |
TERMBRIDGE_PROXY_PORT=5173 | Proxy port for dev:beam:proxy script |
TERMBRIDGE_DEV_UI=http://127.0.0.1:5000 | Override Vite dev UI URL |
TERMBRIDGE_DEV_PORT=3000 | Override Termbridge server port in dev |
Sandbox (Daytona)
| Variable | What it does |
|---|---|
TERMBRIDGE_BACKEND=sandbox-daytona | Use the Daytona sandbox backend |
TERMBRIDGE_SANDBOX_DIRECT=true | Run Termbridge inside the sandbox |
TERMBRIDGE_SANDBOX_SERVER_PORT=8080 | Port for the sandboxed server |
TERMBRIDGE_SANDBOX_AGENTS=claude-code,codex | Auto-install + sync auth for agents |
TERMBRIDGE_SANDBOX_AGENT_ENV=... | Extra env vars to forward |
TERMBRIDGE_SANDBOX_AGENT_AUTH_PATHS=... | Local auth files to sync |
For full Daytona configuration, see the Daytona guide.
Stopping Termbridge
Press Ctrl+C in the terminal where Termbridge is running. This:
- Closes the tunnel (if enabled)
- Stops the local server
- Keeps tmux sessions alive (unless you used
--kill-on-exit)
Your tmux sessions persist by default, so you can reconnect later.