A one-command, system-wide proxy tool powered by Cloudflare Workers with rotating global IPs.
- Vision
- Quick Start
- Installation
- Usage
- Configuration
- Development
- Architecture
- Testing
- Deployment
- Contributing
- Security
- License
EdgeTunnel routes all your system traffic through Cloudflare Workers with zero manual configuration. One command gives you:
- Global IP rotation across 100+ countries
- Automatic system proxy configuration (macOS/Windows/Linux)
- Enterprise-grade authentication and rate limiting
- Smart geo-routing (India user β India proxy, etc.)
edgetunnel start
That's it. All your traffic now flows through the EdgeTunnel network.
- Node.js 18+ and Bun 1.3+
- Cloudflare account (for Worker deployment)
- PostgreSQL database (Neon recommended)
# Clone repository
git clone https://github.com/your-username/edgetunnel.git
cd edgetunnel
# Install dependencies
bun install
# Copy environment template
cp .env.example .env
# Edit .env with your credentials
# See Configuration section below# Build all packages
bun run build
# Type-check and lint
bun run typecheck
bun run lint# Run all apps in parallel
bun run dev
# Or run specific app
cd apps/worker && bun run dev
cd apps/backend && bun run dev
cd apps/cli && bun run dev# Start EdgeTunnel (routes all system traffic)
edgetunnel start \
--api-key <your-api-key> \
--signing-secret <your-signing-secret> \
--worker-url https://edgetunnel.com/proxy
# Stop and restore original proxy settings
edgetunnel stop
# Check status
edgetunnel statusFull System Mode (default)
- Routes ALL system/browser traffic
- Auto-configures OS proxy settings
Browser Only
edgetunnel start --browser- Only configures browser proxy (Chrome/Firefox/Edge)
Manual Mode
edgetunnel start --manual- Doesn't touch system settings
- You manually set browser/system proxy to
localhost:3000
EdgeTunnel uses Stack Auth for authentication:
- Sign up at Stack Auth
- Create a new project
- Copy Project ID and Server Key
- Use the Server Key as your API key
Copy .env.example to .env and fill in all required variables:
DATABASE_URL="postgresql://user:pass@host/db?sslmode=require"We recommend Neon for serverless Postgres.
NEXT_PUBLIC_STACK_PROJECT_ID="your-project-id"
STACK_SECRET_SERVER_KEY="ssk_your_secret_key"REQUEST_SIGNING_SECRET="random-32-char-secret"
CONTROLLER_SHARED_SECRET="another-secret"
CONTROLLER_INTERNAL_TOKEN="internal-auth-token"# Cloudflare KV for rate limiting
RATE_LIMIT_KV_ID="your-kv-id"
# Cloudflare D1 for usage logs
USAGE_DB_ID="your-d1-database-id"# Generate Prisma client
cd packages/db && bun db:generate
# Run migrations
cd packages/config && bun db:migrate
# Push schema changes
cd packages/config && bun db:pushedgetunnel/
βββ apps/
β βββ cli/ # System proxy daemon (local)
β βββ worker/ # Cloudflare Worker (edge)
β βββ backend/ # Proxy controller (server)
β βββ dashboard/ # Web dashboard (Next.js)
βββ packages/
β βββ types/ # TypeScript schemas (Zod)
β βββ utils/ # Shared utilities
β βββ db/ # Prisma client
β βββ config/ # Drizzle ORM schema
βββ .env.example # Environment template
βββ LICENSE # MIT License
βββ README.md
User Request
β
System Proxy (localhost:3000)
β
CLI Daemon (signs request)
β
Cloudflare Worker (auth + rate limit)
β
Proxy Controller (selects node)
β
Proxy Node (geographically optimal)
β
Target Website
β
Response (return path)
CLI (apps/cli)
- HTTP proxy server using
http-proxy - OS proxy configuration via
system-proxymodule - Request signing with HMAC
- Daemon process management
Worker (apps/worker)
- Hono framework on Cloudflare Workers
- API key validation via Stack Auth
- Rate limiting using KV (optional)
- Smart node selection based on user location
- Request/response streaming
Backend (apps/backend)
- Fastify server
https-proxy-agentfor HTTPS CONNECT tunneling- Node pooling with round-robin load balancing
- Usage logging to D1 (optional)
Dashboard (apps/dashboard)
- Next.js 15 with App Router
- Usage metrics and API key management
- Stack Auth authentication
# Run all tests
bun run test
# Specific app tests
cd apps/worker && bun run test
cd apps/backend && bun run test
# Watch mode
cd apps/worker && bunx vitest --watch
# Coverage report
bun run test --coverageapps/
βββ worker/
β βββ test/
β βββ index.spec.ts
β βββ env.d.ts
βββ backend/
βββ test/ (add your tests here)
cd apps/worker
# Authenticate (one-time)
bunx wrangler login
# Deploy to production
bunx wrangler deploy
# Deploy to preview
bunx wrangler deploy --env preview
# Generate types after binding changes
bunx wrangler typesEdit apps/worker/wrangler.jsonc:
{
"name": "edgetunnel-worker",
"main": "src/index.ts",
"compatibility_date": "2026-04-09",
"vars": {
"PROXY_CONTROLLER_URL": "https://your-backend.com",
"PROXY_NODES_JSON": "[...]",
"STACKAUTH_VALIDATE_URL": "https://api.stack-auth.com/v1/introspect"
}
}cd apps/backend
# Build
bun run build
# Start
PORT=8080 bun start
# Or with PM2
pm2 start dist/index.js --name edgetunnel-backendSet these in your deployment environment:
DATABASE_URL="postgresql://..."
CONTROLLER_SHARED_SECRET="secret"
CONTROLLER_INTERNAL_TOKEN="token"
PROXY_NODES_JSON='[{"id":"node-1","region":"us","endpoint":"http://node:8080","dedicatedOnly":false}]'cd apps/cli
# Build
bun run build
# Package for npm
npm pack
# Publish (maintainers only)
npm publishWe welcome contributions! Please see CONTRIBUTING.md for:
- Getting started guide
- Code style guidelines
- Pull request process
- Testing requirements
- Architecture overview
- Zero Trust - Every request is authenticated
- Least Privilege - Secrets isolated via env vars
- Defense in Depth - Multiple auth layers (API key β Worker β Controller)
- Auditability - All requests logged with userId, IP, timestamp
- SSRF Prevention - Domain/IP blocklist in
guard.ts - Replay Attacks - Timestamp + nonce verification
- MITM - HTTPS everywhere + request signing
- Abuse - Per-user rate limiting + API key revocation
Security issues should be reported privately to security@edgetunnel.com.
- WireGuard integration (true VPN mode)
- Desktop GUI application (Electron/Tauri)
- Browser extension
- AI-powered routing optimization
- IPv6 support
- SOCKS5 proxy support
- Mobile apps (iOS/Android)
MIT License - see LICENSE for full text.
Built on the shoulders of giants:
- Cloudflare Workers - Edge computing platform
- Stack Auth - Authentication
- Hono - Web framework
- Fastify - Backend server
- Drizzle ORM - Database toolkit
- Prisma - ORM
- Bun - JavaScript runtime
Star β this repo if you find it useful!
Follow us on Twitter @edgetunnel for updates.