Hopwire Hopwire

Docs

Getting started

Install Hopwire, start a tunnel to a local service, send a request through it and look at it in the inspector.

Hopwire sits in front of a service on your machine. It opens an entry point on loopback, forwards everything sent there to the service, records every request and response in a local traffic log and shows them live in the inspector.

This page takes you from nothing to a first recorded request. Everything on it stays on your machine: no account, no network connection beyond loopback.

Before you start

  • Node.js 20 or newer.
  • A service that answers HTTP on a local port. The examples use port 3000.

Install

Not published yet

The CLI will be published under the Apache-2.0 licence, but the package is not on npm yet and its name may still change. The command below shows the intended form, not a working install.

$ npm install -g hopwire
not published yet

Check that it runs:

sh
$ hopwire --version
$ hopwire --help

Start the first tunnel

Start your service on port 3000, then run:

sh
$ hopwire http 3000

Hopwire prints one line per fact and keeps running:

text
Mode         private (local only, no network connection beyond loopback)
Forwarding   http://127.0.0.1:4041 -> http://127.0.0.1:3000
Traffic log  5d1f0c7a9b3e4d2f8a6c1b0e7f9d3a5c2e4b6d8f0a1c3e5b7d9f1a3c5e7b9d1f (0 exchanges)
Inspector    http://127.0.0.1:4040/<key>

What the lines mean:

Line Meaning
Mode How the tunnel talks to the outside. A plain hopwire http <port> is private and local only: nothing is announced and nobody can connect.
Forwarding The entry point on the left, your service on the right. Requests go to the entry point; Hopwire passes them on to the service.
Traffic log The key of the traffic log (64 hexadecimal characters; yours differs) and how many exchanges it already holds. The log lives in the data directory and is kept between runs, so the count grows over time.
Inspector The address of the inspector.

Defaults:

What Default Change it with
Entry point 127.0.0.1:4041 --listen <port> (0 picks a free port)
Inspector 127.0.0.1:4040 --inspect <port> (0 picks a free port), or --no-inspect to run without it
Service name in the log default --name <service>
Data directory ~/.hopwire --data-dir <path> or the environment variable HOPWIRE_HOME

Entry point and inspector bind to 127.0.0.1 only. The tunnel always forwards to http://127.0.0.1:<port>.

Send a request

Send requests to the entry point, not to the service itself. In a second terminal:

sh
$ curl -X POST http://127.0.0.1:4041/hello -H 'content-type: application/json' -d '{"hello":"hopwire"}'

You get the answer of your service, unchanged. The terminal that runs the tunnel prints one line per exchange: method, path, status, duration.

text
POST    /hello  200  12ms

If the service is not running, the entry point answers 502 itself, and that exchange is logged like any other:

text
Hopwire: the local service did not answer (ECONNREFUSED)

For webhooks and other clients the rule is the same: point them at the entry point (http://127.0.0.1:4041) instead of the service (http://127.0.0.1:3000). WebSocket connections pass through the entry point as well; the log records the handshake, not the messages.

Open the inspector

Open the address of the Inspector line in a browser. It ends in an access key that is new at every start, so after a restart open the new address; without the key the inspector answers 403.

  • Before the first request the page says "No requests yet" and shows a curl command for your entry point that you can copy.
  • Requests appear live, newest first, with method, status and duration. No reload needed. The indicator in the top bar says "Live" while the page is connected to the tunnel.
  • Select a request to see its details: time, duration, source and service, and the tabs "Request" and "Response" with headers and body. JSON bodies are formatted.
  • "Replay" sends the stored request to your service again. "Edit & Replay" lets you change method, path, headers and body first. A replay is a new exchange in the log, with the source "replay" and a link back to the original.
  • The filter above the list matches method, path or status.
  • The top bar shows the mode ("Private mode"), the log key and the replay target, here http://127.0.0.1:3000.

The log keeps up to 2 MB of each request body and each response body. Larger bodies are still forwarded in full; the inspector marks the stored part as truncated.

The traffic log holds headers and bodies as captured, including credentials. It stays in your data directory unless you decide to share it.

Stop the tunnel

Press Ctrl+C. Hopwire closes the entry point, the inspector and the log in order and exits. The next hopwire http 3000 opens the same log and shows the earlier exchanges again.

If the start fails

Each failure is one sentence that says what happened and what to do.

Message What to do
Port 4041 for the entry point is already in use; choose another one with --listen <port>. Another program holds the port. Run hopwire http 3000 --listen 4051, or --listen 0 for a free port; the Forwarding line shows which one was taken.
Port 4040 for the inspector is already in use; choose another one with --inspect <port> or run with --no-inspect. Run hopwire http 3000 --inspect 4050, or add --no-inspect.
The data directory ~/.hopwire is in use by another tunnel; stop that one or choose another directory with --data-dir <path>. One data directory serves one running tunnel (the message names the full path). For a second tunnel at the same time, give it its own directory and its own ports: hopwire http 8080 --data-dir ~/.hopwire-second --listen 4051 --inspect 4050.
port must be a port number between 1 and 65535 The argument of hopwire http is the port of your service.

A wrong command line exits with code 2 and points to hopwire --help; every other failed start exits with code 1.

Next steps

  • Share with a teammate (private mode). No account, no servers of ours, end-to-end encrypted between you and the teammates you choose. hopwire http 3000 --share adds a Peer key line; a teammate reaches your service with hopwire connect <peer-key> --port <port> and follows your traffic with hopwire watch <log-key>. Read the notice the command prints first: the shared log is the whole log of the data directory, and --allow <pubkey> limits who may connect or watch.
  • Get a public URL (public mode). hopwire http 3000 --public serves the service under a public HTTPS URL through the edge. It needs the URL of the edge in HOPWIRE_EDGE_URL and an account: run hopwire login first.
  • Run several services at once. Describe them in hopwire.yaml and start them all with hopwire up: one traffic log and one inspector for all of them.
  • See every option. hopwire --help.