Steven's Knowledge
ArchitectureComparison

JavaScript Runtimes

Comparing Browser, Node.js, Deno, and Bun - architecture, APIs, performance, and use cases

JavaScript Runtimes Comparison

A comparison of the four major JavaScript runtime environments: Browser, Node.js, Deno, and Bun.

Overview

FeatureBrowserNode.jsDenoBun
Initial Release1995 (Netscape)200920182022
CreatorVarious vendorsRyan DahlRyan DahlJarred Sumner
JS EngineV8 / SpiderMonkey / JSCV8V8JavaScriptCore (JSC)
LanguageC++C++RustZig + C++
Primary UseClient-side web appsServer-side / toolingServer-side / toolingServer-side / tooling
Package ManagerN/Anpmdeno add (JSR) / npmbun (npm-compatible)
TypeScript SupportVia bundler/transpilerVia tsx / ts-nodeNative (built-in)Native (built-in)
Top-Level Await✅ (ES modules)✅ (ES modules)
Permission ModelSandboxedUnrestrictedSecure by defaultUnrestricted

Architecture

Browser

  • Sandboxed environment: Runs in an isolated context with strict security policies
  • Event loop: Single-threaded with Web APIs for async operations (setTimeout, fetch, DOM events)
  • Multi-engine landscape: V8 (Chrome/Edge), SpiderMonkey (Firefox), JavaScriptCore (Safari)
  • Web APIs: DOM, Fetch, Web Workers, Service Workers, WebSocket, IndexedDB, Canvas, WebGL, WebGPU
// Browser-specific APIs
const response = await fetch('/api/data');
const data = await response.json();

// DOM manipulation
document.querySelector('#app').textContent = data.message;

// Web Worker for CPU-intensive tasks
const worker = new Worker('worker.js');
worker.postMessage({ task: 'compute', payload: largeData });
worker.onmessage = (e) => console.log(e.data.result);

// Service Worker for offline support
navigator.serviceWorker.register('/sw.js');

Node.js

  • V8 engine: Same engine as Chrome, with libuv for async I/O
  • Event loop: Single-threaded with worker_threads for CPU-intensive tasks
  • CommonJS & ESM: Supports both module systems (CJS historically, ESM increasingly default)
  • C++ addons: Native bindings via N-API for performance-critical code
import { readFile } from 'node:fs/promises';
import { createServer } from 'node:http';

// Built-in HTTP server
const server = createServer(async (req, res) => {
  const data = await readFile('./data.json', 'utf-8');
  res.writeHead(200, { 'Content-Type': 'application/json' });
  res.end(data);
});

server.listen(3000);

// Worker threads for CPU-intensive tasks
import { Worker } from 'node:worker_threads';
const worker = new Worker('./heavy-computation.js');

Deno

  • V8 engine + Rust core: Runtime built in Rust using Tokio async runtime
  • Secure by default: Requires explicit permissions for file, network, and environment access
  • Web-standard APIs: Aligns with browser APIs where possible (Fetch, Web Streams, Web Crypto)
  • Built-in toolchain: Formatter, linter, test runner, bundler, documentation generator, LSP
// TypeScript works out of the box - no config needed
import { serve } from "https://deno.land/std/http/server.ts";

// Uses Web standard Fetch API
const response = await fetch("https://api.example.com/data");
const data = await response.json();

// File system with explicit permissions
// Run with: deno run --allow-read --allow-net server.ts
const file = await Deno.readTextFile("./data.json");

// Built-in HTTP server (Web standard API)
Deno.serve({ port: 3000 }, async (req) => {
  return new Response(JSON.stringify({ hello: "world" }), {
    headers: { "Content-Type": "application/json" },
  });
});

Bun

  • JavaScriptCore engine: Uses WebKit's engine (from Safari), optimized for startup and execution speed
  • Written in Zig: Low-level language with manual memory management for maximum performance
  • All-in-one toolkit: Runtime, bundler, test runner, package manager in a single binary
  • Node.js compatible: Designed as a drop-in replacement for Node.js
// TypeScript works natively
import { serve } from "bun";

// Bun's optimized HTTP server
serve({
  port: 3000,
  fetch(req) {
    return new Response(JSON.stringify({ hello: "world" }), {
      headers: { "Content-Type": "application/json" },
    });
  },
});

// Fast file I/O with Bun APIs
const file = Bun.file("./data.json");
const data = await file.json();

// Built-in SQLite
import { Database } from "bun:sqlite";
const db = new Database("mydb.sqlite");

API Comparison

Web Standard APIs

