npm.io
1.9.1 • Published yesterdayCLI

localhostforonline

Licence
MIT
Version
1.9.1
Deps
0
Size
61.7 MB
Vulns
0
Weekly
0
Install scriptsThis package runs scripts during installation (preinstall/install/postinstall)

localhostforonline

npm version

Expose your local development server to the internet in seconds. No configuration, no DNS setup, no TLS certificates — just a single command.

npx localhostforonline --port 3000

Quick start

# Expose a local HTTP server on port 3000
npx localhostforonline --port 3000

# Output:
# Tunnel created!
# ✓ Your URL: https://a1b2c3d4-e5f6-7890-abcd-ef1234567890.localhostfor.online
# ✓ Local:    localhost:3000
# ✓ Logs:     https://localhostfor.online/dashboard?session=a1b2c3d4-e5f6-7890-abcd-ef1234567890

Open the generated URL in your browser — your local app is now online.


How it works

Visitor → localhostfor.online (edge proxy) → secure tunnel → your machine (localhost:3000)
  1. You start a tunnel from your machine to localhostfor.online
  2. The platform generates a unique public URL: https://<uuid>.localhostfor.online
  3. Anyone with that URL can access your local server through the tunnel
  4. All requests are logged in real time to your dashboard

Features

Secure tunnels

All traffic is encrypted end-to-end via TLS. Your local server is never directly exposed to the public internet. HTTPS by default.

Live dashboard

Monitor every request in real time:

  • Stats: Total requests, bandwidth, average latency, tunnel status
  • Request log: Method, URL, status code, size, duration — for every request
  • Request details: Expand any request to see full headers and body (request + response)
  • Tunnel history: All tunnels you've created, with quick access to their logs

Access the dashboard

WebSocket support

Full-duplex communication, auto-detected — no extra flags needed. When the server detects an Upgrade: websocket header, it automatically upgrades to WebSocket forwarding.

Custom subdomains

Reserve a custom subdomain for your tunnel to get a predictable, shareable URL:

npx localhostforonline --port 3000 --subdomain my-app
# → https://my-app.localhostfor.online
TCP forwarding

Raw TCP support for any protocol — SSH, databases, SMTP, and more:

npx localhostforonline --port 22 --tcp
API keys & account

Link your tunnels to an account for permanent history and management:

  1. Log in at https://localhostfor.online/login with your Google account
  2. Run localhostforonline login in your terminal
  3. Start a tunnel:
    npx localhostforonline --port 3000
Anonymous access

Even without an account, anyone with a tunnel URL can view its request history:

https://localhostfor.online/dashboard?session=<uuid>

CLI commands

Root command — Start a tunnel
localhostforonline [flags]

Exposes a local port to the internet. Supports HTTP, WebSocket, and TCP.

login — Authenticate the CLI
localhostforonline login

Opens a browser window for Google OAuth and persists your API key to ~/.localhostfor/config.yaml.

Use localhostforonline login --no-browser to print the authentication URL instead of opening a browser.

whoami — Show current user
localhostforonline whoami

CLI flags

Flag Type Description
--port int Local port to expose (e.g. 3000)
--url string Full local URL (e.g. http://localhost:8080)
--subdomain string Reserve a custom subdomain for your tunnel (requires login)
--host-header string Rewrite Host header (rewrite = set to localhost:<port>)
--tcp bool Enable raw TCP forwarding (allocates a dedicated port)
--dev bool Force dev mode (auto-detected for Next.js)

Either --port or --url is required, but not both.


Output format

Tunnel created!
✓ Your URL: https://a1b2c3d4-e5f6-7890-abcd-ef1234567890.localhostfor.online
✓ Local:    localhost:3000
✓ Logs:     https://localhostfor.online/dashboard?session=a1b2c3d4-e5f6-7890-abcd-ef1234567890
✓ TCP Port: 20000               (only when using --tcp)
Press Ctrl+C to stop

When using a custom subdomain, the logs URL becomes:

✓ Logs: https://localhostfor.online/subdomains/my-app/logs

Protocol support

Protocol How Example
HTTP (default) All methods: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS, CONNECT npx localhostforonline --port 3000
WebSocket Auto-detected via Upgrade: websocket header Same command — no extra flags
TCP Dedicated TCP port for raw byte relay npx localhostforonline --port 22 --tcp

TCP forwarding

When using --tcp, the server allocates a dedicated TCP port. Connect by sending the 36-byte project UUID (without the project- prefix) first, then your raw data:

# Expose SSH
npx localhostforonline --port 22 --tcp

# Connect from another terminal
printf 'a1b2c3d4-e5f6-7890-abcd-ef1234567890' | nc localhostfor.online 20000

Installation

Via npx (no install required)
npx localhostforonline --port 3000
Via global npm
npm install -g localhostforonline
localhostforonline --port 3000

Platform

Website

https://localhostfor.online

  • / — Landing page with documentation
  • /onboarding — Get started and create an account
  • /dashboard — Tunnel list and request history
  • /dashboard?session=<uuid> — Request log for a specific tunnel
  • /login — Sign in with Google to get an API key
  • /account — Your account details
Need help?

For consultation or help becoming a tech provider, contact us on WhatsApp: +55 11 96743-5133

Keywords