JavaScript Runtimes
Date: 2026-10-29
The language is the same everywhere; the runtime decides what it can touch. An engine runs the code, the runtime wraps it in APIs — files, network, timers — and an event loop. Node, Deno, Bun, Cloudflare Workers and the browser are five answers to “what does JavaScript get to do here”.
A JavaScript runtime is the program that hosts a JavaScript engine and gives the code everything the language itself doesn’t have: I/O, a module loader, timers, an event loop, a way to start. The language spec (ECMAScript) defines Array, Promise, class and JSON — it has no concept of a file, a socket or even console.log. Every one of those comes from the runtime.
vs the browser: the browser is a runtime too. Chrome and Node share the same engine (V8); what differs is the API surface — document and window in one, fs and process in the other. That’s why “JavaScript” code that touches the DOM can’t run on a server, and code that reads files can’t run in a tab.
The layers
YOUR CODE
LANGUAGE Array · Promise · JSON · class identical in every runtime
ENGINE V8 · JavaScriptCore · SpiderMonkey parses, compiles, runs — no I/O
RUNTIME APIs fs · process · http ← Node's own
fetch · Request · Response · URL ← web standards, increasingly everywhere
Deno.* · Bun.* · env bindings ← each runtime's extras
EVENT LOOP + I/O libuv (Node) · Tokio (Deno) · own (Bun) waits on the OS, queues callbacks
HOST browser tab · server process · edge isolate
What to notice: only the top two layers are “JavaScript”. Everything that makes a runtime fast, safe or compatible lives in the bottom three — which is why runtimes built on the same engine still differ. The single thread and callback queue are the same model in all of them — The Event Loop.
The runtimes you’ll meet
| Node | Deno | Bun | Cloudflare Workers | |
|---|---|---|---|---|
| Engine | V8 | V8 | JavaScriptCore (Safari’s) | V8 |
| Written in | C++ | Rust | Zig | C++ (workerd) |
| Built around | Its own APIs, then npm | Web standards, permissions | Speed, and replacing the toolchain | Isolates at the edge |
| Runs TypeScript | Strips erasable types | Yes | Yes | After a build step |
| Package manager | Separate (npm, pnpm…) | Built in, reads npm | Built in, reads package.json | None — you bundle |
| Filesystem | Yes | Yes, if permitted | Yes | No |
| Runs Node code | — | Mostly, via node: and npm: | Aims for drop-in | Partly, behind a compatibility flag |
- Node — the default, and the reason npm exists. Everything targets it first; the other three define themselves against it
- Deno — Node’s original author starting again. Permissions are off by default — a script can’t read files or open sockets unless the command grants it. Web-standard APIs first
- Bun — one binary that is a runtime, package manager, bundler and test runner. Most people meet it as a faster
npm installand test runner, not as a production runtime. Different engine, so performance characteristics differ from Node’s in both directions - Workers — not a process at all: a V8 isolate, many per process, starting in milliseconds, no filesystem, web APIs only by default — Cloudflare, Edge Computing
The convergence that matters
The one difference worth seeing in code is the server’s shape. Node’s original HTTP API is its own:
// Node: callback with a req object and a res object you write into
import { createServer } from 'node:http';
createServer((req, res) => {
res.writeHead(200, { 'content-type': 'text/plain' });
res.end('hello'); // ← you mutate res; nothing is returned
}).listen(3000);Everyone newer converged on the browser’s own Request and Response objects:
// Workers, Bun and Deno: a function from Request to Response
export default {
fetch(request) { // ← a standard Request, as in a service worker
return new Response('hello', { // ← return a value instead of writing to res
headers: { 'content-type': 'text/plain' },
});
},
};
// Bun.serve({ fetch }) and Deno.serve(fetch) take the same functionWhat to notice: the second form runs, nearly unchanged, in all three — and it’s the same shape as a browser service worker. That’s deliberate. The runtimes standardised a shared baseline of web APIs, the minimum common API, first in the WinterCG community group and now as Ecma’s TC55 committee, WinterTC. Code written against it is portable; code written against node:http or Bun.* isn’t. Frameworks like Hydrogen and React Router are written to this shape for exactly that reason.
”Runs TypeScript” means “ignores the types”
Bun, Deno and Node can all run a .ts file directly. None of them type-check it. They erase the annotations and run what’s left, so a type error runs happily — the check still has to happen in an editor or in CI — Type Checking in CI, Transpilation.
Node goes furthest in restraint: it only strips syntax that can be deleted without generating code. enum and namespace need code generated, so Node refuses them, and it ignores tsconfig.json entirely.
Where it bites
- Dev runtime ≠ deploy runtime. Running locally under Bun proves nothing about a deploy target that runs Node, or an isolate with no
fs. The deploy target decides — Vercel functions default to Node; Workers are isolates. Match them, or write to the common API - “Node-compatible” is a spectrum. Bun and Deno implement Node’s built-ins from scratch, so the long tail — native addons, obscure
node:modules, timing-sensitive streams — is where incompatibility hides. Find out with your actual dependencies, not the claim - Different engine, different behaviour. Bun’s JavaScriptCore has its own performance profile and its own edge-case bugs. A faster benchmark isn’t a guarantee for your workload
- Toolchain and runtime are separable. Using Bun as the package manager and test runner while deploying on Node is common and reasonable — but its lockfile is its own, so the whole team and CI need to agree — Package Managers, Lockfiles
Which runtime is gaining ground, and how production-ready each is, changes too fast for a concept note — see the Landscape MOC.