captun

A tiny public tunnel for local HTTP servers.

Run this in a project with something listening on port 3000:

npx captun 3000

You get a URL like:

https://abc123.captun.sh

Requests to that URL are forwarded to your local server until you stop the process.

From code

import { createCaptunTunnel } from "captun";

const tunnel = await createCaptunTunnel({
  fetch: () => new Response("hello from my machine"),
});

console.log(tunnel.url);

Bring your own Cloudflare account

npx captun deploy

Source: github.com/iterate/captun

Try it in this tab

Edit the fetch function, create a tunnel, then the iframe below will load the public URL.

idle