hostc
v1.2.6
Published
Expose a local web service (HTTP + WebSocket) through a hostc tunnel
Downloads
1,456
Maintainers
Readme
hostc
Expose a local web service (HTTP + WebSocket) through a hostc tunnel.
hostc creates a public URL for a local web service, forwards HTTP requests and WebSocket upgrades, keeps the session alive, and reconnects automatically when the control connection drops.
Install
npm install -g hostcOr run it without installing:
npx hostc@latest 3000Requirements
- Node.js 18 or newer
- A local HTTP service or WebSocket-capable web service listening on a port
Usage
hostc <port> [--local-host <host>] [--qr]Examples
hostc 3000
hostc 3000 --local-host 0.0.0.0
hostc 3000 --qrOptions
--local-host <host>: Host of the local service. Defaults tolocalhost.--qr: Show a scannable QR code for the public URL when stdout is a TTY.
Environment Variables
HOSTC_SERVER_URL: Override the Hostc server URL for local development, staging, or self-hosted testing. Defaults tohttps://hostc.dev.HOSTC_DISABLE_UPDATE_CHECK: Set to1to disable the interactive npm update check.HOSTC_DISABLE_ERROR_REPORTING: Set to1to disable sanitized fatal error reports.DO_NOT_TRACK: Set to1to disable sanitized fatal error reports.
Example:
HOSTC_SERVER_URL=http://127.0.0.1:8787 hostc 3000What It Does
- Opens a tunnel to a public
*.hostc.devURL - Proxies HTTP requests to your local service
- Proxies WebSocket upgrades on the same local port
- Refreshes the session automatically
- Reconnects after transient tunnel disconnects
Example Output
$ hostc 3000
Tunnel ready t-a1b2c3d4 -> http://localhost:3000/
Public URL: https://t-a1b2c3d4.hostc.dev$ hostc 3000 --qr
Tunnel ready t-a1b2c3d4 -> http://localhost:3000/
Public URL: https://t-a1b2c3d4.hostc.dev
Scan on your phone:
<QR code shown in interactive terminals>Notes
- Tunnel subdomains are assigned automatically
- Custom subdomains are not currently exposed by the CLI
- QR code output is shown only when
--qris passed and stdout is a TTY - Press
Ctrl+Cto close the tunnel
Links
- Website: https://hostc.dev
- Repository: https://github.com/akazwz/hostc
