Skip to content

Commit ac1f659

Browse files
NathanFlurryclaude
andcommitted
docs: add architecture section to Node.js compatibility page
Explains the virtual kernel architecture: all I/O routes through VFS, network stack, process table, and permissions engine. Clarifies that HTTP server loopback routes through the kernel without real TCP, VFS is not the host filesystem, and embedders provide host adapters. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 99a97f4 commit ac1f659

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

docs/nodejs-compatibility.mdx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,41 @@ icon: "list-check"
1010

1111
`22.x` (derived from the `@types/node` `22.x` validation baseline used by tests and type checks).
1212

13+
## Architecture
14+
15+
secure-exec runs Node.js code inside a V8 isolate with a **virtual kernel** that mediates all system access. Nothing in the sandbox touches the host OS directly:
16+
17+
```
18+
┌─────────────────────────────────────────────────┐
19+
│ Sandbox (V8 Isolate) │
20+
│ │
21+
│ User Code (require, fs, http, etc.) │
22+
│ │ │
23+
│ ▼ │
24+
│ Bridge Layer (polyfills + bridge modules) │
25+
│ │ │
26+
│ ▼ │
27+
│ Virtual Kernel │
28+
│ ├── VFS (virtual file system) │
29+
│ ├── Process table (spawn, signals, exit) │
30+
│ ├── Network stack (TCP, HTTP, DNS, UDP) │
31+
│ └── Permissions engine (deny-by-default) │
32+
│ │ │
33+
│ ▼ │
34+
│ Host Adapters (embedder-provided) │
35+
└─────────────────────────────────────────────────┘
36+
37+
38+
Host OS (file system, network, etc.)
39+
```
40+
41+
**Key points:**
42+
43+
- **All I/O routes through the virtual kernel.** `fs.readFile()` goes through the VFS, `http.request()` goes through the network stack, `child_process.spawn()` goes through the process table. The kernel enforces permissions at every boundary.
44+
- **Network calls are kernel-mediated.** `http.createServer()` registers a virtual listener in the kernel's network stack. `http.request()` to localhost routes through the kernel without touching real TCP — the kernel connects the virtual server to the virtual client directly. External requests go through the host adapter after permission checks.
45+
- **The VFS is not the host file system.** Files written by sandbox code live in the VFS (in-memory by default). The host file system is accessible only through explicit read-only overlays (e.g., `node_modules`) configured by the embedder.
46+
- **Embedders provide host adapters** that implement the actual I/O. A Node.js embedder provides real `fs` and `net`; a browser embedder provides `fetch`-based networking and no file system. The sandbox code doesn't know or care which adapter backs the kernel.
47+
1348
## Support Tiers
1449

1550
| Icon | Tier | Label | Meaning |

0 commit comments

Comments
 (0)