Tunnel Setup
Open your DorkOS instance to your phone or another device with a temporary public URL
Tunnel Setup
Want to check on your agents from your phone, or show a friend what you're building? A tunnel gives your local DorkOS instance a temporary public address, no domain or router setup required.
DorkOS uses ngrok to do this: it's a service that opens a secure path from the internet to something running on your machine. Its free tier covers everything on this page.
Running DorkOS as the Obsidian plugin? The tunnel doesn't apply there, so this UI is hidden. Tunnels only work with the CLI-hosted web app.
Don't worry if it doesn't connect right away: DorkOS keeps running locally either way.
Setup is a one-time job that takes about two minutes. Before your first tunnel, you need two things:
Prerequisites
- An owner login for your DorkOS. A tunnel puts your instance on the public internet, so DorkOS will not start one until a login protects it. If you don't have one yet, starting a tunnel walks you through creating it. See Securing Your Instance.
- A free ngrok account and its auth token. ngrok is the service that carries the tunnel. Grab the token from your ngrok dashboard and paste it into DorkOS. The free tier is enough.
After this one-time setup, remote access really is one tap: scan the QR code and approve from your phone.
Quick Start
Set your ngrok auth token
export NGROK_AUTHTOKEN=your-token-hereOr paste it directly in the app the first time you turn remote access on (see Turning it on in the app below).
Start DorkOS with tunneling enabled
dorkos --tunnelOr use the environment variable:
export TUNNEL_ENABLED=true
dorkosScan the QR code
The tunnel URL appears in your terminal with a QR code. Scan it with your phone's camera and DorkOS opens right there.
Turning it on in the app
You can start and stop remote access from the DorkOS window, without restarting the server:
- Open the Control Center — the ⚡ icon in the top bar
- Flip Remote access on. The first time, this opens a short setup where you paste your ngrok token
- Once it connects, a globe appears in the top bar
The globe is only there while remote access is running. Click it and you get:
- Your address, with a Copy link button
- A QR code to scan with your phone
- A switch to turn remote access off
- Manage…, which opens the full Remote Access window
The full window is where the settings live:
- Custom domain: set a static ngrok domain so your URL stays the same across restarts
- Connection quality indicator: a green, yellow, or red dot showing how fast the tunnel is responding
- Copy URL: copy the tunnel URL to your clipboard
- Copy session link: copy a direct link to the current session
You can do all of it from the keyboard too: press ⌘K and type "remote" to copy the link, show the QR code, or turn remote access on or off.
If you have DorkOS open in several browser tabs, they all update together. Turn the tunnel on or off in one tab, and every other open tab reflects it within about a second.
Custom Domains
By default, your tunnel gets a new random URL every time it starts. ngrok also offers free static domains that stay the same across restarts:
- Go to dashboard.ngrok.com/domains and claim a free domain
- Enter it in the Custom domain field in the Remote Access dialog, or set
TUNNEL_DOMAIN
That way, any QR code or bookmark you saved keeps working after you restart DorkOS.
Security
A tunnel opens your machine to the internet, so DorkOS makes you lock the door first: it requires an owner login before it will start a tunnel. There is no longer a tunnel passcode.
Starting a tunnel with login off routes you into owner-account creation first ("Exposing DorkOS requires a login."). Once the owner account exists and Require login is on, the tunnel starts and remote visitors get the sign-in screen. See Securing Your Instance for the full flow, per-user API keys, and CLI recovery.
You can optionally add ngrok's own HTTP basic auth on top of the login, as a second gate at the edge:
export TUNNEL_AUTH=myuser:mypassword
export NGROK_AUTHTOKEN=your-token-here
dorkos --tunnelWith TUNNEL_AUTH set, anyone accessing the tunnel URL is prompted for those credentials by ngrok
before reaching DorkOS's own sign-in screen.
Troubleshooting
If the tunnel fails to start, check that your NGROK_AUTHTOKEN is valid and that you haven't hit
your ngrok account's limit on simultaneous tunnels (the free tier allows one at a time). DorkOS
keeps running locally either way.
Common issues:
- "Tunnel is already running": the server replies with a 409 status, its polite way of saying "one at a time." Stop the existing tunnel first.
- Auth token not found: make sure
NGROK_AUTHTOKENis exported in your shell, or paste it into the Remote Access dialog. - Custom domain errors: verify your domain is claimed at dashboard.ngrok.com/domains.
- Connection quality red: latency to the tunnel is over 500ms, usually because the nearest ngrok edge server is far from you geographically.
- The tunnel dropped: you get a notification either way, and it tells you which happened. ngrok sometimes loses its session and re-establishes it on its own — DorkOS says "reconnecting", keeps your address, and the globe dims until it is back. If the tunnel closed for good, DorkOS says so and stays off until you turn it back on.
Reference: how the tunnel works under the hood
Everything below is background for the curious. You don't need it to set up or use a tunnel.
Prop
Type
Server starts normally
DorkOS starts the Express server on the configured port (default 4242).
Tunnel connects
Once the server is up, DorkOS loads the ngrok SDK and opens a tunnel to it. That SDK is only loaded when tunneling is actually enabled, so it adds no overhead the rest of the time.
URL is available
The tunnel URL appears in the terminal with a QR code for mobile access. If tunnel creation fails, the server keeps working locally.
Real-time status sync
Tunnel status changes are broadcast to every connected client over DorkOS's shared event stream (GET /api/events), and mirrored across your open browser tabs.
Graceful shutdown
When you stop the server, the tunnel closes automatically before the process exits.
API Endpoints
Control the tunnel programmatically:
# Start the tunnel
curl -X POST http://localhost:4242/api/tunnel/start
# Stop the tunnel
curl -X POST http://localhost:4242/api/tunnel/stop
# On-demand status check
curl http://localhost:4242/api/tunnel/statusHealth Check
When a tunnel is active, the health endpoint includes tunnel status:
curl http://localhost:4242/api/health{
"status": "ok",
"tunnel": {
"enabled": true,
"connected": true,
"url": "https://your-domain.ngrok-free.app"
}
}The tunnel field only appears in the health response when tunneling is enabled. Use GET /api/tunnel/status for full status including connection quality.
CLI QR Code
Opening a tunnel takes a few seconds, so the address arrives after the opening banner rather than inside it — below the startup logs, with a QR code you can scan to open DorkOS on your phone:
DorkOS v0.8.0
Local: http://localhost:4242
Network: http://192.168.1.100:4242
... startup logs ...
Tunnel: https://your-domain.ngrok-free.app
Scan to open on mobile:
[QR Code]Turning Remote Access on later from the app prints the same thing, wherever the terminal has got to.
Development Mode
Contributors working on DorkOS itself can run the tunnel against the dev server:
pnpm --filter=@dorkos/server run dev:tunnel