Daytona
Daytona lets Termbridge run your terminal and preview in a cloud sandbox. Use this when you want a reproducible environment, a cloud preview, or to keep your laptop idle.
Requirements
- A Daytona API key
- A repository URL the sandbox can clone
- Git credentials if the repo is private
Quick start
Set the backend to Daytona and provide the repo configuration:
export TERMBRIDGE_BACKEND=sandbox-daytona
export TERMBRIDGE_DAYTONA_API_KEY=your_key
export TERMBRIDGE_DAYTONA_API_URL=https://app.daytona.io/api
export TERMBRIDGE_SANDBOX_REPO=https://github.com/inline0/termbridge-test-app.git
export TERMBRIDGE_SANDBOX_BRANCH=main
export TERMBRIDGE_SANDBOX_PATH=termbridge-test-app
export TERMBRIDGE_SANDBOX_NAME=termbridge-sandbox
export TERMBRIDGE_SANDBOX_PUBLIC=true
export TERMBRIDGE_SANDBOX_PREVIEW_PORT=5173
export TERMBRIDGE_SANDBOX_DELETE_ON_EXIT=trueThen run Termbridge as usual:
npx termbridgeDirect sandbox mode (no tunnel)
Direct mode runs the Termbridge server inside the sandbox and skips Cloudflare entirely. The share URL is the Daytona preview link to the sandboxed server.
export TERMBRIDGE_BACKEND=sandbox-daytona
export TERMBRIDGE_SANDBOX_DIRECT=true
export TERMBRIDGE_SANDBOX_SERVER_PORT=8080You can still enable preview by setting TERMBRIDGE_SANDBOX_PREVIEW_PORT; in direct mode it is forwarded as the server --proxy port.
Repository cloning
Termbridge will create a sandbox and clone your repo into the sandbox working directory.
Use these settings:
| Variable | Purpose |
|---|---|
TERMBRIDGE_SANDBOX_REPO | Repo URL to clone (required) |
TERMBRIDGE_SANDBOX_BRANCH | Branch to check out (optional) |
TERMBRIDGE_SANDBOX_PATH | Path for the repo in the sandbox (optional) |
TERMBRIDGE_SANDBOX_NAME | Sandbox name (optional) |
If TERMBRIDGE_SANDBOX_PATH is not set, Termbridge derives it from the repo name.
Private repositories
Provide git credentials when cloning private repos:
export TERMBRIDGE_SANDBOX_GIT_USERNAME=your_github_username
export TERMBRIDGE_SANDBOX_GIT_TOKEN=your_github_tokenTERMBRIDGE_SANDBOX_GIT_PASSWORD is also supported and overrides the token if set.
Coding agents
Termbridge can install coding agents inside the sandbox and sync your local auth so they are ready immediately.
See the Coding agents guide for the full setup, automatic mode, and security details.
Preview mode
To show the preview view, set TERMBRIDGE_SANDBOX_PREVIEW_PORT to the port your dev server uses inside the sandbox.
For Vite, make sure you bind to all interfaces:
npm run dev -- --host 0.0.0.0 --port 5173Termbridge fetches the Daytona preview link and proxies it through the Termbridge server so the preview loads inside the UI.
Public vs private sandboxes
| Variable | What it does |
|---|---|
TERMBRIDGE_SANDBOX_PUBLIC=true | Creates a public sandbox |
TERMBRIDGE_SANDBOX_PUBLIC=false | Creates a private sandbox |
For private sandboxes, Termbridge forwards the preview token automatically when proxying the preview.
Cleanup and lifecycle
To delete sandboxes when Termbridge exits:
export TERMBRIDGE_SANDBOX_DELETE_ON_EXIT=trueFor short-lived or test sandboxes, use a prefix:
export TERMBRIDGE_SANDBOX_NAME=termbridge-test-$(date +%s)
export TERMBRIDGE_SANDBOX_DELETE_ON_EXIT=trueThis keeps sandbox usage under control and avoids disk quota issues.
CLI flags
You can also configure Daytona via flags:
| Flag | Purpose |
|---|---|
--backend sandbox-daytona | Use the Daytona backend |
--sandbox-daytona-repo <url> | Repo URL |
--sandbox-daytona-branch <branch> | Branch |
--sandbox-daytona-path <path> | Repo path in sandbox |
--sandbox-daytona-name <name> | Sandbox name |
--sandbox-daytona-preview-port <port> | Preview port |
--sandbox-daytona-public | Create a public sandbox |
--sandbox-daytona-direct | Run the server inside the sandbox (no tunnel) |
Troubleshooting
Preview view is blank
- Ensure the dev server is running inside the sandbox.
- Use
--host 0.0.0.0so the preview port is reachable. - Confirm
TERMBRIDGE_SANDBOX_PREVIEW_PORTmatches the dev server port.
Sandbox creation fails with quota errors
- Delete old sandboxes in the Daytona dashboard.
- Use
TERMBRIDGE_SANDBOX_DELETE_ON_EXIT=truefor short-lived sessions.
Repo clone fails
- Double-check repo URL, branch, and credentials.
- Ensure the Git token has repo read access.