Skip to content

Commit 7eb0b0b

Browse files
committed
feat(website): add FAQ section and sync README with landing page
1 parent ad4c389 commit 7eb0b0b

8 files changed

Lines changed: 416 additions & 46 deletions

File tree

CLAUDE.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ Follow the style in `packages/secure-exec/src/index.ts`.
7575
- comment tricky ordering/invariants; skip noise
7676
- add inline comments and doc comments when behavior is non-obvious, especially where runtime/bridge/driver pieces depend on each other
7777

78+
## Landing Page & README Sync
79+
80+
- `README.md` mirrors the landing page (`packages/website/src/pages/index.astro` and its components) 1:1 in content and structure
81+
- when updating the landing page (hero copy, features, benchmarks, comparison, FAQ, or CTA), update `README.md` to match
82+
- when updating `README.md`, update the landing page to match
83+
- the landing page section order is: Hero → Code Example → Why Secure Exec (features) → Benchmarks → Secure Exec vs. Sandboxes → FAQ → CTA → Footer
84+
7885
## Documentation
7986

8087
- docs pages that must stay current with API changes:

README.md

Lines changed: 184 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,194 @@
1-
# Secure Exec SDK
1+
# Secure Exec
22

3-
Run sandboxed Node.js code using a driver-based runtime.
3+
**Secure Node.js Execution Without a Sandbox**
44

5-
## Features
5+
A lightweight library for secure Node.js execution. No containers, no VMs — just npm-compatible sandboxing out of the box. Powered by the same tech as Cloudflare Workers.
66

7-
- **Minimal overhead**: TODO
8-
- **Just a library**: TODO
9-
- **Low memory overhead**: TODO
7+
```
8+
npm install secure-exec
9+
```
1010

11-
TODO:
11+
## Give your AI agent secure code execution
1212

13-
- **Node runtime**: isolated-vm backed sandbox execution with driver-owned capability wiring.
14-
- **Browser runtime**: Worker-backed execution through `NodeRuntime` + browser driver factories.
15-
- **Driver-based**: Provide a driver to map filesystem, network, and child_process.
16-
- **Permissions**: Gate syscalls with custom allow/deny functions.
17-
- **Opt-in system features**: Disable network/child_process/FS by omission.
13+
Expose secure-exec as a tool with the Vercel AI SDK. Your agent can execute arbitrary code without risking your infrastructure.
1814

