site logo

Master theNode.jsRuntime.

A comprehensive deep dive into the internals, performance, and production engineering of Node.js.

38
Chapters
240+
Sub Chapters
Est.
5k+
Pages
NodeBook Cover
NEW!

Why NodeBook?

Most developers use Node.js at the surface level: building APIs, wiring up frameworks, shipping apps.

But what happens when things go sideways — a memory leak, a blocked event loop, or the need to squeeze out microsecond-level performance?

This book pulls back the curtain and shows you how Node.js really works under the hood.

Start reading online for free

libuv & Event Loop Internals

Master poll/check/idle phases, threadpool queueing, and epoll/kqueue/IOCP platform differences that cause production failures

V8 Compilation Pipeline

Debug deoptimizations with Turbofan/Ignition, fix hidden class transitions, and prevent polymorphic inline cache misses

Zero-Copy Stream Architecture

Implement binary protocols with backpressure-aware transforms, scatter/gather I/O, and external memory management

Native Addon Development

Build thread-safe N-API modules with uv_queue_work, handle memory across JS/C++ boundaries, debug core dumps with lldb

Distributed System Observability

Propagate trace contexts with AsyncLocalStorage, control metrics cardinality, analyze P99 latency with flamegraphs

Production Memory Management

Tune generational GC flags, track retainers in heap snapshots, handle external memory pressure and OOM mitigation

By the time you're done, you'll have the mental models and hands-on knowledge to build, tune, and operate backend systems confidently.

Whether you're shipping a startup MVP or running large-scale enterprise deployments.

Contents
Table of Contents

240+ Chapters of Deep Node.js Knowledge

From V8's Turbofan optimizer to production deployments. Each chapter includes hands-on labs, real-world examples, and performance insights.

Vol I: Foundations 8 CH

01
Understanding Node.js Architecture
Ready
01What Node.js Actually Is (runtime + ecosystem)
02V8 and the JavaScript Engine (compilation, hidden classes)
03The Threading Model — single JS thread vs worker threads
04libuv Overview — event loop, threadpool, platform abstraction
05Event Loop Phases (timers, poll, check, close)
06Microtasks vs Macrotasks — promises, process.nextTick, setImmediate
07System Calls and C++ Bindings (how Node talks to the OS)
08Node Process Lifecycle (startup, bootstrap, shutdown)
09LTS, Releases, and Versioning (how Node evolves)
02
Working with Files (deep)
Draft
01Buffer Essentials (primer: alloc, slice, copy, memory effects)
02File Descriptors and Handles (open, close, fd semantics)
03Synchronous vs Asynchronous Operations (when to block)
04fs.readFile / fs.readFileSync (behaviour, limits)
05createReadStream & file streams (highWaterMark, backpressure)
06Low-level fs.read and fs.write (position, partial reads)
07FileHandle (fs/promises) patterns & cleanup
08Line-by-line reading & readline/promises (logs, CSV)
09File watching (fs.watch, fs.watchFile, chokidar caveats)
10Permissions, ownership, stat, xattr, and metadata
11Temp files, atomic writes, and safe file replacement
12NFS / network filesystems and consistency caveats
13Edge cases: /dev, /proc, device files, sparse files
03
Understanding Buffers
Draft
01What a Buffer Is (external memory vs V8 heap)
02Allocation patterns: alloc / allocUnsafe / from
03Views, slice, subarray — zero-copy vs copy semantics
04Encoding and String Conversion (UTF-8 pitfalls, BOMs)
05Buffer pools, fragmentation, and performance implications
06TypedArrays, SharedArrayBuffer, and cross-thread views
07Endianness and binary parsing strategies
08Native interactions: passing Buffers to C++/N-API
04
Streams In Depth
Draft
01Streams architecture: pull vs push models
02Readable Streams internals (read requests, flowing mode)
03Writable Streams internals (backpressure, cork/uncork)
04Transform & Duplex streams (implementing transforms)
05Backpressure, highWaterMark, and tuning strategies
06stream.pipeline() and robust stream error handling
07Stream compatibility: Node streams ↔ WHATWG/Web Streams
08Stream utilities (pipeline, finished, promisification)
09Zero-copy techniques and minimizing GC pressure
10Streaming common patterns: file→network, transform chains
05
Events & Async Primitives
Draft
01EventEmitter internals and implementation details
02Safe event patterns (once, removeListener, max listeners)
03Async primitives: callbacks, EventEmitter, Promises
04async_hooks for tracing async contexts (use & cautions)
05EventTarget and web-compat patterns in Node
06diagnostics_channel use cases for libraries
07Memory leaks via listeners and detection techniques
08Designing evented APIs with predictable semantics
06
Timers, Scheduling & Microtasks
Draft
01Timer APIs: setTimeout, setInterval semantics
02process.nextTick() vs queueMicrotask() vs promises
03setImmediate() semantics and how it fits the loop phases
04Timer performance pitfalls under event-loop pressure
05Timer cancellation & resource cleanup patterns
06Scheduling heavy work without blocking the loop (yielding)
07
Networking Fundamentals in Node
Draft
01net module fundamentals: sockets, streams, half-close
02TCP connection management and socket options (Nagle, keepalive)
03UDP (dgram) specifics and use-cases
04DNS resolution: dns module, OS resolver vs c-ares behavior
05TLS basics via tls module (certs, SNI, renegotiation pitfalls)
06System/network tuning that affects Node (fd limits, kernel params)
07Sockets lifecycle and resource exhaustion prevention
08TLS/ALPN basics and HTTP/2/TLS interactions
08
HTTP & Modern Web APIs in Node
Draft
01Core http/https server internals (request/response streams)
02Building an HTTP server from sockets (parsing, pipelining)
03HTTP/1.1 semantics: chunked transfer, connection reuse
04http2 (ALPN, streams, multiplexing) and Node support patterns
05WHATWG Fetch API in Node (global fetch, streaming bodies)
06Web Streams API (ReadableStream/TransformStream in Node)
07Clients & agents: connection pooling and Agent tuning
08Security-related headers and best server defaults