APIBrowserNode.jsDenoBun
Fetch✅ Native✅ (v18+)✅ Native✅ Native
Web Streams✅ Native✅ (v18+)✅ Native✅ Native
Web Crypto✅ Native✅ (v19+)✅ Native✅ Native
WebSocket✅ Native❌ (third-party)✅ Native✅ Native
URL / URLSearchParams✅ Native✅ Native✅ Native
TextEncoder / TextDecoder✅ Native✅ Native✅ Native
AbortController✅ Native✅ (v15+)✅ Native✅ Native
FormData✅ Native✅ (v18+)✅ Native✅ Native
structuredClone✅ Native✅ (v17+)✅ Native✅ Native
Web Workers✅ Native⚠️ worker_threads✅ Web Workers✅ Web Workers
DOM APIs✅ Native

Runtime-Specific APIs

APIBrowserNode.jsDenoBun
File System❌ (File API only)✅ node:fs✅ Deno.readFile / node:fs✅ Bun.file / node:fs
Child Process✅ node:child_process✅ Deno.Command / node:child_process✅ Bun.spawn / node:child_process
TCP / UDP Sockets✅ node:net✅ Deno.connect✅ Bun.listen
HTTP Server✅ node:http✅ Deno.serve✅ Bun.serve
SQLite❌ (third-party)❌ (third-party)✅ bun:sqlite
FFI (Foreign Function Interface)❌ (N-API / node-gyp)✅ Deno.dlopen✅ bun:ffi
Test Runner✅ node:test (v18+)✅ Deno.test✅ bun:test

Node.js Compatibility

ModuleNode.jsDenoBun
node:fs
node:path
node:http
node:crypto
node:stream
node:buffer
node:events
node:child_process
node:worker_threads
node:net
node:dgram⚠️ Partial⚠️ Partial
node:cluster

Module System

AspectBrowserNode.jsDenoBun
ES Modules✅ (native)✅ (.mjs / "type": "module")✅ (default, only)✅ (default)
CommonJS✅ (default historically)⚠️ Compatibility layer
URL Imports✅ (script tags)
Import Maps⚠️ Experimental
JSR RegistryN/A✅ (via npx jsr)✅ (native)✅ (via bunx jsr)
npm RegistryN/A✅ (native)✅ (npm: specifier)✅ (native)
package.jsonN/A✅ (required)✅ (optional)✅ (required)

Performance Benchmarks

HTTP Server Throughput (req/s)

RuntimeHello WorldJSON SerializationNotes
Bun~110,000~95,000Fastest HTTP server
Deno~80,000~70,000V8 + Rust hyper
Node.js~55,000~48,000V8 + libuv

Startup Time

RuntimeEmpty ScriptImport Heavy ModuleNotes
Bun~5ms~20msJSC + Zig = fastest cold start
Deno~20ms~60msV8 + snapshot
Node.js~30ms~80msV8 + module resolution

Package Install Speed

Package ManagerInstall 100 deps (cold)Install 100 deps (cached)
bun install~2s~0.3s
pnpm install~8s~1.5s
npm install~15s~3s
yarn install~12s~2s

TypeScript Execution

RuntimeMethodOverhead
BunNative transpilation (JSC)Near zero
DenoNative transpilation (SWC)Near zero
Node.js (tsx)On-the-fly via esbuildLow (~50ms startup)
Node.js (ts-node)On-the-fly via TypeScript compilerHigh (~500ms startup)
Node.js (--experimental-strip-types)Built-in type stripping (v22.6+)Low

Built-in Tooling

ToolBrowserNode.jsDenoBun
Package ManagerN/Anpmdeno addbun
BundlerN/A❌ (third-party)deno bundle (deprecated) → JSRbun build
Test RunnerN/Anode --test (v18+)deno testbun test
FormatterN/A❌ (Prettier)deno fmt❌ (Prettier)
LinterN/A❌ (ESLint)deno lint❌ (ESLint)
Type CheckerN/A❌ (tsc)deno check❌ (tsc)
REPL✅ (DevTools)nodedenobun
Benchmarking❌ (third-party)deno bench❌ (third-party)
Task RunnerN/Anpm scriptsdeno taskbun run
LSPN/A❌ (third-party)deno lsp❌ (third-party)
DocumentationN/A❌ (third-party)deno doc❌ (third-party)
Compile to BinaryN/Anode --experimental-seadeno compilebun build --compile

Security Model

