# untun

> Tunnel your local HTTP(s) server to the world! Powered by Cloudflare Quick Tunnels.

Latest version **0.2.2** (published 2026-07-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install untun
pnpm add untun
yarn add untun
bun add untun
```

Provides the command `untun`.

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2026-07-20 |
| First published | 2023-08-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 19.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1377 |
| Maintainers | pi0 |

## Links

- npm: https://www.npmjs.com/package/untun
- Repository: https://github.com/unjs/untun
- Homepage: https://github.com/unjs/untun#readme
- Issues: https://github.com/unjs/untun/issues
- npm.io page: https://npm.io/package/untun

## Recent versions

- 0.2.2 (latest) — 2026-07-20
- 0.2.1 — 2026-07-20
- 0.2.0 — 2026-07-20
- 0.1.3 — 2023-12-14
- 0.1.2 — 2023-08-25
- 0.1.1 — 2023-08-13
- 0.1.0 — 2023-08-13
- 0.0.0 — 2023-08-13

## README

# 🚇 untun

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![bundle][bundle-src]][bundle-href]

[![License][license-src]][license-href]

Tunnel your local HTTP(s) server to the world!

Powered by 🔥 [Cloudflare Quick Tunnels](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/trycloudflare/) and used by 👂 [unjs/listhen](https://github.com/unjs/listhen).

## Usage (CLI)

Globally run tunnel with `npx`:

```sh
npx untun@latest tunnel http://localhost:3000
```

```
◐ Starting cloudflared tunnel to http://localhost:3000
ℹ Waiting for tunnel URL...
✔ Tunnel ready at https://unjs-is-awesome.trycloudflare.com
```

Use `npx untun tunnel --help` for more usage info.

## Usage (API)

Install package:

```sh
# npm
npm install untun

# yarn
yarn add untun

# pnpm
pnpm install untun
```

Import:

```ts
// ESM
import { startTunnel } from "untun";

// CommonJS
const { startTunnel } = require("untun");
```

Start tunnel:

```ts
const tunnel = await startTunnel({ port: 3000 });
```

## Options

### `url`

- Default: `{protocol}://{hostname}:{port}`

The local server URL to tunnel.

### `port`

- Default: `3000`

The local server PORT (only effective if `url` is not provided).

### `hostname`

- Default: `localhost`

The local server hostname (only effective if `url` is not provided).

### `protocol`

- Default: `http`

The local server protocol (only effective if `url` is not provided).

### `verifyTLS`

- Default: `false`

Verify local server TLS certificate.

### `acceptCloudflareNotice`

- Default: `false`
- Environment variable: `UNTUN_ACCEPT_CLOUDFLARE_NOTICE`

Accept cloudflare TOS by default.

### `extraArgs`

- Default: []

Extra CLI arguments to provide to cloudflared.

Example:

```ts
const tunnel = await startTunnel({
  port: 3000,
  extraArgs: ["--no-autoupdate"]
});
```

## Development

- Clone this repository
- Install latest LTS version of [Node.js](https://nodejs.org/en/)
- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
- Install dependencies using `pnpm install`
- Run interactive tests using `pnpm dev`

## License

Made with 💛

Published under [MIT License](./LICENSE).

cloudflared integration based on a fork of [JacobLinCool/node-cloudflared](https://github.com/JacobLinCool/node-cloudflared)

Your installation of cloudflared software constitutes a symbol of your signature indicating that you accept the terms of the Cloudflare [License](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/license/), [Terms](https://www.cloudflare.com/terms/) and [Privacy Policy](https://www.cloudflare.com/privacypolicy/).

<!-- Badges -->

[npm-version-src]: https://img.shields.io/npm/v/untun?style=flat&colorA=18181B&colorB=F0DB4F
[npm-version-href]: https://npmjs.com/package/untun
[npm-downloads-src]: https://img.shields.io/npm/dm/untun?style=flat&colorA=18181B&colorB=F0DB4F
[npm-downloads-href]: https://npmjs.com/package/untun
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/untun/main?style=flat&colorA=18181B&colorB=F0DB4F
[codecov-href]: https://codecov.io/gh/unjs/untun
[bundle-src]: https://img.shields.io/bundlephobia/minzip/untun?style=flat&colorA=18181B&colorB=F0DB4F
[bundle-href]: https://bundlephobia.com/result?p=untun
[license-src]: https://img.shields.io/badge/License-MIT-green.svg?style=flat&colorA=18181B&colorB=F0DB4F
[license-href]: https://github.com/unjs/untun/blob/main/LICENSE

---
_Source: https://npm.io/package/untun · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
