Overview
Run your dev server through the Portless proxy with an explicit name. This gives you full control over the hostname.Syntax
Parameters
<name>
The hostname for your app. Can include subdomains separated by dots.
- Simple name:
myapp->http://myapp.localhost:1355 - Subdomain:
api.myapp->http://api.myapp.localhost:1355 - Multi-level:
docs.api.myapp->http://docs.api.myapp.localhost:1355
<command...>
The command to run (your dev server start command).
Options
--force
Override an existing route registered by another process.
--app-port <number>
Use a fixed port for the app instead of automatic port assignment. Must be between 1 and 65535.
--
Stop flag parsing. Everything after -- is passed directly to your command.
Examples
Basic Usage
Monorepo Services
With Fixed Port
Override Existing Route
Flags After Name
You can place--force and --app-port before or after the name:
Reserved Names
The following names are reserved for Portless commands and cannot be used directly:rungetaliashostslisttrustproxy
- Use
portless run(it will infer from your project) - Use the
--nameflag:portless --name run next dev
Environment Variables
The following environment variables are injected into your command:PORT- Ephemeral port the app should listen on (e.g. 4567)HOST- Always set to127.0.0.1PORTLESS_URL- Public URL of your app (e.g.http://myapp.localhost:1355)__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTS- Set to.localhostfor Vite compatibility
Wildcard Subdomains
Any subdomain of a registered route routes automatically without extra configuration:Proxy Auto-Start
If the proxy is not running, the command will automatically start it:- Privileged port (< 1024): Prompts for sudo permission
- Non-privileged port (default 1355): Starts silently without sudo
skip when prompted.
Skip Portless
To run your command directly without the proxy:Framework Support
Most frameworks respect thePORT environment variable. For frameworks that don’t (Vite, Astro, React Router, Angular, Expo, React Native), Portless automatically injects the correct --port and --host flags.
Exit Codes
- 0 - Success
- 1 - Error (no command provided, route conflict, invalid arguments)
- Exit code of child process - Propagated from your dev server