sandboxd: The Anti-Kubernetes Engine Behind Sleeping Sandboxes and Live Preview URLs

A single Go daemon, SQLite, Docker, and Traefik power a self-hosted sandbox platform that wakes containers on demand, reaps them under memory pressure, and keeps AI app builders cheap enough to run on one box.

9 min read • View on GitHub • More from tastyeffectco

A proxy gate stands in front of a sleeping workshop while a request envelope arrives at the threshold. Inside, a container is being brought to life and a preview space brightens only after the request is accepted. The scene explains the project's wake-on-request behavior, where a URL can exist before the sandbox is actually awake.
The preview URL is live as an address, but the sandbox stays asleep until a request arrives and wakes it.
Key Takeaways

A request hits a dead URL. Traefik catches it, `sandboxd` holds the connection open, a container wakes, `runtimed` confirms the dev server is ready, and only then does the response flow through. That is the whole pitch in one motion: a preview that behaves like infrastructure magic, but is built from parts most engineers already trust.

you may checkout sandboxd project, it allow you ti run on your own vps plenty of sandboxes for differents usages : https://github.com/tastyeffectco/sandboxd

tastyeffectco, Author/Maintainer · Noob Comments | Hacker News

A URL That Sleeps Until You Touch It

The hook is behavioral, not architectural. A preview URL does not mean a hot container sitting around burning money. It means a request can arrive at a dormant sandbox, wake the machine behind it, and wait until the app is actually usable.

That makes the experience feel immediate to the user and stingy to the operator. The system spends compute only when someone needs it, which is exactly what AI app builders want when a thousand tiny experiments would otherwise each deserve a permanently warm environment.

The wake path is a handshake, not a restart. The request waits while the sandbox becomes real, then continues into the live app.

The result is a nice inversion of normal preview systems. Most platforms keep the container alive and let the URL stay warm. `sandboxd` makes the URL stay available while the container is allowed to sleep.

Why This Stack Feels So Small

The stack is not accidental minimalism. Go gives the daemon a straightforward concurrency model. SQLite provides a source of truth without introducing a separate database service. Docker is the execution substrate. Traefik handles the edge routing that makes wake-on-request possible.

ProjectIsolation modelSelf-hostingPreview URL behaviorBest forTrade-off
sandboxdDocker containers with host-aware schedulingYesSleeps until request wakes itAI app builders who want control and densityLess isolation than microVM-first platforms
E2BFirecracker microVMsManaged and self-hosted options varyUsually session-based and warm while activeAgent workloads that need stronger boundariesHeavier runtime and more platform complexity
Vercel SandboxFirecracker microVMsNoEphemeral, managed, platform-controlledTeams that want a turnkey hosted primitiveNo self-hosting and tighter product limits
gVisor / KataKernel or VM-backed sandbox layersYesDepends on the integration layerSecurity-sensitive execution under custom opsMore integration work than a ready-made product

This is what "boring on purpose" looks like in practice. The software is narrow enough that one person can understand the full path from API call to container start, which is a very different proposition from a platform whose behavior disappears behind layers of abstraction.

The Control Plane Is the Brain

The control plane is the part that keeps the whole system honest. It reconciles what SQLite says should exist with what Docker actually has running, which is the right shape for a system that must survive restarts, stale containers, and interrupted work.

That reconciler pattern matters because the daemon is not just launching containers. It is managing lifecycle, reaping idle sandboxes, exposing API endpoints, and keeping the machine from drifting into a state where the database and reality no longer agree.

The practical payoff is resilience. If the daemon restarts, it does not need to rediscover a hidden distributed system. It re-reads local state, checks the host, and converges.

The Runtime Lives Inside the Sandbox

`runtimed` is the in-sandbox supervisor. It watches the dev server, exposes readiness over a Unix socket, and gives the control plane a reliable way to ask whether the guest is actually ready to serve traffic.

