Skip to content

Commit 2c2b3f5

Browse files
committed
chore: docs
1 parent 7ed38b2 commit 2c2b3f5

49 files changed

Lines changed: 1134 additions & 325 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/media/sb-logo.svg

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/media/secure-exec-logo.png

Lines changed: 3 additions & 0 deletions
Loading

CLAUDE.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Brand
22

3-
- accent color: #CC0000 (red), light variant: #FF3333
3+
- primary accent color: #38BDF8 (bright sky blue), light variant: #7DD3FC
4+
- secondary accent color: #CC0000 (red), light variant: #FF3333
45
- website: https://secureexec.dev
56
- docs: https://secureexec.dev/docs
67
- GitHub: https://github.com/rivet-dev/secure-exec
@@ -24,6 +25,8 @@
2425

2526
## WASM Binary
2627

28+
- WasmVM and Python are experimental surfaces in this repo
29+
- all docs for WasmVM, Python, or other experimental runtime features must live under the `Experimental` section of the docs navigation, not the main getting-started/reference sections
2730
- the WasmVM runtime requires a WASM binary at `wasmvm/target/wasm32-wasip1/release/multicall.wasm`
2831
- build it locally: `cd wasmvm && make wasm` (requires Rust nightly + wasm32-wasip1 target + rust-src component + wasm-opt/binaryen)
2932
- the Rust toolchain is pinned in `wasmvm/rust-toolchain.toml` — rustup will auto-install it
@@ -84,6 +87,7 @@ Follow the style in `packages/secure-exec/src/index.ts`.
8487

8588
## Documentation
8689

90+
- WasmVM and Python docs are experimental docs and must stay grouped under the `Experimental` section in `docs/docs.json`
8791
- docs pages that must stay current with API changes:
8892
- `docs/quickstart.mdx` — update when core setup flow changes
8993
- `docs/api-reference.mdx` — update when any public export signature changes

README.md

Lines changed: 70 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
1-
# Secure Exec
1+
<p align="center">
2+
<img src=".github/media/secure-exec-logo.png" alt="Secure Exec" height="200" />
3+
</p>
24

3-
**Secure Node.js Execution Without a Sandbox**
5+
<h3 align="center">Secure Node.js Execution Without a Sandbox</h3>
46

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.
7+
<p align="center">
8+
A lightweight library for secure Node.js execution.<br />
9+
No containers, no VMs — just npm-compatible sandboxing out of the box.<br />
10+
Powered by the same tech as Cloudflare Workers.
11+
</p>
12+
13+
<p align="center">
14+
<a href="https://secureexec.dev/docs">Documentation</a> — <a href="https://secureexec.dev/docs/api-reference">API Reference</a> — <a href="https://rivet.dev/discord">Discord</a>
15+
</p>
616

717
```
818
npm install secure-exec
919
```
1020

11-
## Give your AI agent secure code execution
21+
## Example: AI agent with secure code execution
1222

13-
Expose secure-exec as a tool with the Vercel AI SDK. Your agent can execute arbitrary code without risking your infrastructure.
23+
Give your agent the ability to write and run code safely. This example uses the Vercel AI SDK, but secure-exec works with any tool-use framework.
1424

