Skip to content
FlyCockpit
WS Sandbox Proxy/ Overview & Quick Start
WS Sandbox Proxy logo

WS Sandbox Proxy Overview & Quick Start

Rust + TypeScriptMITTarget v1.0.0
Repository

Self-hosted KVM sandbox control plane running owner-scoped Incus virtual machines on your own Linux hosts.

Platforms: Linux with KVM + Incus 6.14+ (or --runtime fake)

WS Sandbox Proxy (wssp, the name of its Rust CLI and node daemon) is a self-hosted sandbox control plane for running owner-scoped Incus KVM virtual machines on Linux hosts you enroll. It provides a web dashboard, a native /v1 HTTP API, a TypeScript SDK (@wssp/sdk), a built-in /mcp server, and interactive CLI shells, port forwards, and keyless SSH—all driven over outbound WebSockets so your sandbox hosts never need inbound ports.

Architecture

WS Sandbox Proxy separates the web/API control plane from the Linux machines that run KVM workloads. Node daemons connect outbound to /ws/sandbox-host, execute dispatched operations against their local Incus daemon, and enforce sandbox lifetimes and network policies locally even while disconnected.

                    +-------------------------------------------+
                    |             Control Plane                 |
  Browser (Cookie)  |  apps/web (React / TanStack Router SPA)   |
  SDK (/v1 Bearer)  |  apps/server (Hono, Better Auth, oRPC,    |
  MCP (/mcp OAuth)  |    /v1 API, /mcp, Relay, Transfer Spool)  |
  CLI (wssp login)  |  apps/worker (BullMQ jobs, webhooks)      |
                    +---------------------+---------------------+
                                          |
                     +--------------------+--------------------+
                     |                                         |
            PostgreSQL 18 + Valkey 9                   Outbound WSS
            (Metadata, Ops, Rate Limits)            (/ws/sandbox-host)
                                                               |
                                             +-----------------+-----------------+
                                             |   Enrolled Linux Host(s)          |
                                             |   wssp host run (unprivileged)    |
                                             |   wssp-guard (root nftables)      |
                                             |   Incus 6.14+ KVM VMs             |
                                             |     wssp-sbx-<id> (wssp project)  |
                                             +-----------------------------------+

Core packages and applications in the repository:

Component Role
apps/web React / TanStack Router dashboard with browser terminal, PWA support, and localized routes
apps/server Hono API server, Better Auth, /v1 native API, /mcp endpoint, host relay, and transfer spool
apps/worker Optional dedicated BullMQ consumer container (runs embedded in apps/server by default)
apps/cli Linux-only Rust binary (wssp) serving both user commands and the outbound node daemon
packages/sandbox-contracts Public /v1 DTO schemas, error catalog, route registry, and generated OpenAPI document
packages/sdk Server-side TypeScript client (@wssp/sdk)
crates/sandbox-protocol / crates/sandbox-runtime Relay protocol 1.0 contract and Incus KVM / fake runtime adapters

Prerequisites

Local development stack

  • Node.js 26 LTS (26.13.1 or newer)
  • pnpm 12.18.0 (pinned in package.json)
  • Docker or Podman (for local PostgreSQL 18 and Valkey 9)
  • portless (npm install -g portless) for local https://*.localhost origins
  • Rust 1.99+ (to build or run the wssp CLI and node daemon from source)

Real sandbox hosts

  • Linux (x86_64 or aarch64) with KVM (/dev/kvm usable by Incus)
  • Incus 6.14 or newer with the network_acl extension (Ubuntu 24.04 ships 6.0.0; install from Zabbly)
  • br_netfilter kernel module loaded with net.bridge.bridge-nf-call-ip6tables=1
  • conntrack package installed (conntrack on Debian/Ubuntu, conntrack-tools elsewhere)
  • Root access once per host to install the wssp-guard nftables service

Local development quick start

Install dependencies, initialize local services, and start the control plane:

npm install -g pnpm@12.18.0 portless
pnpm install
pnpm setup:app
pnpm dev

[!NOTE] Use pnpm setup:app rather than pnpm setup—setup is a built-in pnpm command that takes precedence over a same-named package script. On Linux/WSL, if pnpm fails with mkdir '/Users', unset any stale macOS PNPM_HOME environment variable and retry.

