Documentation

Use the CLI to expose local services and the dashboard to monitor and manage them.

Install CLI Dashboard Workflow Reference

1. Install the CLI

The CLI discovers local processes and maintains the tunnel connection.

$ curl -fsSL https://portzero.net/install.sh | sh

This installs devenv (dispatcher) and port-zero (the actual binary). You can also run port zero <cmd>.

From source: clone port-zero and run cargo install --path client/crates/cli (or just install).

2. Log in

CLI

$ port zero login

Opens your browser to complete login via the dashboard. Stores credentials in ~/.devenv/auth.json.

Headless: port zero login --interactive --email you@example.com

Dashboard

Go to app.portzero.cloud and sign in with email (magic code) or GitHub.

The dashboard shows all your active tunnels and account settings.

3. Start a tunnel from the CLI

Tag your service

Set PORT_ZERO on the process (or its parent; children inherit it). The daemon scans running processes for this variable.

$ PORT_ZERO=myapp.alice.tunnel.portzero.cloud npm start
 
# Any stack works
$ PORT_ZERO=api.alice.tunnel.portzero.cloud cargo run

How port detection works: The daemon finds the process (or child process via inherited env) that has PORT_ZERO and is listening on TCP port(s). It reads the listening sockets directly from the OS (via /proc or lsof). By default it forwards the lowest-numbered port bound to all interfaces (0.0.0.0). If the process listens on multiple ports, the chosen one becomes the tunnel target; use care or explicit strategies if you need a specific one.

Avoiding port conflicts entirely: Let the OS assign an ephemeral port by starting your server with PORT=0 (or equivalent for your runtime, e.g. server.listen(0) in Node). The kernel guarantees a free port. The daemon will discover whichever port your process actually bound. This is a major advantage of Port Zero—no more fighting over fixed ports like 3000 or 8080 across projects or team members.

Start the daemon

$ port zero start

The daemon scans every 2 s for processes with `PORT_ZERO`, opens a persistent WebSocket to the edge, and registers the discovered route+port. TLS is automatic.

Check status

$ port zero status

Template variables

Use these in PORT_ZERO for automatic unique names. All tunnels must end with USERNAME.tunnel.portzero.cloud (the label immediately before .tunnel must be your account username):

VariableMeaning
{service}Executable / process name
{project}Git directory name
{branch}Current git branch
{worktree}Worktree or branch
{user}OS user
{machine}Hostname
{uid}Short account ID (guarantees uniqueness)
{username}Your account username (recommended for the namespace segment). Falls back to {uid} then {user}.
PORT_ZERO={project}-{branch}-{username}.tunnel.portzero.cloud npm run dev

Example: myapp-main-alice.tunnel.portzero.cloud

4. The Dashboard

Open app.portzero.cloud after logging in.

Home

Quick stats, active environment count, and install reminder. Lists your running services at a glance.

Tunnels

Live list of routes with status, public URL, local port, request count, bytes transferred, and last-seen time. Auto-refreshes.

Stable subdomains

Your tunnels always live at predictable *.USERNAME.tunnel.portzero.cloud addresses. No custom domains.

Settings

Update display name, view account ID, manage billing and plan, see usage, and sign out everywhere.

Routes you start via the CLI appear automatically in the dashboard (and vice versa — the account is shared).

5. Typical workflow

  1. Install the CLI once on your machine.
  2. Login once (port zero login or dashboard).
  3. Run your service with the PORT_ZERO=... prefix (or export it for a shell session).
  4. port zero start (once per machine, keeps running in background).
  5. Open the HTTPS URL. Watch requests and traffic in the dashboard.
  6. Use port zero status or the Tunnels page to inspect.

CLI reference

Daemon

CommandDescription
port zero startStart discovery daemon + tunnel connection (background)
port zero stopStop the daemon
port zero restartRestart the daemon
port zero statusShow running state, routes, connection health

Authentication

CommandDescription
port zero login [--interactive] [--email E]Authenticate (browser by default)
port zero logoutRemove local credentials
port zero whoamiPrint current user, plan

Environment variables

PORT_ZEROThe only documented variable. Set on your process (or inherited by child) to tag it for discovery. Value is the desired public hostname, which must end with .<your-username>.tunnel.portzero.cloud. Supports the template variables listed above.

Troubleshooting

See the full docs in the repo under docs/ for self-hosting and advanced details.

Open Dashboard View source