cloudflare / cloudflare/moltworker

Proposal: Optional BoxLite sandbox backend (experimental)

Open
#296 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
10k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

## Summary

Could we add [BoxLite](https://github.com/boxlite-ai/boxlite) as an **optional** sandbox backend?

This is not a replacement request. Existing runtime defaults can stay as-is.

## Why

- Extra isolation option (micro-VM based).
- Good fit for projects that already have runtime abstraction.
- Opt-in only, so no disruption for existing users.

## Tiny example (Node.js)

```ts
import { SimpleBox } from '@boxlite-ai/boxlite';

async function run(i: number) {
const box = new SimpleBox({ image: 'alpine:latest', autoRemove: true });
try {
await box.exec('sh', '-lc', 'echo ok');
const m = await box.metrics();
console.log(`[box ${i}] totalCreateDurationMs=${m.totalCreateDurationMs}`);
} finally {
await box.stop();
}
}

async function main() {
await Promise.all([1, 2, 3].map(run));
}
main();
```

Warm startup is typically under 200ms.
Cold starts can be higher depending on image/cache state.

## Suggested scope

1. Add optional `boxlite` backend.
2. Keep current runtime behavior unchanged unless explicitly selected.
3. Validate parity for mounts, timeout, and cleanup lifecycle.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.