The Slice (Nexus-JS) Developer Handbook (v0.15.0)
Welcome to the complete developer handbook for Slice (Nexus-JS) (v0.15.0) - a microVM-grade JavaScript and TypeScript runtime, compiler, HTTP server, and AI sandbox engineered in Rust.
Whether you are building a high-throughput full-stack web service, packaging a CLI tool into a single zero-dependency executable, running 1,000 untrusted customer plugins on a single machine, or executing LLM-generated TypeScript inside an AI coding agent, this handbook walks you through every feature, CLI command, API, security capability, and migration pattern from the perspective of an application developer.
Why Developers Choose Slice
Section titled “Why Developers Choose Slice”Traditional JavaScript runtimes (Node.js, Deno, and Bun) were built around a single-tenant process model with ambient POSIX permissions and runtime node_modules filesystem traversal:
- Every cold start pays for hundreds of OS
stat()/open()syscalls and JavaScript parsing. - Every imported npm package or plugin shares the same mutable
Object.prototypeand can read~/.ssh, query cloud metadata (169.254.169.254), or exfiltrateprocess.envsecrets unless you wrap the entire runtime inside heavy Docker containers or125 msFirecracker VMs.
Slice replaces that tradeoff with four developer-facing superpowers:
- Instant Cold Starts & Precompiled
SLICEBC\x01Packaging (~1 usP50 Isolate /0stat()Syscalls):- Run
.ts,.js, or entire project folders directly (slice run), pack them into a 64-byte aligned BLAKE3.casarchive with ahead-of-time Precompiled BoaCodeBlock(SLICEBC\x01) bytecode (slice pack), or compile your backend + frontend UI into a single zero-dependency native executable (slice compile). Seetests/reports/latest.mdfor live cold-start and--warmbenchmarks across all 33 real-world workloads against Bun, Deno, and Node.js.
- Run
- True Multi-Tenant MicroVM Security in Microseconds:
- Every script or HTTP request executes inside a frozen Secure ECMAScript (
SES) compartment with explicit Object-Capability (OCap) permissions (allow_read,allow_write,allow_net,allow_exec,allow_env), deterministic CPU instruction fuel limits, byte-level memory cages, a built-in Cloud Metadata SSRF Firewall, and Outbound Egress DLP that blocks raw, Base64, and Base64URL secret leaks.
- Every script or HTTP request executes inside a frozen Secure ECMAScript (
- Full-Stack Web & Edge Server Out of the Box (
slice serve):- Write standard WinterTC / Cloudflare Workers / Bun / Deno
export default { fetch(req, env, ctx) }handlers (Request,Response,Headers,URL,URLSearchParams,URLPattern,ReadableStream,CompressionStream,Intl), stream Server-Sent Events (Response.sse), use the built-in 16-way shardedSlice.kvstore, serve static frontend assets (--static=./public) with< 2 usBLAKE3ETag304responses, and hot-swap tenant bundles (--tenant-dir) with zero downtime. Seetests/reports/latest.mdfor verified HTTP/1.1 Keep-Alive throughput benchmarks.
- Write standard WinterTC / Cloudflare Workers / Bun / Deno
- Unified Configuration & AI Agent Primitives:
- Configure every engine, limit, OCap permission, and server setting declaratively across
slice.toml, top-of-file inline directives (// @slice-...),SLICE_*environment variables, and CLI flags (--*). - Run unit tests with
slice test, where everytest()block automatically snapshots (Slice.checkpoint()) and rolls back (Slice.restore()) both the filesystem (node:fs) andSlice.kvin< 5 us. - Spawn nested, capability-attenuated sub-sandboxes in tens of microseconds with
Slice.evalSandbox()or connect Claude Code / Cursor directly toslice mcp.
- Configure every engine, limit, OCap permission, and server setting declaratively across
How This Handbook Is Organized
Section titled “How This Handbook Is Organized”| Chapter | Title & Developer Focus |
|---|---|
| Chapter 01 | Installation, Upgrading, Quickstart, slice.toml & Complete CLI ReferenceInstall and update Slice on Windows, Linux, macOS, and Docker; scaffold projects with slice init (including --template=sveltekit); master slice.toml, .env Auto-DLP, < 3 ms --watch, slice check, slice repl, slice doctor, and all 14 CLI commands. |
| Chapter 02 | Writing TypeScript & JavaScript for Maximum Performance Understand how Slice runs your code across Tier-0 Snapshots, Tier-1 Warm Realms ( --warm), and Tier-2 Native SIMD Kernels - and how simple TypeScript type annotations (: number, interface) unlock automatic compile-time speedups. |
| Chapter 03 | Bundling Apps (slice pack), Single-File Executables (slice compile) & Bytecode InspectionBundle multi-file TypeScript apps and node_modules into .cas archives, embed frontend static assets (--static), ship standalone native binaries (SLICEEXE), and inspect bundles with slice inspect. |
| Chapter 04 | Zero-Trust Security Guide: OCap Permissions, Fuel Limits, SSRF Shield & Egress DLP Configure allow_read, allow_write, allow_net, allow_exec, and allow_env; cap CPU fuel and memory per tenant; prevent 169.254.169.254 SSRF attacks; and block accidental or malicious secret leaks with --audit-egress and Auto-DLP .env. |
| Chapter 05 | Building Full-Stack Web Apps, APIs, Static Sites & SSE Streams (slice serve)Build production HTTP services with export default { fetch }, Request/Response/URL/Headers, Slice.kv rate limiters and sessions, --static CDN asset serving, Response.sse streaming, outbound fetch(), and --tenant-dir hot-swapping. |
| Chapter 06 | AI Agents, Nested MicroVM Sandboxes (Slice.evalSandbox), < 5 us Checkpoints & slice mcpExecute untrusted LLM or user plugin code safely in microseconds, branch and roll back VFS + KV state with Slice.checkpoint() / Slice.restore(), and integrate slice mcp with Claude Code and Cursor. |
| Chapter 07 | Node.js Compatibility (node:*), NPM Packages & Migration Guide (Node / Bun / Deno to Slice)Complete API reference for node:fs, node:crypto, node:stream, node:http, node:async_hooks, node:zlib, node:worker_threads, node:string_decoder, node:child_process, node:net, node:dgram, node:path, node:buffer, node:url, node:util, node:process, and node:test, plus npm recipes and migration guides from Express/Fastify, Hono, SvelteKit, Bun, and Deno. |
| Chapter 08 | Embedding Slice in Rust Applications & High-Density MicroVM Swarms Embed slice-engine, slice-cas, slice-sandbox, and slice-io as a library inside your own Rust services to run thousands of isolated tenant scripts in a single process. |
| Chapter 09 | Time-Travel Testing (slice test), Deterministic Replay & Production BenchmarksWrite rock-solid unit and security tests with slice test (expect(...).toViolate(), .toStayWithinFuel(), < 5 us VFS+KV rollbacks), replay bugs with --deterministic, and explore all 33 real-world benchmark applications, frameworks, and case studies. |
| Compatibility Matrix | WinterTC, Node.js (node:*), Buffer & NPM Bundler Compatibility MatrixComplete reference of supported WinterTC Web APIs, Uint8Array-backed Buffer methods, node:* core modules, and package.json "exports" bundler capabilities. |
Choose Your Path: Common Developer Workflows
Section titled “Choose Your Path: Common Developer Workflows”1. “I want to build and ship a Full-Stack Web App or REST/GraphQL API”
Section titled “1. “I want to build and ship a Full-Stack Web App or REST/GraphQL API””- Scaffold a project:
slice init my-web-api(orslice init my-app --template=sveltekit) (Chapter 01) - Write a standard
export default { fetch(req, env, ctx) }handler usingRequest,Response.json(),URL, andSlice.kv(Chapter 05) - Attach your frontend build folder with
--static=./publicand compile everything into a single binary:(Chapter 03)Terminal window slice compile . -o ./my-web-api --static=./public
2. “I want to run untrusted customer plugins or AI-generated code safely”
Section titled “2. “I want to run untrusted customer plugins or AI-generated code safely””- Use
Slice.evalSandbox(untrustedTsCode, { fuel: 250_000, memoryBytes: 1048576, allowRead: ["/tmp/tenant-1"] })inside TypeScript (Chapter 06) - Take a
< 5 ussnapshot before running candidate code (const snap = Slice.checkpoint()) and roll back (Slice.restore(snap)) if the code fails or violates policy (Chapter 06) - Or wire
slice mcpdirectly into your MCP client (mcp.json) so your AI coding assistant can evaluate TypeScript and manage state snapshots overstdio(Chapter 06)
3. “I want to migrate an existing Node.js, Bun, or Deno project to Slice”
Section titled “3. “I want to migrate an existing Node.js, Bun, or Deno project to Slice””- Point
slice runorslice testdirectly at your existing project folder (package.json+src/index.ts+node_modules/) (Chapter 07) - Add a
slice.tomlmanifest withenv_file = ".env"and explicitallow_read,allow_write, andallow_netrules so your app is protected by default against SSRF and secret exfiltration (Chapter 04) - Convert tests to
slice test(import { describe, test, expect } from "slice:test") to get automatic< 5 usfilesystem and KV rollback after every test (Chapter 09)
Documentation Index, Developer Guides (docs/guides/) & System Architecture (docs/system/)
Section titled “Documentation Index, Developer Guides (docs/guides/) & System Architecture (docs/system/)”- Top-Level Documentation Index:
docs/README.md - Developer How-To Guides (
docs/guides/): - Core Maintainer & Internal Architecture Specs (
docs/system/):docs/system/00_index.mddocs/system/01_cas_bundler_and_oxc_compiler.mddocs/system/02_tiered_execution_and_boa_vm.mddocs/system/03_security_sandbox_ocap_and_mpk.mddocs/system/04_networking_wintertc_and_event_loop.mddocs/system/05_wasm_workers_and_kernel_io.mddocs/system/06_edge_kv_ai_sandbox_and_mcp.mdvendor/boa_engine/SLICE_PATCH.md(SLICEBC1PrecompiledCodeBlockVendor Patch Specification)
- Docker Application, Framework & Case Study Test Suites (
tests/):tests/reports/latest.md(Latest Verified 33-Workload Benchmark Report)tests/README.md(tests/apps/- 24 Production Apps)tests/frameworks/README.md(tests/frameworks/- Hono v4, itty-router + UnJS, Express/Polka, & SvelteKit 3 + Svelte 5)tests/case_studies/README.md(tests/case_studies/- 5 Architectural Differentiation Workloads)