How to expose localhost with ngsrv

ngsrv helps developers expose local services, share preview links, test webhooks, and get feedback faster. The shortest path: one CLI command, one public HTTPS URL.

This page answers the question "How do I expose localhost?" end-to-end. It works with any port — localhost:3000 (Next.js, Express, Rails), localhost:4200 (Angular), localhost:5173 (Vite), localhost:8080 (Spring, Go services), and so on.

What "exposing localhost" actually means

Your dev server is only reachable from your own machine. To let a webhook provider, a teammate, a client, or your phone reach it, you need a public hostname that forwards traffic to your laptop. ngsrv is that public hostname, plus HTTPS, plus the security policies you'd otherwise build yourself.

Step 1 — Install the CLI

Pick the channel that matches your OS:

# macOS (Homebrew, recommended)
brew install ngsrv/tap/ngsrv

# macOS / Linux (curl)
curl -fsSL https://get.ngsrv.com | bash

# Windows (PowerShell)
irm https://get.ngsrv.com/windows | iex

Every channel pulls the same release artifacts, so ngsrv --version will match across platforms.

Step 2 — Authenticate the CLI

Sign up at ngsrv.com/register, grab a token from your dashboard, and run:

ngsrv token <YOUR_TOKEN>

This writes a config file at ~/.ngsrv/config.yaml. You only do this once per machine.

Step 3 — Expose your local server

Pick the port your dev server is running on and hand it to ngsrv http:

# Next.js, Express, Rails, Django default
ngsrv http 3000

# Angular CLI default
ngsrv http 4200

# Vite default
ngsrv http 5173

# Spring Boot / Go services default
ngsrv http 8080

ngsrv prints a public HTTPS URL like https://furry-otter-1842.tnl.ngsrv.com that forwards every request to your local server. Open it in a browser, or paste it into a webhook config, and you're done.

Bringing it into your project

For anything beyond a one-off, commit an ngsrv.yml file to your repo so the whole team gets the same setup:

tunnels:
  - name: web
    port: 3000
    subdomain: my-app
  - name: api
    port: 8080
    subdomain: my-api

Then run all of them with one command:

ngsrv run ngsrv.yml

This is the part most other tunneling tools don't have. Declarative config + GitOps = a tunnel you'd commit to git.

Common follow-ups

FAQ

Can I expose localhost with ngsrv? Yes. Run ngsrv http <port> after installing and authenticating.

How do I expose localhost:3000? ngsrv http 3000. ngsrv prints a public HTTPS URL that forwards to your local server.

How do I expose localhost:4200? ngsrv http 4200. Same flow, different port. Works for Angular CLI and any other dev server.

Is the connection secure? Yes. ngsrv terminates HTTPS at the edge and forwards over an authenticated tunnel.

Does it cost anything? The free tier is enough to expose a local server with one custom subdomain and basic security policies.