1525
```typescript
1626
import { generateText, stepCountIs, tool } from "ai";
@@ -51,7 +61,7 @@ console.log(text);
5161
Give your AI agent the ability to write and run code safely.
5262

5363
- **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.
54-
- **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)
64+
- **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://secureexec.dev/docs/node-compatability)
5565
- **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.
5666
- **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.
5767
- **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.
@@ -69,7 +79,19 @@ V8 isolates vs. sandboxes.
6979
| p95 | 17.9 ms | 950 ms |
7080
| p99 | 17.9 ms | 3,150 ms |
7181

72-
**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.
82+
<details>
83+
<summary>Methodology</summary>
84+
85+
**What's measured:** Time from requesting an execution to first code running.
86+
87+
**Why the gap:** 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.
88+
89+
**Sandbox baseline:** [e2b](https://www.computesdk.com/benchmarks/), the fastest provider on ComputeSDK as of March 18, 2026.
90+
91+
**Secure Exec:** Median of 10,000 runs (100 iterations × 100 samples) on Intel i7-12700KF.
92+
93+
[Our benchmarks →](https://secureexec.dev/docs/benchmarks)
94+
</details>
7395

7496
### Memory per instance
7597

@@ -78,7 +100,21 @@ V8 isolates vs. sandboxes.
78100
| Secure Exec | ~3.4 MB |
79101
| Sandbox provider minimum | ~256 MB |
80102

81-
**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.
103+
<details>
104+
<summary>Methodology</summary>
105+
106+
**What's measured:** Memory footprint added per concurrent execution.
107+
108+
**Why the gap:** 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.
109+
110+
**What this means:** On a 1 GB server, you can run ~210 concurrent Secure Exec executions vs. ~4 sandboxes.
111+
112+
**Sandbox baseline:** 256 MB, the smallest minimum among popular providers (Modal, Cloudflare Containers) as of March 18, 2026.
113+
114+
**Secure Exec:** 3.4 MB, the converged average per execution under sustained load.
115+
116+
[Our benchmarks →](https://secureexec.dev/docs/benchmarks)
117+
</details>
82118

83119
### Cost per execution-second
84120

@@ -89,36 +125,41 @@ V8 isolates vs. sandboxes.
89125
| Hetzner ARM | $0.0000016/s | 380x cheaper |
90126
| Hetzner x86 | $0.0000027/s | 232x cheaper |
91127

92-
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.
128+
<details>
129+
<summary>Methodology</summary>
130+
131+
**What's measured:** `server price per second ÷ concurrent executions per server`
132+
133+
**Why it's cheaper:** 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.
134+
135+
**Sandbox baseline:** Cloudflare Containers, the cheapest sandbox provider benchmarked. Billed at $0.0000025/GiB·s with a 256 MB minimum (March 18, 2026).
136+
137+
**Secure Exec:** 3.4 MB baseline per execution, assuming 70% utilization.
138+
139+
[Our benchmarks →](https://secureexec.dev/docs/benchmarks) · [Full cost breakdown →](https://secureexec.dev/docs/cost-evaluation)
140+
</details>
93141

94142
## Secure Exec vs. Sandboxes
95143

96144
Same isolation guarantees, without the infrastructure overhead.
97145

98-
**Secure Exec:**
99-
- ✓ Native V8 performance
100-
- ✓ Granular deny-by-default permissions
101-
- ✓ Just npm install — no vendor account
102-
- ✓ No API keys to manage
103-
- ✓ Run on any cloud or hardware
104-
- ✓ No egress fees
105-
106-
**Sandbox:**
107-
- ✓ Native container performance
108-
- ✗ Coarse-grained permissions
109-
- ✗ Vendor account required
110-
- ✗ API keys to manage
111-
- ✗ Hardware lock-in
112-
- ✗ Per-GB egress fees
146+
| | Secure Exec | Sandbox |
147+
|----------------------|------------------------------------------|------------------------------|
148+
| **Performance** | ✅ Native V8 | ✅ Native container |
149+
| **Permissions** | ✅ Granular deny-by-default | ❌ Coarse-grained |
150+
| **Setup** | ✅ Just `npm install` — no vendor account | ❌ Vendor account required |
151+
| **API keys** | ✅ None | ❌ Required |
152+
| **Infrastructure** | ✅ Run on any cloud or hardware | ❌ Hardware lock-in |
153+
| **Egress** | ✅ No egress fees | ❌ Per-GB egress fees |
113154

114-
[Full comparison →](https://secure-exec.dev/docs/sandbox-vs-secure-exec)
155+
[Full comparison →](https://secureexec.dev/docs/comparison/sandbox)
115156

116157
## FAQ
117158

118159
<details>
119160
<summary>How does it work?</summary>
120161

121-
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)
162+
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://secureexec.dev/docs/sdk-overview)
122163
</details>
123164

124165
<details>
@@ -136,7 +177,7 @@ We are actively validating serverless platforms, but Secure Exec should work eve
136177
<details>
137178
<summary>When should I use a sandbox vs. Secure Exec?</summary>
138179

139-
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)
180+
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://secureexec.dev/docs/comparison/sandbox)
140181
</details>
141182

142183
<details>
@@ -170,7 +211,7 @@ Yes. For orchestrating stateful, long-running processes efficiently, we recommen
170211
<details>
171212
<summary>Does this have Node.js compatibility?</summary>
172213

173-
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)
214+
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://secureexec.dev/docs/node-compatability)
174215
</details>
175216

176217
<details>
@@ -187,7 +228,7 @@ WASM-based runtimes like [QuickJS](https://bellard.org/quickjs/) (via quickjs-em
187228

188229
## Links
189230

190-
- [Documentation](https://secure-exec.dev/docs)
231+
- [Documentation](https://secureexec.dev/docs)
191232
- [Changelog](https://github.com/rivet-dev/secure-exec/releases)
192233
- [Discord](https://rivet.dev/discord)
193234
- [GitHub](https://github.com/rivet-dev/secure-exec)

docs/api-reference.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: API Reference
33
description: Complete reference for all secure-exec exports.
4-
icon: "rectangle-code"
54
---
65

76
## Package Structure

docs/architecture.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
title: Architecture
33
description: How secure-exec components fit together across runtimes and environments.
4-
icon: "sitemap"
54
---
65

76
## Overview

docs/benchmarks.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Sandbox provider comparison uses the **minimum allocatable memory** across popul
117117

118118
### Cost Per Second
119119

120-
See the [cost evaluation](/docs/cost-evaluation) for full methodology and multi-provider comparison.
120+
See the [cost evaluation](/cost-evaluation) for full methodology and multi-provider comparison.
121121

122122
## Test Environment
123123

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
title: Cloudflare Workers Comparison
2+
title: Secure Exec vs Cloudflare Workers
3+
sidebarTitle: Cloudflare Workers
34
description: Node.js API compatibility comparison between secure-exec and Cloudflare Workers (standard, Workers for Platforms, dynamic dispatch).
45
icon: "scale-balanced"
56
---
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
2-
title: "Sandbox vs. Secure Exec"
2+
title: "Secure Exec vs Sandbox"
3+
sidebarTitle: Sandbox
34
description: "When to use a container sandbox vs. Secure Exec for code execution"
5+
icon: "scale-balanced"
46
---
57

68
## How They Work
@@ -43,4 +45,4 @@ description: "When to use a container sandbox vs. Secure Exec for code execution
4345

4446
## Cost
4547

46-
See [Cost Evaluation](/docs/cost-evaluation) for detailed per-second cost comparison across providers.
48+
See [Cost Evaluation](/cost-evaluation) for detailed per-second cost comparison across providers.

0 commit comments

Comments
 (0)