Localghost - Friendly local dev domains
Buh. Friendly local dev domains.
Localghost
A tiny Node.js CLI for the local dev flow you already use. Install the dev dependency, run yarn dev, and Localghost gets you to a clean browser-facing .localhost URL.
View on GitHub<br>Install from npm
yarn add -D @hamedb89/localghost<br>yarn dev
localghost<br>local: http://app.localhost/<br>target: http://127.0.0.1:5173/
Contents
Local dev contract<br>ghostTunnel<br>Trust and release
One small contract for local dev
Yarn dev first
Keep the command every teammate already tries first. Localghost fits behind yarn dev and guides the first run when setup is missing.
Clean defaults
Project names come from package.json, port 5173 is the fallback, HTTP is default, dynamic ports are on, and www. aliases are included.
Vite-safe defaults
Set explicit server.allowedHosts entries without opening the broad allowedHosts: true shortcut.
HTTPS when you ask
Keep local HTTP by default. Turn on Caddy HTTPS with https: true or --https, then trust the local CA only when you choose.
Override only when needed
Most repos do not need localghost.config.mjs. Add it only for nonstandard ports, HTTPS, fixed ports, or custom alias behavior.
Plain local state
Generated setup lives under ops/local/, and reset lets you retest the first-run flow without deleting your .localghost contract.
ghostTunnel
Share a localhost route without moving the app.
ghostTunnel is the opt-in production-facing Localghost entrypoint for stable wildcard previews like plan-summer-base-hamed.ghost.socialworkouts.app.
Friendly preview names
Build names from route, project, and owner, then point *.ghost. at the deployed app.
Off by default
Enable it explicitly with ghostTunnel: true or a ghostTunnel.preview object in localghost.config.mjs.
Guardrails included
Requests are checked for host shape, HTTPS, auth, DNS-safe labels, and relay target policy before serving a tunnel surface.
Read the ghostTunnel guide<br>All docs
Built to be boring where it matters
CI before publish
GitHub Actions runs typecheck, build, site build, and npm package dry-run on Node 20 and 22.
Small dependency surface
Runtime dependencies are limited to commander and execa. Vite stays an optional peer for projects that use the plugin.
No surprise installs
No postinstall scripts, hidden Homebrew commands, or full hosts-file rewrites. Localghost changes only its managed block.