Portless CLI
Overview
Portless maps local apps to stable named URLs like https://myapp.localhost. It removes manual port juggling and reduces cross-app cookie/origin clashes.
Source of truth: vercel-labs/portless GitHub README and portless --help.
When to Use
Use when you need:
- Stable local hostnames instead of
localhost:NNNN - Monorepo app naming/worktree-safe URLs
- HTTPS local dev with trusted local CA
- LAN or Tailscale sharing of local apps
Do not use for public production ingress.
Quick Start
bashnpm install -g portless portless run next dev # -> https://<project>.localhost
Explicit name:
bashportless myapp next dev # -> https://myapp.localhost
Core Commands
portless/portless run— run package dev script through proxyportless run <cmd>— run command through proxyportless <name> <cmd>— explicit app nameportless proxy start|stopportless listportless get <name>portless trustportless hosts sync|cleanportless service install|status|uninstallportless clean
Monorepo Pattern
- Put
portless.jsonin repo root. - Optional
appsmap for naming overrides. - From monorepo root,
portlessstarts all workspace packages with adevscript.
Example portless.json:
json{ "apps": { "apps/web": { "name": "web" }, "apps/api": { "name": "api" } } }
Critical Pitfalls
- Wrong syntax hallucination: No
--from/--to/--pathflow. Userun,<name> <cmd>,alias,get,list. - Wrong package name: CLI install is
portless, notvercel-labs/portless. - Proxy loops between apps: If frontend proxies to another Portless host, set
changeOrigin: true. - Safari DNS issues: run
portless hosts sync. - Reserved names:
run|get|alias|hosts|list|trust|clean|prune|proxy|servicecannot be app names unless forced with--name. - Invalid command family: MUST NOT use
portless http ...(not a valid subcommand in this CLI). - Invalid
appsschema: Inportless.json, app entries SHOULD be objects (e.g.{ "name": "web" }), not ad-hoc undocumented shapes.
API Proxy Example (Vite)
tsserver: { proxy: { '/api': { target: 'https://api.myapp.localhost', changeOrigin: true, ws: true, }, }, }
LAN / Tailscale
- LAN mode:
portless proxy start --lan - Tailscale share:
portless myapp --tailscale next dev - Public Funnel:
portless myapp --funnel next dev
Validation Checklist
portless --helpshows command used exists.- URL resolves at
https://<name>.localhost. portless listshows active route.- Cross-app proxy does not loop (no 508 Loop Detected).
- Output MUST NOT include
portless http,--from,--to, or--path.