pnpm setup:app creates missing .env files, generates auth and SANDBOX_REQUEST_HMAC_SECRET values, records ADMIN_EMAILS, starts PostgreSQL 18 and Valkey 9, and applies committed Prisma migrations. Once running:

  • Dashboard: https://wssp.localhost
  • API: https://api.wssp.localhost

Validate your local environment at any time with:

pnpm doctor:app

First local login (Mailpit)

Public signup is disabled by default (SIGNUP_ENABLED=false), while addresses listed in ADMIN_EMAILS can bootstrap the first administrator account. Every account must verify its email address before signing in.

  1. Confirm ADMIN_EMAILS in the root .env matches your email address (for example you@example.com).
  2. Start a local Mailpit container to capture verification emails:
docker run -d -p 1025:1025 -p 8025:8025 axllent/mailpit
  1. Set the following in the root .env:
SMTP_HOST=localhost
SMTP_PORT=1025
SMTP_FROM=noreply@dev.local
  1. Restart pnpm dev, sign up at https://wssp.localhost with your ADMIN_EMAILS address, open http://localhost:8025 to click the verification link, and enroll two-factor authentication (required for admins).

Connecting your first host

You can either enroll a real Linux KVM + Incus host or test the control plane locally without VMs using the fake runtime.

Option A: Enroll a real Linux KVM + Incus host

Install wssp on the Linux host as the unprivileged user that has Incus admin access (matching your server version):

curl --proto '=https' --tlsv1.2 -fsSL --max-time 120 https://wssp.example.com/install.sh | sh

Enroll the machine via device login, install the root-owned egress guard once, and start the daemon:

wssp host enroll --slug desk-01 --server https://wssp.example.com
sudo "$(command -v wssp)" host guard install --daemon-user "$USER"
wssp host run
  1. Open the verification URL printed by wssp host enroll in your signed-in browser and approve the host.
  2. In the dashboard, open Templates → Create from community image to prepare a tested Ubuntu base VM image (OCI container images are not VM images).
  3. Create your first sandbox from Sandboxes → Create sandbox or via the CLI/SDK.

Option B: Try locally without VMs (WSSP_RUNTIME=fake)

To exercise enrollment, pools, lifecycle operations, webhooks, and the /v1 or /mcp APIs on a development stack without KVM or Incus, run the daemon with --runtime fake (or WSSP_RUNTIME=fake):

cargo run -p wssp -- host enroll --slug dev-fake --server https://api.wssp.localhost
WSSP_RUNTIME=fake WSSP_FAKE_ENFORCE_EGRESS=1 cargo run -p wssp -- host run
  • WSSP_FAKE_ENFORCE_EGRESS=1 makes the fake runtime advertise egress enforcement (which it does not actually perform) so creates are accepted on local stacks.
  • WSSP_FAKE_FAIL_CREATE_FILE=/tmp/fail-creates causes new creates to fail while that file exists—useful for testing retry and sandbox.create_failed webhook paths.
  • wssp host run refuses to start the real Incus runtime if either fake testing variable is set.

Known limitations

Be aware of these current boundaries before adopting WS Sandbox Proxy:

  • Not a drop-in E2B server replacement. WS Sandbox Proxy does not implement E2B’s REST or envd wire protocols, so official E2B SDKs cannot connect to it. @wssp/sdk adopts ergonomic E2B-like conventions on top of /v1.
  • No built-in public URLs (getHost). Guest ports are never exposed directly to the public internet. To share a web app inside a sandbox, configure an optional external Tunnel server for short-lived gated preview links, or use wssp sandbox forward locally.
  • No snapshots, live restore, or VM fork. Those operations currently return UNSUPPORTED_CAPABILITY. Stopping a sandbox keeps its root disk (not RAM or running processes); with an S3 image store, stopped disks can offload and restore on another eligible host.
  • No live migration or failover. Placement picks among currently eligible hosts (or queues in a pool’s FIFO wait queue when waitForCapacityMs is set). A running sandbox stays on its assigned host.
  • Shared-pool trust model. Pool sharing is by explicit invitation only. A node owner’s daemon user is an Incus admin and retains full access to every VM on their hardware, including other users’ shared-pool sandboxes. Pool users never receive host access to someone else’s machine.
  • Linux-only CLI and daemon. Release binaries ship for x86_64 and aarch64 Linux (static musl). On Windows, run wssp inside WSL 2.
  • Single-replica control plane. Run exactly one apps/server replica: host relay sockets, browser/CLI terminal sessions, in-process revocation signals, and the /app/.data transfer spool assume one server process.