AspectBrowserNode.jsDenoBun
Default PermissionsSandboxed (minimal)Full accessNo access (secure)Full access
File System❌ Blocked✅ Full--allow-read / --allow-write✅ Full
NetworkSame-origin policy✅ Full--allow-net✅ Full
Environment Variables❌ N/A✅ Full--allow-env✅ Full
Subprocess❌ N/A✅ Full--allow-run✅ Full
FFI❌ N/AN/A--allow-ffi✅ Full
Granular ScopingOrigin-based✅ (per-domain, per-path)
# Deno: explicit permissions
deno run --allow-read=./data --allow-net=api.example.com server.ts

# Deno: allow all (not recommended for production)
deno run -A server.ts

# Node.js: experimental permission model (v20+)
node --experimental-permission --allow-fs-read=./data server.js

Framework & Library Support

Web Frameworks

FrameworkNode.jsDenoBun
Express
Fastify⚠️ Partial
Koa
Hono
Elysia⚠️ Limited✅ (optimized for Bun)
Fresh✅ (Deno-native)
Oak⚠️ Limited✅ (Deno-native)

Meta-Frameworks (SSR / Fullstack)

FrameworkNode.jsDenoBun
Next.js⚠️ Partial⚠️ Partial
Nuxt⚠️ Partial
SvelteKit⚠️ Partial
Astro⚠️ Partial
Remix⚠️ Partial

ORM & Database

LibraryNode.jsDenoBun
Prisma
Drizzle
TypeORM⚠️ Partial⚠️ Partial
Mongoose

Deployment

Edge / Serverless Platforms

PlatformNode.jsDenoBunBrowser (WASM)
AWS Lambda✅ (custom runtime)✅ (custom runtime)N/A
Vercel Functions⚠️ ExperimentalN/A
Cloudflare Workers⚠️ (workerd, not full Node.js)✅ (V8 isolates)
Deno Deploy✅ (native)N/A
Netlify FunctionsN/A
Fly.ioN/A

Containerization

AspectNode.jsDenoBun
Docker Image Size~150 MB (alpine)~130 MB~100 MB
Compile to Single Binary⚠️ Experimental (SEA)✅ deno compile✅ bun build --compile
Distroless Image

Community & Ecosystem

AspectNode.jsDenoBun
GitHub Stars~110K~100K~75K
npm Packages2,000,000+Compatible via npm: specifierCompatible (native npm)
JSR PackagesSupportedNative registrySupported
Corporate BackingOpenJS FoundationDeno Land Inc.Oven
Job MarketLargestGrowingEmerging
Production AdoptionUbiquitousGrowing (Slack, Netlify)Early adopters
DocumentationComprehensiveExcellentGood

Use Cases

Choose Browser When

  • Building client-side web applications (the only option for end-user web)
  • Leveraging DOM APIs and browser-specific features (Canvas, WebGL, WebGPU)
  • Need sandboxed execution with strict security boundaries
  • Building PWAs with Service Workers and offline support

Choose Node.js When

  • Building production backend services with maximum ecosystem compatibility
  • Need the largest package ecosystem and widest library support
  • Working with enterprise infrastructure that expects Node.js
  • Team has existing Node.js expertise and codebase
  • Require mature tooling and battle-tested stability

Choose Deno When

  • Security is a priority and want permissions by default
  • Prefer Web standard APIs and modern JavaScript conventions
  • Want an all-in-one toolchain (fmt, lint, test, bench, doc, lsp)
  • Building for Deno Deploy edge platform
  • Starting new projects without legacy CommonJS dependencies
  • Working with TypeScript-first workflows without configuration

Choose Bun When

  • Performance is critical (HTTP throughput, startup time)
  • Want the fastest package manager and install times
  • Need native TypeScript execution with minimal overhead
  • Building performance-sensitive APIs and microservices
  • Using Elysia or other Bun-optimized frameworks
  • Want built-in SQLite for embedded database use cases

Summary

Best ForRuntime
Client-Side WebBrowser
Ecosystem & StabilityNode.js
Security & StandardsDeno
Raw PerformanceBun
TypeScript DXDeno / Bun
Built-in ToolingDeno
Package Install SpeedBun
Enterprise / ProductionNode.js
Edge DeploymentDeno (Deno Deploy) / Browser (CF Workers)
Drop-in Node.js ReplacementBun

All three server-side runtimes are converging on Web standard APIs (Fetch, Web Streams, Web Crypto) and improving Node.js compatibility. Node.js remains the safe choice for production with the largest ecosystem. Deno leads in security, tooling, and standards compliance. Bun pushes the performance envelope and offers the best developer experience for speed-sensitive workflows. The Browser remains the only runtime for client-side web applications and continues to gain powerful APIs (WebGPU, WebTransport, WebAssembly).

On this page