Vol II: Core APIs & Patterns 12 CH

01
Asynchronous Patterns
Soon
01Callbacks: error-first convention, Zalgo problem
02Promises internals and microtask timing
03async/await transform & stack traces
04Concurrency control: Promise.allSettled, pools, throttling
05Cancellation patterns with AbortController
06AsyncResource & propagation for libraries
07AsyncLocalStorage: propagation, performance, use-cases
08Debouncing, throttling, and scheduling patterns
02
Child Processes, Workers & Clustering
Soon
01child_process spawn/fork/exec — semantics & IPC
02worker_threads API: Worker, parentPort, workerData
03Worker pools and reuse strategies (backpressure, task queue)
04Shared memory: SharedArrayBuffer & Atomics in Node
05cluster module: trade-offs & sticky session issues
06Message serialization cost and transfer lists
07Safe restart & rolling update patterns for processes/workers
08Debugging and profiling across processes/threads
03
Filesystem Performance & Tuning
Soon
01OS-level caching and Node behaviour (page cache)
02Impact of sync I/O on event loop and mitigations
03UV_THREADPOOL_SIZE and threadpool-driven operations
04Concurrent file I/O patterns and queuing effects
05Choosing buffer sizes and highWaterMark for throughput
06Zero-copy and scatter/gather I/O techniques
07Filesystems (ext4/NVMe/NFS) and Node-specific consequences
08Example benchmarks and reproducible patterns
04
Cryptography & Secure Primitives
Soon
01crypto module primitives (hash, HMAC, ciphers)
02OpenSSL integration and Node's crypto behaviour
03WebCrypto vs crypto (what's available in Node v22/v23)
04Key management patterns and secure default choices
05TLS/SSL hands and cert verification in Node clients/servers
06Performance: hardware acceleration, crypto.webcrypto considerations
07Safe random generation and seeding concerns
05
Streams & Binary Protocols
Soon
01Implementing binary protocols with streams and buffers
02Framing, framing errors, and recovery strategies
03Efficient parsing (incremental parsers, binary readers)
04Backpressure-aware protocol implementations
05Combining streams with Transform for codec pipelines
06Binary message serialization (Protobuf, msgpack) tradeoffs
07Testing stream-based protocols (fuzzing and invariants)
06
Sockets, Timers & Resource Limits
Soon
01Managing timeouts for sockets and requests (ops patterns)
02Socket options and tuning for high RPS servers
03File descriptor limits and ulimit handling
04Graceful degradation strategies under FD pressure
05Monitoring and reacting to resource exhaustion
06Heartbeats and liveness detection patterns
07
Diagnostics & Developer Tools
Soon
01The Inspector Protocol and DevTools integration
02node --inspect debugging and heap inspection workflow
03perf_hooks and event-loop delay measurement
04diagnostics_channel and tracing hooks for libraries
05Clinic/0x/Flamegraph workflows for performance analysis
06Heap snapshots, llnode, and native debug tools
07Using node --trace-gc, trace-event for debugging
08
Testing & Quality for Node
Soon
01node:test built-in testing module (v18+ features)
02Async test patterns, deterministic tests for async code
03Stubbing native modules and fs/network in tests
04Integration tests that exercise streams, sockets, workers
05Performance tests and microbenchmarks
06Fuzz testing for parsers and protocol handlers
07CI patterns for running Node diagnostics/tests consistently
09
Modules, ESM, CJS & Loader Internals
Soon
01Module systems: CommonJS vs ESM differences and interop
02Module resolution algorithm (spec, exports/exportsFields)
03require semantics and caching behavior
04ESM loader hooks and custom loaders (experimental cautions)
05Dynamic import, top-level await, and edge cases
06Package exports, conditional exports, and package exports pitfalls
07Module isolation, package scope, and package.json fields
10
fs/promises, util, timers/promises
Soon
01fs/promises FileHandle API patterns (readFile/read)
02Promisified utilities and util.promisify caveats
03timers/promises and async timing helpers
04Best practices for using promises in core modules
05Integrating AbortController with fs/promises and fetch
06Migration patterns from callback to promise APIs
11
Security & Hardening for Node
Soon
01Secure defaults and runtime flags (NODE_OPTIONS considerations)
02Dependency auditing and supply chain hygiene
03Native addon risks and sandboxing strategies
04Privilege separation, running as non-root, file perms best practices
05Secrets management patterns in Node apps
06Vulnerability lifecycle & how to apply security patches
12
Packaging & Native Build Tooling
Soon
01Packaging JS apps for production: tarballs, single-binary approaches
02Native add-ons: node-gyp, N-API, node-addon-api fundamentals
03Prebuilds and prebuild-install patterns for cross-platform deployment
04CI strategies for building native modules (musl, glibc, windows)
05Packaging tools: pkg, nexe (tradeoffs) and when to use them
06Reproducible builds and artifact verification

Vol III: Internals & Performance 10 CH

01
V8 Internals & Optimization
Soon
01V8 compilation pipeline (Ignition, Turbofan) overview
02Hidden classes, inline caching, and de-optimizations
03Optimizing hot paths: inlining, avoiding polymorphism
04Memory model inside V8 and external memory accounting
05Optimizing object layouts for Node modules
06Using trace-deopt, prof, and interpretation of results
02
Garbage Collection & Memory Management
Soon
01Generational GC model in V8 (young/old spaces)
02GC tuning flags & when to tune (practical guidelines)
03Detecting and fixing memory leaks (retainers & dominators)
04External memory and Buffer retention issues
05WeakRef and FinalizationRegistry semantics & caveats
06Memory pressure strategies and OOM mitigation
03
libuv Deep Dive
Soon
01Event loop internals: poll, check, timers, idle APIs
02Threadpool internals and queueing model
03How libuv handles filesystem and DNS operations
04Work queue backpressure and tuning with UV_THREADPOOL_SIZE
05Building native libuv-based addons (C++ patterns)
06Platform differences (epoll/kqueue/IOCP nuances)
04
Profiling & Performance Measurement
Soon
01Perf_hooks and capturing precise timings
02CPU flame graphs and sampling profilers (0x, clinic)
03Heap snapshots & allocation profiling workflows
04Measuring tail latency and P99 analysis
05Benchmarking methodology, reproducibility, and noise reduction
06Automating perf tests in CI & regression detection
05
Concurrency & Parallelism
Soon
01Work-stealing vs worker-pool designs (patterns)
02Cooperative cancellation & AbortController across threads/processes
03Shared memory patterns with Atomics and circular buffers
04Latency isolation and CPU pinning strategies
05When to use processes vs threads vs asynchronous IO
06Observability of concurrent tasks (traces, metrics)
06
Observability & Instrumentation
Soon
01Instrumenting Node: metrics, traces, logs (OpenTelemetry)
02Context propagation (AsyncLocalStorage & trace contexts)
03Exporters and collectors for Node telemetry
04Sampling strategies and cardinality control for metrics/logs
05Runtime probes: event-loop lag, GC metrics, worker metrics
06Practical dashboarding and alert rules for Node services
07
Native Addons & N-API Advanced
Soon
01N-API lifecycle and ABI stability guarantees
02Thread-safety and async work from native code
03Memory management across JS/native boundary
04Creating zero-copy buffers exposed to JS
05Packaging native modules: prebuilds, node-pre-gyp patterns
06Debugging native crashes (core dumps, addr2line, lldb)
08
Diagnostics & Postmortem Analysis
Soon
01Collecting diagnostic artifacts automatically
02Analysing crash dumps and native stack traces
03Investigating memory leaks with heap snapshots & retainers
04Investigating latency with flamegraphs & CPU profiles
05Automated postmortem sampling & analysis pipelines
06Real-world case study: incident triage walkthrough
09
Runtime Flags, Startup & Snapshotting
Soon
01Useful Node flags (enable-source-maps, trace-gc, inspect)
02Start-up performance: code layout, lazy require, snapshotting
03V8 snapshotting and build-time snapshot techniques
04Minimizing cold-start overhead in serverless & container contexts
05Tradeoffs of packaging into single binary vs container image
06Serverless & Edge patterns: constraints, optimizations, adaptation strategies
10
Advanced Network Features & Protocols
Soon
01HTTP/2 advanced (flow control, prioritization)
02QUIC / HTTP/3 (Node support state & integration patterns)
03gRPC/HTTP2 vs HTTP/1.1 tradeoffs for Node services
04TLS tuning at scale (session resumption, tickets)
05Efficient binary streaming and multiplexing strategies
06Protocol negotiation and feature-detection patterns

Vol IV: Production Engineering 8 CH

01
Deployment Models & Process Management
Soon
01Process managers: PM2, systemd, container best practices
02Zero-downtime deploys and rolling restarts for Node processes
03Health checks and readiness probes tailored to Node servers
04Resource limits in containerized Node apps (memory, CPU)
05Startup probes and warm-up strategies for Node apps
06Building reproducible, minimal Node production images
02
Observability in Production
Soon
01What to instrument in Node (metrics, traces, logs) — must-have signals
02Recording resource metrics (RSS, file descriptors, event-loop lag)
03Distributed tracing examples (propagating across workers & processes)
04Alerting on Node-specific symptoms (GC storms, FD exhaustion)
05SLOs/SLIs for Node services and error-budget policies
06Emergency runbooks for Node incidents
03
Security Operations for Node
Soon
01Responding to Node security advisories & backporting patches
02Runtime mitigations for vulnerable dependencies (sidecars, WAF)
03Automatic patch pipelines for Node LTS versions
04Sandboxing untrusted code (vm2, isolate patterns & limits)
05Signing and verifying artifacts & package integrity (SBOM)
06Secure defaults for Node runtime in production
04
Packaging, Delivery & Distribution
Soon
01Creating production artifacts: bundles, containers, platforms
02Native addon binary distribution strategies (prebuilds)
03Multi-arch builds and cross-platform considerations
04Release automation for Node packages (tagging, changelogs, signed artifacts)
05Artifact verification and immutability
06Rollback strategies for Node deployments
07CI/CD: perf-regression checks, reproducible builds, canary/gradual rollouts
05
Scale Patterns Specific to Node
Soon
01Horizontal scaling patterns for Node services (stateless design)
02Load balancing strategies that respect Node semantics (keepalives)
03Sticky sessions alternatives for Node (JWTs, sticky with session store)
04Cache patterns and in-process caches: pros/cons for Node runtime
05Scaling background work: queues, worker nodes, and coordination
06Database connection scaling from Node apps
06
Maintenance & Long-term Operations
Soon
01Long-term metric retention and storage considerations
02Upgrading Node versions safely (canary/compat checks)
03Dependency lifecycle and pruning legacy code (minimal runtime)
04Capacity planning for Node fleets (tail latency focus)
05Runtime feature flags and gradual rollout in Node
07
Ecosystem, Package Management & Tooling
Soon
01Essential node tooling: nvm/n, corepack, npm/yarn/pnpm nuances
02Lockfile strategies, monorepo flows, and dependency pinning policies
03Package publishing best practices, semantic versioning, and deprecations
04Local dev ergonomics (devcontainers, live reload for Node)
05Build toolchains for modern Node (esbuild, swc, rollup usage for server code)
06Native addon build tools and prebuild pipelines
07Performance regression tooling and dashboards
08
Future of Node & Ecosystem
Soon
01Emerging runtime features (WASM, sandboxing, Web APIs)
02Node governance, roadmap, and how to follow releases
03Preparing codebases for future Node versions
04Community & ecosystem health (how to contribute)
05Final checklist: production-ready Node service (ops, security, perf)
06What to try next experiments and advanced reading list
Resources

Everything You Need to Master Node

All Resources Included Free

Every reader gets full access to our growing collection of tools, templates, and examples. No premium tiers, no paywalls, and no strings attached.

Free Updates

Stay in the Loop

Get early access to new chapters - much earlier than they're published here - plus insider tips on Node.js performance and production patterns.

No spam ever
Unsubscribe anytime
300+Subscribers
WeeklyUpdates
What's Coming Next

Exciting content on the Horizon

NodeBook is constantly evolving. Here's what we're building to make your learning experience even better.

Release Roadmap

LIVE
1
IN PROGRESS
November
2025
🚀

Vol I Complete

Core fundamentals and runtime architecture

85% COMPLETE
Major Release
2
SPECIAL
December
2025
📚

Vol I Paperback

Physical edition - Paperback + Hardcover

3
COMING
March
2026

Vol II Complete

Advanced patterns and performance

5% COMPLETE
Major Release
4
SPECIAL
April
2026
📖

Vol II Paperback

Physical edition - Paperback + Hardcover + One bonus chapter

5
COMING
July
2026
🏗️

Vol III Complete

Production engineering and scaling

5% COMPLETE
Major Release
6
SPECIAL
August
2026
📕

Vol III Paperback

Physical edition - PB + HC + Case Studies

7
COMING
November
2026
🔮

Vol IV Complete

Future of Node.js and emerging patterns

5% COMPLETE
Major Release
8
SPECIAL
December
2026
🎁

Vol IV Paperback

Final edition

And Beyond...

Be Part of the Journey

Join our community and help shape the future of NodeBook. Your feedback drives what we build next!

About the Author
👨‍💻

Ishtmeet Singh

Node.js Developer Since 2014

10+ YearsNode Experience
2000+Developers Helped
Open SourceContributor

Hi there!I'm Ishtmeet 👋

I've been working with Node.js since 2014, building everything from scrappy real-time apps to high-performance systems meant to run at scale.

Over the years, I've met plenty of developers who use Node.js every single day, but when performance bottlenecks, memory leaks, or scaling headaches pop up, they hit a wall. I've programmed in Rust and C++ as well, and then came back to Node.js and apply what I've learnt in systems programming.

This book comes out of almost a decade of digging into Node.js internals, debugging gnarly production issues, and squeezing every ounce of performance out of real systems. The goal is simple: strip away the mystery and give you the mental models you need to build and run Node.js applications with confidence.

💡 I've always believed that knowledge should be accessible, which is why NodeBook is completely free to read online.

Once the full content is wrapped up, it'll also be available as a four-volume paperback set for folks who prefer holding stuff in their hands.

When I'm not deep in Node.js, you'll usually find me mentoring developers, building experimental projects, or experimenting with new ways to push JavaScript on the server even further.

Coffee Consumed

∞ cups while writing

🐛

Bugs Squashed

Lost count at 10K+