Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

REMOTE.md

65 lines2.4 KB

1# Remote Access Setup
2​
3Use this when you want to open T3 Code from another device (phone, tablet, another laptop).
4​
5## CLI ↔ Env option map
6​
7The T3 Code CLI accepts the following configuration options, available either as CLI flags or environment variables:
8​
9| CLI flag | Env var | Notes |
10| ----------------------- | --------------------- | ---------------------------------- |
11| `--mode <web\|desktop>` | `T3CODE_MODE` | Runtime mode. |
12| `--port <number>` | `T3CODE_PORT` | HTTP/WebSocket port. |
13| `--host <address>` | `T3CODE_HOST` | Bind interface/address. |
14| `--state-dir <path>` | `T3CODE_STATE_DIR` | State directory. |
15| `--dev-url <url>` | `VITE_DEV_SERVER_URL` | Dev web URL redirect/proxy target. |
16| `--no-browser` | `T3CODE_NO_BROWSER` | Disable auto-open browser. |
17| `--auth-token <token>` | `T3CODE_AUTH_TOKEN` | WebSocket auth token. |
18​
19> TIP: Use the `--help` flag to see all available options and their descriptions.
20​
21## Security First
22​
23- Always set `--auth-token` before exposing the server outside localhost.
24- Treat the token like a password.
25- Prefer binding to trusted interfaces (LAN IP or Tailnet IP) instead of opening all interfaces unless needed.
26​
27## 1) Build + run server for remote access
28​
29Remote access should use the built web app (not local Vite redirect mode).
30​
31```bash
32bun run build
33TOKEN="$(openssl rand -hex 24)"
34bun run --cwd apps/server start -- --host 0.0.0.0 --port 3773 --auth-token "$TOKEN" --no-browser
35```
36​
37Then open on your phone:
38​
39`http://<your-machine-ip>:3773`
40​
41Example:
42​
43`http://192.168.1.42:3773`
44​
45Notes:
46​
47- `--host 0.0.0.0` listens on all IPv4 interfaces.
48- `--no-browser` prevents local auto-open, which is usually better for headless/remote sessions.
49- Ensure your OS firewall allows inbound TCP on the selected port.
50​
51## 2) Tailnet / Tailscale access
52​
53If you use Tailscale, you can bind directly to your Tailnet address.
54​
55```bash
56TAILNET_IP="$(tailscale ip -4)"
57TOKEN="$(openssl rand -hex 24)"
58bun run --cwd apps/server start -- --host "$(tailscale ip -4)" --port 3773 --auth-token "$TOKEN" --no-browser
59```
60​
61Open from any device in your tailnet:
62​
63`http://<tailnet-ip>:3773`
64​
65You can also bind `--host 0.0.0.0` and connect through the Tailnet IP, but binding directly to the Tailnet IP limits exposure.