That separation is elegant. The control plane knows about lifecycle and scheduling. The runtime knows about the app process, local readiness, and whether the code inside the sandbox is healthy enough to receive a request.

ResponsibilityControl planeRuntime
Starts and stops sandboxesYesNo
Tracks desired stateYesNo
Supervises dev serverNoYes
Reports readinessVia API and socketYes
Reconciles host pressureYesNo

This is the bridge that makes the product feel like one system instead of two unrelated daemons. The guest can fail, rebuild, and become ready again without forcing the host to lose the plot.

The Secret Sauce Is Wake-on-Request

This is the piece that makes `sandboxd` feel novel rather than merely competent. The HTTP request is not rejected, redirected, or replaced with a spinner page. It is held open while the sandbox wakes.

That changes the economics and the UX at the same time. Users get a preview URL that behaves like a real endpoint. Operators get scale-to-zero behavior without writing a separate cold-start orchestration stack.

PatternWhat the user seesWhat the operator paysFailure mode
Always-on previewsInstant responsesConstant idle burnWasted capacity
Poll-and-redirectA waiting page or retry loopLower idle burnClunky user experience
Wake-on-request in sandboxdOne URL that becomes live when readyIdle containers can sleepLong first request if startup stalls

This is also why Traefik matters. It is not just an edge proxy here. It is the first switch in the wake chain, the place where a sleeping sandbox becomes a live transaction instead of a dead link.

Density Comes from Ruthless Reaping

A crowded machine shows many small sandbox rooms stacked like drawers inside one host box. Some rooms are lit while others are dim, and a scheduler figure closes the oldest or hungriest rooms as a pressure gauge rises. The image explains how host-aware reaping keeps density high without pretending the machine has infinite memory.
The reaper is what makes one box feel like many. It uses host pressure and idle signals to evict the right sandboxes first.

This is the anti-theater move in the project. Instead of pretending the host has infinite resources, `sandboxd` watches for pressure and trims back intelligently. That is how you get density without turning the machine into a gamble.

Snapshots Make Cold Starts Feel Warm

The other cheat code is snapshotting. Reflink-based workspace clones let the system start from a golden image instead of rebuilding every sandbox from scratch. For a code environment, that can be the difference between a satisfying boot and a dead pause.

It matters especially for AI workflows, where iteration speed changes behavior. If the environment appears quickly, people keep experimenting. If it drags, they stop trusting the loop.

In other words, the snapshot system is not a neat file-system detail. It is part of the product experience.

What It’s Really Competing With

ProjectCategoryWhat it optimizes forWhere sandboxd differs
E2BManaged or hybrid AI sandboxIsolation and SDK polishsandboxd stays self-hosted and simpler
DaytonaDeveloper environment platformOperational conveniencesandboxd pushes more control to the operator
Vercel SandboxManaged compute primitiveTurnkey hosted executionsandboxd can run on your own VPS
NorthflankPlatform with secure computeBroader platform operationssandboxd is narrower and more legible
gVisorSandboxing runtimeIsolation boundary strengthsandboxd is an app platform, not a syscall layer
Kata ContainersLightweight VM runtimeStronger container isolationsandboxd prioritizes density and simplicity
FirejailLinux app sandboxingPer-process isolationsandboxd manages full preview environments

That comparison is the point. `sandboxd` is not trying to out-platform the platforms. It is carving out a smaller, sharper problem: self-hosted preview sandboxes that wake on demand and stay understandable.

Why This Matters Now

AI app builders need environments that are fast, cheap, and disposable, but still trustworthy enough to expose to users. The market keeps drifting toward managed primitives, yet many teams still want control over cost, routing, and deployment shape.

`sandboxd` reads like a response to that gap. It shows that a single machine, a small amount of software, and a clear control plane can deliver a surprisingly complete experience.

That makes it more than a utility. It is a pattern for building the next layer of AI infrastructure without inheriting the full weight of cloud-native ceremony.