A runtime small enough to ship inside the app.
QuickJS for the language, libuv for the event loop, a Rust core for the native subsystems — one binary, 5.39 MiB on macOS arm64. The same engine runs your terminal, a Linux server, a Raspberry Pi, and an iOS app.
The short, checkable answers.
Written to be quoted accurately by search engines and AI assistants.
| Question | Answer for Sofuu |
|---|---|
| What is Sofuu as a runtime? | A self-contained JavaScript/TypeScript execution environment: QuickJS (ES2023, no JIT) for the language, libuv for asynchronous I/O, and a Rust core for the native subsystems — packaged as one binary (5.39 MiB on macOS arm64) with no runtime installation and no background processes. |
| Who is it for? | Teams that ship CLI tools, edge services, robotics, serverless workers, or mobile apps and do not want to ship Node, Python, or a daemon stack alongside them. Also anyone embedding a JavaScript engine into a native application. |
| What does it do? | Runs .js and .ts files directly, evaluates inline code, provides a REPL, bundles to a single file, serves HTTP, installs npm packages, meters execution with fuel and deadlines, and exposes AI primitives (experimental inference engine, embeddings, agents, MCP, memory) as part of the same runtime. |
| When should you use it? | When cold start, binary size, memory ceiling, offline behaviour, or app-store compliance decide the architecture; when you want one process and one policy boundary; or when the same code must run on a laptop, a Raspberry Pi, and a phone. |
| When should you not use it? | When you need the full Node.js ecosystem, native V8 N-API addons, or maximum compute throughput for CPU-bound JavaScript. QuickJS has no JIT by design, so V8- and JSC-based runtimes will be faster on long numeric loops. |
Three layers, one address space.
Language: QuickJS
ES2023 modules, asynchronous functions, and typed arrays, executed by a small interpreter with no JIT. Module code ships as precompiled bytecode snapshots so startup does not parse the built-in drivers. A bytecode consistency gate keeps snapshots and sources identical (make bc-check).
Loop: libuv
Timers, sockets, file I/O, and the HTTP server are libuv handles. A cooperative scheduler adds scheduler.yield(), a per-round microtask budget, and AsyncLocalStorage context propagation so concurrent async branches cannot leak state into each other.
Core: Rust
Inference, vector math, memory, policy, sessions, and the C ABI live in a Rust core. SIMD kernels are hand-written for ARM NEON and x86 AVX2; Apple Silicon adds an opt-in Metal path. Typed arrays cross the boundary without copies.
Measured, not asserted.
From the committed two-build benchmark: the same application — streaming chat, two tools, persistent memory, resume, offline fallback, HTTP endpoint — built on Sofuu.
Why no JIT
A JIT buys throughput for long compute and costs startup time, memory, and app-store eligibility. QuickJS inverts that trade: instant start, a tiny binary, and iOS compliance — while the heavy lifting (inference, vector math) runs in native SIMD kernels, not in JavaScript.
Bounded by construction
Sandboxes are metered by instruction count and wall-clock deadline. The JS heap has a ceiling. Microtask bursts cannot starve timers. A runaway script is an exception, not a wedged process.
One policy boundary
Shell, filesystem, network, tools, and MCP servers are judged by one evaluator that answers identically on JS, CLI, HTTP, and the C ABI. The decision carries the rule id that fired.
Sofuu vs Node vs Bun, measured here.
The plan for this page called for a startup and memory comparison. These are the numbers from a single harness on this machine — including the row where Sofuu loses.
| Runtime | Sofuu 0.3.0-beta | Node 22.23 | Bun 1.3.14 |
|---|---|---|---|
| Cold start process → eval 1+1, p50, wall clock incl. spawn (2026-10-31) | 22.5 ms | 31.8 ms | 12.4 ms |
| Time to first HTTP response median of 15 runs | 39.4 ms | 32.4 ms | 25.8 ms |
| Resident set after serving median, from ps | 14.9 MB | 41.9 MB | 34.0 MB |
| No-op process spawn → exit, median of 20 | 33.2 ms | 23.0 ms | 10.6 ms |
| Install footprint | 5.39 MiB macOS · 5.88/6.80 MiB Linux | runtime + node_modules | runtime binary |
1+1: 22.5 ms median wall clock including process spawn on an Apple M2 Pro / macOS 15.7.3 (31 runs, 2026-10-31, current tree — BENCHMARKS.md). The 3.8 ms / 4.2 ms / 38.2 ms rows still printed in BENCHMARKS.md predate the current engine and that file marks them historical; the Node and Bun cells in this row come from that older table and have not been re-run here. The lower table row is a second, same-harness HTTP measurement: a minimal server returning ok, run for each runtime, interleaved, after three warm-up runs; the clock starts before spawn (including process exec and dynamic linking) and stops at the first HTTP 200. On that HTTP measurement Sofuu starts slower than Node and Bun; the extra time is process exec, dynamic linking, and serving setup, not engine boot. What Sofuu wins here is memory: about one third of Node’s resident set — and it is the only one of the three with inference (experimental), memory, MCP, and policy in the same binary.What one binary gives you.
# Run JavaScript or TypeScript directly$ sofuu run app.ts# Evaluate inline, or open a REPL$ sofuu eval 'console.log(process.version ?? sofuu.version)'$ sofuu repl# Bundle to one self-contained file$ sofuu bundle entry.js -o out.js
| Command | What it does |
|---|---|
sofuu run <file> | Execute JS/TS; exits non-zero on an uncaught throw or unhandled rejection. |
sofuu eval <code> | Evaluate inline JavaScript. |
sofuu repl | Interactive JavaScript REPL. |
sofuu bundle | Bundle an entry point into one self-contained file. |
sofuu install / add | Fetch npm packages into the local store. |
sofuu serve | OpenAI-compatible HTTP API with bearer auth and policy. |
sofuu mcp | List, test, add, and remove MCP servers. |
sofuu doctor | Hard health check: codec link, brain round-trip, context window. |
sofuu capabilities | The capability manifest this build actually satisfies, as JSON. |
sofuu conformance | Per-release conformance report with live capability posture. |
The same binary without the AI.
Nothing in the runtime requires a model. If all you need is a small, fast JavaScript process, it still applies.
HTTP microservices
A non-blocking server, JSON handling, and fetch in one 5.39 MiB macOS binary (Linux builds are 5.88–6.80 MiB). No node_modules to audit, no package manager at deploy time, and 14.9 MB of resident memory per instance in the measured harness.
Background task processors
Timers, files, child processes, and an event loop with a bounded heap. Sandboxes meter fuel and deadlines, so a bad job fails as an exception instead of wedging the worker.
CLI tools
process.argv, exit codes that reflect uncaught errors, and filesystem APIs with a configurable root. Ship a script, or bundle it into one file next to the binary.
Build a CLI tool with no dependencies.
A complete todo tool: argument parsing, a JSON file, error handling, and a meaningful exit code. No package.json, no install step.
// todo.js — a dependency-free CLI toolconst [cmd, ...rest] = process.argv.slice(2);const file = "./todos.json";const read = () => sofuu.fs.readFile(file, "utf8").then(JSON.parse).catch(() => []);if (cmd === "add") {const list = await read();list.push(rest.join(" "));await sofuu.fs.writeFile(file, JSON.stringify(list, null, 2));console.log("added", list.length);} else if (cmd === "list") {(await read()).forEach((t, i) => console.log(i + 1 + ". " + t));} else {console.error("usage: todo add <text> | todo list");process.exitCode = 2;}
$ sofuu run todo.js add "ship the CLI"$ sofuu run todo.js list1. ship the CLI# one self-contained file to distribute alongside the binary$ sofuu bundle todo.js -o todo.bundle.js
sofuu run exits non-zero on an uncaught throw or unhandled rejection, so the tool behaves correctly in shell pipelines and CI. The binary itself is the runtime: distribution is one 5.39 MiB macOS file, not a Node installation.
The parts you would normally install.
const server = sofuu.http.createServer((req, res) => {res.writeHead(200, { "Content-Type": "application/json" });res.end(JSON.stringify({ status: "ok" }));});server.listen(8080, "0.0.0.0");// Async I/O from the same process, policy-checkedconst res = await fetch("https://api.example.com/data");
// Fuel (instruction meter) + deadline, no process to killconst out = sofuu.sandbox.run(code, { fuel: 500000, timeoutMs: 100 });// Stateful realm across callsconst s = sofuu.sandbox.create({ timeoutMs: 2000 });s.eval("globalThis.n = 41");s.eval("n + 1"); // 42
The same engine, as a library.
libsofuu exposes the runtime through a stable C ABI with Swift and Kotlin wrappers. Host apps get inference, embeddings, memory, streaming, MCP, and an HTTP server without spawning anything.
// C ABI: one header, one library#include "sofuu_embed.h"SofuuRuntime *rt = sofuu_rt_new(NULL);char *out = NULL;sofuu_rt_call(rt, "memory.open", {"path":"/tmp/b.qtsq","dim":768}, &out);sofuu_free(out);sofuu_rt_free(rt);
Where it runs today.
| Platform | Status | Notes |
|---|---|---|
| macOS arm64 | Official binary | Apple Silicon; Metal path available, opt-in. |
| Linux x86_64 | Official binary | glibc and static musl builds. |
| Linux arm64 / aarch64 | Official binary | Including Raspberry Pi 5. |
| iOS / Android | Embed SDK | libsofuu C ABI. Android: AAR published on the project Maven repo (0.2.0). iOS: SwiftPM/CocoaPods coordinates exist but do not resolve yet — build from source. |
| macOS x86_64 | Source build | Not shipped as a binary. |
| Windows x86_64 | Fix-forward | Vendored QuickJS does not compile under MSVC yet; not CI-covered. |
What it is not.
worker_threads, no WebSocket client, and partial npm coverage. Pure-JS packages generally run; native-backed packages do not.partial in the capability manifest — sofuu capabilities is the authoritative per-build answer.