A modern, Bun-native localtunnel implementation that exposes your localhost to the world. Built with TypeScript and Effect.ts for reliability.
Localtunnel creates a public URL that forwards traffic to your local development server. Useful for:
- Testing webhooks locally
- Sharing work-in-progress with teammates
- Demoing applications without deployment
- Testing mobile apps against local backends
# Install and build
bun install
bun run compile
bun run link
# Start a tunnel to your local server on port 3000
lt --port 3000
# Or specify a custom subdomain
lt --port 3000 --subdomain myappYour local server is now accessible at https://myapp.localtunnel.me.
- Bun 1.0.0+
- Node.js 18+ (for npm packages)
# Clone the repository
git clone https://github.com/imsus/localtunnel.git
cd localtunnel
# Install dependencies
bun install
# Build and link CLI tools
bun run link
# Verify installation
lt --help
localtunnel-server --help# Install client package
npm install localtunnel-client
# Install server package
npm install localtunnel-serverExpose your localhost to the world.
CLI:
lt --port 3000 # Random subdomain
lt --port 3000 --subdomain myapp # Custom subdomain
lt --port 3000 --host localhost:8080 # Custom tunnel serverAPI:
import { openTunnel, openTunnelCluster } from "@localtunnel/client";
const tunnel = await openTunnelCluster(3000, {
subdomain: "myapp",
host: "localtunnel.me",
});
console.log(`Tunnel URL: ${tunnel.url}`);
// Listen for requests
tunnel.onRequest(({ method, path }) => {
console.log(`${method} ${path}`);
});
// Close when done
await tunnel.close();Run your own tunnel server.
CLI:
# Start server on port 8080
localtunnel-server --port 8080
# With custom settings
localtunnel-server --port 8080 --admin-port 9090Configuration:
| Flag | Environment Variable | Default | Description |
|---|---|---|---|
--port |
LT_SERVER_PORT |
8080 | Server port |
--admin-port |
LT_ADMIN_PORT |
- | Admin API port |
--host |
LT_HOST |
0.0.0.0 |
Bind address |
Shared utilities for configuration management.
import { getClientConfig, getServerConfig } from "@localtunnel/shared";
// Client configuration from args/environment
const clientConfig = getClientConfig({ port: 3000 });
// Server configuration from args/environment
const serverConfig = getServerConfig({ port: 8080 });# Install dependencies
bun install
# Run tests
bun test
# Run e2e tests
bun run test:e2e
# Run tests with coverage
bun run test:coverage
# Lint codebase
bun run lint
# Format code
bun run fmt
# Check formatting without writing
bun run fmt --check
# TypeScript type checking
bun run typecheck
# Full validation (lint + format + tests)
bun run check
# Build all packages
bun run compile
# Link CLI tools globally
bun run link
# Unlink CLI tools
bun run unlink| Variable | Description |
|---|---|
LT_HOST |
Tunnel server host (default: localtunnel.me) |
LT_PORT |
Tunnel server port |
| Variable | Description |
|---|---|
LT_SERVER_PORT |
Server port (default: 8080) |
LT_ADMIN_PORT |
Admin API port |
LT_HOST |
Bind address (default: 0.0.0.0) |
- Check your firewall allows outbound connections
- Verify the tunnel server is running and accessible
- Try a different subdomain
lt --port 3000 --subdomain different-nameThe default connection timeout is 30 seconds. Increase it:
lt --port 3000 --timeout 60000Specify a different port:
lt --port 3001See CONTRIBUTING.md for guidelines.
See ROADMAP.md for architecture decisions and future plans.
MIT