How it works
xpose uses Cloudflare Workers and Durable Objects to create a serverless tunnel between your local machine and the internet.
Architecture
Browser → Cloudflare Worker → Durable Object ↔ CLI → localhostStep by step
- CLI connects via WebSocket
The xpose CLI establishes a WebSocket connection to a Cloudflare Worker at your subdomain.
- Worker creates a Durable Object
The Worker creates (or resumes) a Durable Object that manages the tunnel session. Each subdomain maps to exactly one Durable Object.
- Traffic hits the public URL
When someone visits your public URL, the request hits the Cloudflare Worker, which forwards it to the Durable Object.
- DO multiplexes through WebSocket
The Durable Object encodes the HTTP request into a binary frame and sends it through the WebSocket to your CLI. Multiple requests can be in-flight at once.
- CLI forwards to localhost
The CLI receives the request, forwards it to your local server, and sends the response back through the same WebSocket channel.