Expose your localhost to the internet. A simple, self-hostable tunneling solution.
macOS / Linux
curl -fsSL https://onlocal.dev/install.sh | bashWindows (PowerShell)
irm https://onlocal.dev/install.ps1 | iexThis downloads the appropriate binary for your platform and adds it to your PATH.
npm install -g onlocalAlso works with bun, pnpm, and yarn.
Download the binary for your platform from the releases page:
onlocal-linux-x64- Linux x64onlocal-linux-arm64- Linux ARM64onlocal-darwin-x64- macOS Intelonlocal-darwin-arm64- macOS Apple Silicononlocal-windows-x64.exe- Windows x64
onlocal <port>Example:
onlocal 3000This exposes localhost:3000 and gives you a public URL like https://abc123.onlocal.dev.
You can configure the default behavior (e.g., self-hosted tunnel URL) using:
onlocal configThis will open an interactive setup to save your preferences to ~/.onlocal/config.yml.
onlocal consists of two components:
+-----------------+ +-----------------+ +-----------------+
| Your App | | onlocal CLI | | proxy-worker |
| localhost:3000 | <-----> | (client) | <-----> | (Cloudflare) |
+-----------------+ HTTP +-----------------+ WS +-----------------+
|
| HTTPS
v
+-----------------+
| Internet |
| abc.onlocal.dev |
+-----------------+
Located in packages/onlocal. The CLI client runs on your machine and:
- Establishes a WebSocket connection to the proxy server
- Receives a unique subdomain (e.g.,
abc123.onlocal.dev) - Listens for incoming HTTP requests over the WebSocket
- Forwards requests to your local server
- Sends responses back through the WebSocket
The client handles automatic reconnection with exponential backoff if the connection drops.
Located in apps/proxy-worker. The proxy server runs on Cloudflare Workers with Durable Objects and:
- Accepts WebSocket connections from CLI clients
- Assigns unique subdomains to each client
- Routes incoming HTTP requests from
*.onlocal.devto the correct client - Maintains persistent connections using Durable Objects
- Stores client-to-tunnel mappings in KV
Each tunnel gets its own Durable Object instance, ensuring isolation and persistence.
| Component | Technology | Purpose |
|---|---|---|
packages/onlocal |
Bun/Node.js | CLI client binary |
apps/proxy-worker |
Cloudflare Workers | Edge proxy server |
| Durable Objects | Cloudflare | WebSocket management, request routing |
| KV | Cloudflare | Client ID to Durable Object mapping |
To run your own instance:
cd apps/proxy-worker
pnpm install
pnpm run deployConfigure your wrangler.toml with your domain and KV namespace.
Modify the TUNNEL_DOMAIN in the client or fork the project.
Start the proxy worker:
cd apps/proxy-worker
pnpm run devRun the CLI:
cd packages/onlocal
bun run dev 3000cd packages/onlocal
bun run build:binThis produces binaries for all supported platforms in dist/bin/.
| Platform | Architecture |
|---|---|
| Linux | x64, arm64 |
| macOS | x64 (Intel), arm64 (Apple Silicon) |
| Windows | x64 |
- HTTP request proxying (GET, POST, PUT, DELETE, etc.)
- Automatic tunnel URL generation with SSL/TLS
- Automatic reconnection on network errors
- Binary response handling (images, files, etc.)
- WebSocket proxying
- Custom domains
MIT