Horizon

Getting started

Install the Horizon CLI, sign in and share localhost on a public HTTPS URL in three commands.

Put your local server on a public HTTPS URL that anyone, or any webhook, can reach.

Paste this prompt into your coding agent to set up Horizon for you.
Set up a Horizon tunnel for this project. Horizon (https://hrzn.run) puts a local server on a public HTTPS URL. Docs: https://hrzn.run/docs

1. Check whether the Horizon CLI is installed: run "hrzn --version". If it is missing, install it globally with this project's package manager, for example "npm install -g @hrzn/cli".
2. Ask me for my Horizon account ID. It is shown on https://hrzn.run/dashboard. Then run "hrzn login <account-id>". It prints "Approve the sign-in in your browser:" followed by a link. Show me the link and wait while I approve it in the browser. It prints "Signed in." when it is done.
3. Find the port my dev server runs on, from the package.json scripts or the framework config. Start the dev server if it is not running.
4. Ask me whether I have a reserved subdomain. If I do, run "hrzn tunnel http://localhost:<port> -s <subdomain>". If not, run "hrzn tunnel http://localhost:<port>" for a random one. Keep it running in the background.
5. When the terminal prints "HORIZON: Tunnel connected", tell me my public URL from its "URL" line, https://<subdomain>.hrzn.run, and the "Request log" link below it.
6. If I want to test webhooks from Stripe, GitHub, Shopify, Slack, Twilio or Clerk, follow the matching guide at https://hrzn.run/docs/guides/webhooks/<service>

Before you begin

  • Node.js with npm, pnpm, Yarn or Bun
  • A server running on your machine, for example on http://localhost:3000
  • A free Horizon account. Sign in at hrzn.run with GitHub or Google.

Install the CLI

Install @hrzn/cli globally. It adds the hrzn command.

npm install -g @hrzn/cli

Sign in

Your dashboard shows the login command with your account ID filled in. Copy it and run it.

hrzn login <account-id>

The CLI prints a link. Open it, approve the sign-in, and the terminal confirms it:

Output
HORIZON: Approve the sign-in in your browser: https://hrzn.run/dashboard/settings/cli-token-requests/<request-id>
HORIZON: Signed in. Run hrzn tunnel http://localhost:3000 to start a tunnel.

Start a tunnel

Point the tunnel at your local server. Include the protocol and the port.

hrzn tunnel http://localhost:3000

Your app is now live at the URL the terminal prints.

Check it works

Open the URL in a browser, or on your phone. The terminal prints a short header, then one line per request:

Output
HORIZON: Tunnel connected
  URL          https://3f6c2a91-8d4e-4b7a-9c1f-5e2d7a8b0c43.hrzn.run (random)
  Forwarding   http://localhost:3000
  Request log  https://hrzn.run/dashboard/tunnels/3f6c2a91-8d4e-4b7a-9c1f-5e2d7a8b0c43

  GET     200  /

The status is green for 2xx, amber for 3xx and 4xx, and red for 5xx. Open the Request log link to see each request in full.

Press Ctrl+C to stop the tunnel.

Keep one URL with a reserved subdomain

Without -s, Horizon picks a random subdomain that changes every time you restart. That's fine for a quick share. It breaks anything you configured with the old URL, like a webhook endpoint.

Reserve a subdomain on the Subdomains page, then pass it with -s:

hrzn tunnel http://localhost:3000 -s my-app

Reserved subdomains are a paid feature, see Pricing. If you pass a name you have not reserved, the command stops and prints a link to reserve it.

Next steps

On this page