19-
## Examples
15+
```typescript
16+
import { generateText, tool } from "ai";
17+
import { anthropic } from "@ai-sdk/anthropic";
18+
import { NodeRuntime, createNodeDriver, createNodeRuntimeDriverFactory } from "secure-exec";
19+
import { z } from "zod";
2020

21-
- Browser playground: `pnpm -C packages/playground dev`
21+
const runtime = new NodeRuntime({
22+
systemDriver: createNodeDriver({ permissions: { fs: true, network: true } }),
23+
runtimeDriverFactory: createNodeRuntimeDriverFactory(),
24+
memoryLimit: 64,
25+
cpuTimeLimitMs: 5000,
26+
});
27+
28+
const result = await generateText({
29+
model: anthropic("claude-sonnet-4-20250514"),
30+
tools: {
31+
execute: tool({
32+
description: "Run JavaScript in a secure sandbox",
33+
parameters: z.object({ code: z.string() }),
34+
execute: async ({ code }) => {
35+
const logs: string[] = [];
36+
const res = await runtime.exec(code, {
37+
onStdio: (e) => logs.push(e.message),
38+
});
39+
return { exitCode: res.code, output: logs.join("\n") };
40+
},
41+
}),
42+
},
43+
prompt: "Calculate the first 20 fibonacci numbers",
44+
});
45+
```
46+
47+
## Why Secure Exec
48+
49+
Give your AI agent the ability to write and run code safely.
50+
51+
- **No infrastructure required** — No Docker daemon, no hypervisor, no orchestrator. Runs anywhere Node.js, Bun, or an HTML5 browser runs. Deploy to Lambda, a VPS, or a static site — your existing deployment works.
52+
- **Node.js & npm compatibility** — fs, child_process, http, dns, process, os — bridged to real host capabilities, not stubbed. Run Express, Hono, Next.js, and any npm package. [Compatibility matrix →](https://secure-exec.dev/docs/node-compatability)
53+
- **Built for AI agents** — Give your AI agent the ability to write and run code safely. Works with the Vercel AI SDK, LangChain, and any tool-use framework.
54+
- **Deny-by-default permissions** — Filesystem, network, child processes, and env vars are all blocked unless explicitly allowed. Permissions are composable functions — grant read but not write, allow fetch but block spawn.
55+
- **Configurable resource limits** — CPU time budgets and memory caps. Runaway code is terminated deterministically with exit code 124 — no OOM crashes, no infinite loops, no host exhaustion.
56+
- **Powered by V8 isolates** — The same isolation primitive behind Cloudflare Workers for Platforms and every browser tab. Battle-tested at scale by the infrastructure you already trust.
57+
58+
## Benchmarks
59+
60+
V8 isolates vs. sandboxes.
61+
62+
### Cold start
63+
64+
| Percentile | Secure Exec | Fastest sandbox |
65+
|------------|-------------|-----------------|
66+
| p50 | 16.2 ms | 440 ms |
67+
| p95 | 17.9 ms | 950 ms |
68+
| p99 | 17.9 ms | 3,150 ms |
69+
70+
**What's measured:** Time from requesting an execution to first code running. Secure Exec spins up a V8 isolate inside the host process — no container, no VM, no network hop. Sandbox baseline: [e2b](https://www.computesdk.com/benchmarks/), the fastest provider on ComputeSDK as of March 18, 2026. Secure Exec numbers: median of 10,000 runs (100 iterations × 100 samples) on Intel i7-12700KF.
71+
72+
### Memory per instance
73+
74+
| Runtime | Memory |
75+
|--------------------------|-----------|
76+
| Secure Exec | ~3.4 MB |
77+
| Sandbox provider minimum | ~256 MB |
78+
79+
**75x smaller.** V8 isolates share the host process and its V8 engine. Each additional execution only adds its own heap and stack. On a 1 GB server, you can run ~210 concurrent Secure Exec executions vs. ~4 sandboxes.
80+
81+
### Cost per execution-second
82+
83+
| Hardware | Secure Exec | vs. cheapest sandbox ($0.000625/s) |
84+
|--------------|------------------|------------------------------------|
85+
| AWS ARM | $0.000011/s | 56x cheaper |
86+
| AWS x86 | $0.000014/s | 45x cheaper |
87+
| Hetzner ARM | $0.0000016/s | 380x cheaper |
88+
| Hetzner x86 | $0.0000027/s | 232x cheaper |
89+
90+
Each execution uses ~3.4 MB instead of a 256 MB container minimum, and you run on your own hardware. Sandbox baseline: Cloudflare Containers, billed at $0.0000025/GiB·s with 256 MB minimum.
91+
92+
## Secure Exec vs. Sandboxes
93+
94+
Same isolation guarantees, without the infrastructure overhead.
95+
96+
**Secure Exec:**
97+
- ✓ Native V8 performance
98+
- ✓ Granular deny-by-default permissions
99+
- ✓ Just npm install — no vendor account
100+
- ✓ No API keys to manage
101+
- ✓ Run on any cloud or hardware
102+
- ✓ No egress fees
103+
104+
**Sandbox:**
105+
- ✓ Native container performance
106+
- ✗ Coarse-grained permissions
107+
- ✗ Vendor account required
108+
- ✗ API keys to manage
109+
- ✗ Hardware lock-in
110+
- ✗ Per-GB egress fees
111+
112+
[Full comparison →](https://secure-exec.dev/docs/sandbox-vs-secure-exec)
113+
114+
## FAQ
115+
116+
<details>
117+
<summary>How does it work?</summary>
118+
119+
Secure Exec runs untrusted code inside [V8 isolates](https://v8.dev/docs/embed) — the same isolation primitive that powers every Chromium tab and Cloudflare Workers. Each execution gets its own heap, its own globals, and a deny-by-default permission boundary. There is no container, no VM, and no Docker daemon — just fast, lightweight isolation using battle-tested web technology. [Architecture →](https://secure-exec.dev/docs/sdk-overview)
120+
</details>
121+
122+
<details>
123+
<summary>Does this require Docker, nested virtualization, or a hypervisor?</summary>
124+
125+
No. Secure Exec is a pure npm package — `npm install secure-exec` is all you need. It has zero infrastructure dependencies: no Docker daemon, no hypervisor, no orchestrator, no sidecar. It runs anywhere Node.js or Bun runs.
126+
</details>
127+
128+
<details>
129+
<summary>Can it run in serverless environments?</summary>
130+
131+
We are actively validating serverless platforms, but Secure Exec should work everywhere that provides a standard Node.js-like runtime. This includes Vercel Fluid Compute, AWS Lambda, and Google Cloud Run. Cloudflare Workers is not supported because it does not expose the V8 APIs that Secure Exec relies on.
132+
</details>
133+
134+
<details>
135+
<summary>When should I use a sandbox vs. Secure Exec?</summary>
136+
137+
Use **Secure Exec** when you need fast, lightweight code execution — AI tool calls, code evaluation, user-submitted scripts — without provisioning infrastructure. Use a **sandbox** (e2b, Modal, Daytona) when you need a full operating-system environment with persistent disk, root access, or GPU passthrough. [Full comparison →](https://secure-exec.dev/docs/sandbox-vs-secure-exec)
138+
</details>
139+
140+
<details>
141+
<summary>Can I run npm install in Secure Exec to dynamically install modules?</summary>
142+
143+
Yes. Secure Exec supports dynamic module installation via npm inside the execution environment.
144+
</details>
145+
146+
<details>
147+
<summary>Can I use it to run dev servers like Express, Hono, or Next.js?</summary>
148+
149+
Yes. Secure Exec bridges Node.js APIs including http, net, and child_process, so frameworks like Express, Hono, and Next.js work out of the box.
150+
</details>
151+
152+
<details>
153+
<summary>Can it be used for long-running tasks?</summary>
154+
155+
Yes. For orchestrating stateful, long-running processes efficiently, we recommend pairing Secure Exec with [Rivet Actors](https://rivet.dev/docs/actors).
156+
</details>
157+
158+
<details>
159+
<summary>What are common use cases?</summary>
160+
161+
- AI agent code evaluation and tool use
162+
- User-facing dev servers (Express, Hono, Next.js)
163+
- MCP tool-code execution
164+
- Sandboxed plugin / extension systems
165+
- Interactive coding playgrounds
166+
</details>
167+
168+
<details>
169+
<summary>Does this have Node.js compatibility?</summary>
170+
171+
Yes. Most Node.js core modules work — including fs, child_process, http, dns, process, and os. These are bridged to real host capabilities, not stubbed. [Compatibility matrix →](https://secure-exec.dev/docs/node-compatability)
172+
</details>
173+
174+
<details>
175+
<summary>Does this have access to a full operating system?</summary>
176+
177+
Yes. Secure Exec includes a virtual kernel with a system bridge that supports a granular permission model. Filesystem, network, child processes, and environment variables are all available — gated behind deny-by-default permissions.
178+
</details>
179+
180+
<details>
181+
<summary>How does Secure Exec compare to WASM-based JavaScript runtimes like QuickJS?</summary>
182+
183+
WASM-based runtimes like [QuickJS](https://bellard.org/quickjs/) (via quickjs-emscripten) compile a separate JS engine to WebAssembly, which means your code runs through an interpreter inside WASM — not native V8. Secure Exec uses native V8 isolates directly, so you get the same JIT-compiled performance as JavaScript running on the host. No interpretation overhead, no WASM translation layer, and full Node.js API compatibility.
184+
</details>
185+
186+
## Links
187+
188+
- [Documentation](https://secure-exec.dev/docs)
189+
- [Changelog](https://github.com/rivet-dev/secure-exec/releases)
190+
- [Discord](https://rivet.dev/discord)
191+
- [GitHub](https://github.com/rivet-dev/secure-exec)
22192

23193
## License
24194

docs/cost-evaluation.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ description: "Cost-per-second comparison of Secure Exec on self-hosted hardware
55

66
{/* Figures generated by scripts/calculate-costs.js — rerun when updating pricing */}
77

8+
## Why it's cheaper
9+
10+
Secure Exec costs less per execution for two reasons:
11+
12+
- **Uses far less memory per execution.** Each V8 isolate adds ~3.4 MB to the host process. Sandbox providers allocate a full container with a minimum of 256 MB, even if the code inside uses a fraction of that. This means you fit ~75× more concurrent executions on the same hardware.
13+
- **Runs on your own hardware.** You choose your cloud, instance type, and region. Self-hosted servers (AWS, Hetzner, etc.) are significantly cheaper per compute-second than per-container sandbox billing, and you avoid egress fees and vendor lock-in.
14+
15+
All Secure Exec figures assume 70% utilization (30% idle capacity headroom) to account for real-world bin-packing inefficiency. Even with this conservative assumption, the cost advantage is substantial.
16+
817
## Methodology
918

1019
We compare the **cost per execution-second**: the cost of running one isolated execution for one second.

packages/website/src/components/Benchmarks.tsx

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function InfoTooltip({ children }: { children: React.ReactNode }) {
1616
>
1717
<path d="M8 0a8 8 0 100 16A8 8 0 008 0zm1 12H7V7h2v5zm-1-6a1 1 0 110-2 1 1 0 010 2z" />
1818
</svg>
19-
<span className="absolute bottom-full left-0 mb-2 w-72 p-3 rounded-lg bg-zinc-800/95 backdrop-blur-sm text-[11px] text-zinc-300 leading-relaxed shadow-xl border border-zinc-700/50 z-50 opacity-0 pointer-events-none group-hover/tip:opacity-100 group-hover/tip:pointer-events-auto transition-opacity duration-200 [&_a]:text-white [&_a]:underline [&_a]:underline-offset-2">
19+
<span className="absolute bottom-full left-0 mb-2 w-80 p-3 rounded-lg bg-zinc-800/95 backdrop-blur-sm text-[11px] text-zinc-300 leading-relaxed shadow-xl border border-zinc-700/50 z-50 opacity-0 pointer-events-none group-hover/tip:opacity-100 group-hover/tip:pointer-events-auto transition-opacity duration-200 [&_a]:text-white [&_a]:underline [&_a]:underline-offset-2 [&_strong]:text-zinc-200 [&_strong]:font-medium">
2020
{children}
2121
</span>
2222
</span>
@@ -41,12 +41,17 @@ function ColdStartChart() {
4141
<h4 className="text-sm font-medium text-white flex items-center">
4242
Cold start
4343
<InfoTooltip>
44-
Time to interactive (TTI). Sandbox values use the fastest provider — e2b (best median) from{" "}
45-
<a href="https://www.computesdk.com/benchmarks/" target="_blank" rel="noopener noreferrer">
46-
ComputeSDK
47-
</a>{" "}
48-
as of March 2026. Secure Exec measured over 100 iterations × 100 samples.{" "}
49-
<a href="/docs/benchmarks">Our benchmarks →</a>
44+
<strong>What's measured:</strong> Time from requesting an execution to first code running.
45+
<br /><br />
46+
<strong>Why the gap:</strong> Secure Exec spins up a V8 isolate inside the host process. No container, no VM, no network hop. Sandboxes must boot an entire container or microVM, allocate memory, and establish a network connection before code can run.
47+
<br /><br />
48+
<strong>Sandbox baseline:</strong> e2b, the fastest provider on{" "}
49+
<a href="https://www.computesdk.com/benchmarks/" target="_blank" rel="noopener noreferrer">ComputeSDK</a>
50+
{" "}as of March 18, 2026.
51+
<br /><br />
52+
<strong>Secure Exec:</strong> Median of 10,000 runs (100 iterations × 100 samples) on Intel i7-12700KF.
53+
<br /><br />
54+
<a href="/docs/benchmarks">Our benchmarks →</a>
5055
</InfoTooltip>
5156
</h4>
5257
<p className="text-[11px] text-zinc-600 italic mt-1">Lower is better</p>
@@ -202,8 +207,14 @@ function CostChart() {
202207
<h4 className="text-sm font-medium text-white flex items-center">
203208
Cost per execution-second
204209
<InfoTooltip>
205-
Sandbox value uses the cheapest provider — Cloudflare Containers (256 MB min, billed per second at $0.0000025/GiB·s) as of March 2026.
206-
Secure Exec: 3.4 MB baseline (p95) with 30% empty capacity assumed across self-hosted hardware tiers.{" "}
210+
<strong>What's measured:</strong> <code className="text-[10px] bg-white/10 px-1 py-0.5 rounded">server price per second ÷ concurrent executions per server</code>
211+
<br /><br />
212+
<strong>Why it's cheaper:</strong> Each execution uses ~3.4 MB instead of a 256 MB container minimum. And you run on your own hardware, which is significantly cheaper than per-second sandbox billing.
213+
<br /><br />
214+
<strong>Sandbox baseline:</strong> Cloudflare Containers, the cheapest sandbox provider benchmarked. Billed at $0.0000025/GiB·s with a 256 MB minimum (March 18, 2026).
215+
<br /><br />
216+
<strong>Secure Exec:</strong> 3.4 MB baseline per execution, assuming 70% utilization. Select a hardware tier above to compare.
217+
<br /><br />
207218
<a href="/docs/benchmarks">Our benchmarks →</a>
208219
{" · "}
209220
<a href="/docs/cost-evaluation">Full cost breakdown →</a>
@@ -294,7 +305,7 @@ export function Benchmarks() {
294305
transition={{ duration: 0.5, delay: 0.1 }}
295306
className="max-w-xl text-base leading-relaxed text-zinc-500"
296307
>
297-
V8 isolates vs. container-based sandboxes.
308+
V8 isolates vs. sandboxes.
298309
</motion.p>
299310
</div>
300311

@@ -316,8 +327,16 @@ export function Benchmarks() {
316327
label="Memory per instance"
317328
tooltip={
318329
<>
319-
Secure Exec memory is the converged at-scale average per execution.
320-
Sandbox value uses the smallest minimum among popular providers (e2b, Daytona, Modal, Cloudflare) as of March 2026 — 256 MB for Modal and Cloudflare.{" "}
330+
<strong>What's measured:</strong> Memory footprint added per concurrent execution.
331+
<br /><br />
332+
<strong>Why the gap:</strong> V8 isolates share the host process and its V8 engine. Each additional execution only adds its own heap and stack (~3.4 MB). Sandboxes allocate a dedicated container with a minimum memory reservation, even if the code inside uses far less.
333+
<br /><br />
334+
<strong>What this means:</strong> On a 1 GB server, you can run ~210 concurrent Secure Exec executions vs. ~4 sandboxes.
335+
<br /><br />
336+
<strong>Sandbox baseline:</strong> 256 MB, the smallest minimum among popular providers (Modal, Cloudflare Containers) as of March 18, 2026.
337+
<br /><br />
338+
<strong>Secure Exec:</strong> 3.4 MB, the converged average per execution under sustained load.
339+
<br /><br />
321340
<a href="/docs/benchmarks">Our benchmarks →</a>
322341
</>
323342
}
@@ -332,23 +351,6 @@ export function Benchmarks() {
332351
<CostChart />
333352
</motion.div>
334353

335-
<motion.p
336-
initial={{ opacity: 0 }}
337-
whileInView={{ opacity: 1 }}
338-
viewport={{ once: true }}
339-
transition={{ duration: 0.5, delay: 0.3 }}
340-
className="mt-4 text-xs text-zinc-600"
341-
>
342-
Sandbox provider numbers based on published documentation and benchmarks.
343-
Secure Exec measured on Intel i7-12700KF, Node.js v24.{" "}
344-
<a href="/docs/benchmarks" className="underline underline-offset-2 hover:text-zinc-500">
345-
Methodology →
346-
</a>
347-
{" · "}
348-
<a href="/docs/cost-evaluation" className="underline underline-offset-2 hover:text-zinc-500">
349-
Cost breakdown →
350-
</a>
351-
</motion.p>
352354
</div>
353355
</section>
354356
);

0 commit comments

Comments
 (0)