CLI Reference
Domain Management
Commands for adding, removing, and listing local domain mappings.
Domain Management
localdns add
Add a new local domain mapping.
localdns add <domain> [options]Arguments
| Argument | Required | Description |
|---|---|---|
domain | Yes | Local domain name (must end with .local) |
Options
| Option | Description |
|---|---|
-c, --cmd <command> | Command to run the app (e.g. "npm start") |
-p, --port <port> | Fixed port number (default: auto-assign 7100-7899) |
-u, --url <url> | Proxy to a remote URL instead of running a local command |
--env <vars> | Environment variables, comma-separated KEY=value pairs |
--startup <policy> | Startup policy: always | lazy | manual | on-demand |
--service-type <type> | Service type: app | api | database | cache | queue | worker | proxy | monitoring | other |
--restart <policy> | Restart policy: always | on-failure | never |
--alias <aliases> | Comma-separated alias domains |
--mode <mode> | Run mode: dev | production |
--dev-cmd <command> | Development mode command |
--prod-cmd <command> | Production mode start command |
--build-cmd <command> | Production mode build command |
--idle-timeout <seconds> | Idle timeout before dormancy (default: 300) |
--cwd <directory> | Working directory for the process |
Examples
localdns add myapp.local --cmd "npm start"
localdns add api.local --cmd "node server.js" --port 8080
localdns add app.local --cmd "npm start" --env "NODE_ENV=dev,API_KEY=secret"
localdns add staging.local --url "https://staging.myapp.com"
localdns add dashboard.local --cmd "pnpm dev" --startup lazy --alias dash.locallocaldns remove
Remove a domain mapping. Stops the process if running, removes from registry and /etc/hosts.
localdns remove [domain] [options]Aliases: rm
| Option | Description |
|---|---|
-f, --force | Skip confirmation prompt |
localdns remove myapp.local
localdns rm myapp.local --forcelocaldns list
List all registered domains with status, port, and command.
localdns list [options]Aliases: ls
| Option | Description |
|---|---|
--json | Output as JSON (for piping to other tools or AI agents) |
localdns list
localdns ls --jsonlocaldns open
Open a project in editor or browser. Searches indexed projects with fuzzy matching.
localdns open [query] [options]| Option | Description |
|---|---|
-e, --editor <editor> | Editor command (default: auto-detect) |
--register | Register the project with LocalDNS after opening |
localdns open myapp
localdns open myapp --register