Everything, indexed.

Browse every chapter and topic in NodeBook. Search to jump straight to the runtime detail you need.

15
chapters
79
topics
Free
online
79 topics
01

Node.js Architecture

4 topics

What Node.js Is

What Node.js is, how V8, libuv, native bindings, and core APIs fit together, and how JavaScript reaches files, sockets, timers, and the OS.

→

V8 in Node.js

How the V8 JavaScript engine architecture in Node.js runs Ignition bytecode, tiered JIT compilation, shapes, inline caches, and deoptimization.

→

Node.js Event Loop

Node.js event loop explained through libuv phases, timers, poll, check, close callbacks, process.nextTick, promise microtasks, and setImmediate order.

→

Node.js Process Lifecycle

A normal Node.js process starts by initializing V8 and libuv, loading the entry module, then staying alive while referenced handles and requests remain active.

→
02

Buffers

4 topics

What Is a Buffer?

What a Buffer is in Node.js: a fixed-size mutable byte sequence for files, sockets, hashes, images, compressed payloads, and undecoded I/O.

→

Buffer Allocation

How Buffer.alloc, Buffer.allocUnsafe, Buffer.from, slab pooling, and large Buffer allocation affect memory safety and performance in Node.js.

→

Buffer Operations

How Buffer views, copies, TypedArray interop, worker transfer, and zero-copy parsing affect byte ownership in Node.js.

→

Buffer Fragmentation, Retained Views, and External Memory

How Buffer allocation can fragment external memory, pin large backing stores, interact with V8 accounting, and create performance problems in Node.js.

→
03

Streams

6 topics

Stream Foundations

How Node.js moves chunked data through stream queues, consumption modes, and backpressure without treating every input as one value.

→

Readable Streams

How Node.js Readable streams buffer data, switch between flowing and paused mode, apply highWaterMark, and signal backpressure.

→

Writable Streams

How Writable streams accept chunks, buffer writes, use highWaterMark, return false from write, and emit drain for backpressure.

→

Transform Streams

How Transform and Duplex streams work in Node.js, how _transform and _flush emit output, and how backpressure crosses both sides.

→

Stream Pipeline

How pipe, stream.pipeline, finished, async pipeline stages, AbortSignal, side outputs, and partial-output cleanup work in current Node.js stream pipelines.

→

Zero-Copy Streams

How Buffer ownership, fs.copyFile, writev, _writev, cork, and copy-path measurement shape hot Node.js stream paths.

→
04

File System

5 topics

File Descriptors & Handles

How file descriptors and FileHandle objects map to OS file state, open flags, close behavior, libuv work, and EMFILE failures.

→

File I/O

How Node.js reads and writes files through whole-file helpers, streams, low-level read/write calls, append mode, and durable flushes.

→

fs.promises & FileHandle

How fs.promises and FileHandle work in Node.js, including async file operations, descriptor ownership, stream lifecycles, cleanup, and controlled concurrency.

→

fs.watch & Atomic Writes

How fs.watch, fs.watchFile, OS watcher backends, and atomic replacement patterns interact in real file workflows.

→

Permissions & Metadata

How Node.js exposes file permissions, ownership, stat metadata, symlinks, inodes, sparse files, special paths, and filesystem edge cases.

→
05

Process & OS

4 topics

process Object

How the Node.js process object exposes env, argv, pid, cwd, exit state, memory usage, versions, IPC, and native process bindings.

→

Signals & Exit Codes

How Node.js handles SIGTERM, SIGINT, exit codes, beforeExit, exit, uncaught exceptions, and graceful shutdown across process scopes.

→

os Module

How the Node.js os module reports CPU counts, available parallelism, memory, load average, network interfaces, paths, users, and platform data.

→

Standard I/O

How Node.js standard input, output, and error streams map to file descriptors, TTYs, pipes, console output, and backpressure.

→
06

The Module System

5 topics

CJS require() Internals

How Node.js require works internally through resolution, Module._load, source wrapping, compilation, module.exports, and require.cache.

→

Module Resolution

How Node.js resolves module specifiers through built-ins, relative paths, node_modules lookup, package.json main, exports, imports, and symlinks.

→

ES Modules

How ES Modules work in Node.js through static import/export syntax, module format detection, parse-link-evaluate phases, and live bindings.

→

CommonJS/ESM Interop

How CommonJS and ES Modules interoperate in Node.js through CJS namespaces, require(esm), conditional exports, and dual package design.

→

import.meta & ESM Caching

How import.meta, import.meta.url, import.meta.dirname, the ESM module cache, circular dependencies, and module state work in Node.js.

→
07

Async Patterns & Control Flow

6 topics

Error-First Callbacks

How Node.js error-first callbacks work, why the first argument carries errors, and how callback dispatch connects native async work back to JavaScript.

→

Promise Microtasks

How Node.js orders Promise jobs, process.nextTick callbacks, queueMicrotask work, timers, and I/O across CommonJS, ES modules, and active microtask drains.

→

Async/Await

How async functions and await work in Node.js through promise wrapping, suspension, resumption, microtasks, errors, and V8 state machines.

→

EventEmitter Internals

How EventEmitter stores listeners, dispatches emit synchronously, handles error events, preserves listener order, and reports possible leaks.

→

Async Iterators

How async iterators work in Node.js through Symbol.asyncIterator, for await...of, async generators, stream consumption, and backpressure.

→

Promise Combinators

How Promise.all, allSettled, race, and any behave in Node.js, including short-circuiting, failure propagation, cancellation gaps, and concurrency limits.

→
08

Runtime Platform APIs & Tooling

5 topics

CLI Flags

How Node.js consumes startup flags, NODE_OPTIONS, preloads, V8 options, source maps, conditions, warnings, diagnostics, memory flags, node --run, and experimental config files.

→

.env Files

How Node.js loads .env files with --env-file, parses DotEnv syntax, resolves precedence, handles NODE_OPTIONS, uses process.loadEnvFile() and util.parseEnv(), and turns raw strings into validated config.

→

Web Platform APIs

How Node.js exposes web-compatible globals including fetch, Request, Response, Web Streams, Blob, File, FormData, URL, and structuredClone.

→

TypeScript & Compile Cache

How Node.js v24.15 runs TypeScript through type stripping, handles .ts module formats, rejects unsupported syntax, and stores compile cache data.

→

REPL, Inspector, Watch & SEA

How Node.js REPL, inspector sessions, watch mode, and single executable applications evaluate code, expose debugging state, restart, and package apps.

→
09

Network Fundamentals with Node.js

7 topics

TCP/IP Networking

How Node.js networking depends on OS sockets, TCP/IP state, addresses, ports, routing, link-layer resolution, MTU, and libuv handles.

→

DNS Resolution

How Node.js resolves hostnames through dns.lookup, dns.resolve, OS resolver behavior, c-ares, recursive DNS, TTLs, caching, and address ordering.

→

TCP Flow & Failure

How Node.js TCP connections move through handshake, flow control, ordered delivery, FIN, RST, ECONNRESET, EPIPE, ETIMEDOUT, and shutdown.

→

Sockets and net

How Node.js net.Server and net.Socket wrap OS socket state, libuv TCP handles, connection events, writes, shutdown, timeouts, and IPC endpoints.

→

UDP and dgram

How Node.js UDP sockets work through dgram, datagram framing, send and message events, bind state, broadcast, multicast, connected UDP, and errors.

→

Socket Options & Backlog

How Node.js exposes socket options including keepAlive, noDelay, backlog, SO_REUSEADDR, send and receive buffers, IPv4/IPv6 binding, and dual stack behavior.

→

Request Path

Trace a Node.js connection from hostname lookup through address selection, routing, TCP connect, accept queues, libuv readiness, and JavaScript callbacks.

→
10

HTTP Servers, Clients & Proxies

7 topics

HTTP/1.1 Wire Format

Read HTTP/1.1 as bytes: start lines, headers, body framing, chunked transfer coding, connection rules, and interim responses.

→

http.Server Lifecycle

Trace one inbound HTTP request through http.Server, accepted sockets, IncomingMessage, ServerResponse, header commits, early bodies, parser errors, timeouts, and connection reuse.

→

HTTP Parsing with llhttp

How Node.js turns HTTP/1.1 bytes into IncomingMessage objects through llhttp state, parser callbacks, header limits, body delivery, errors, trailers, and upgrade handoff.

→

Routing and Middleware

Build a small framework-free HTTP handler with method and path routing, middleware composition, bounded JSON body parsing, and deliberate error responses.

→

Keep-Alive, Agents, and Pools

How Node.js reuses HTTP/1.1 TCP connections through keep-alive, http.Agent pools, server idle timers, stale pooled sockets, and reuse limits.

→

fetch and Undici

How outbound HTTP works in Node.js, from http.request() and ClientRequest through fetch, Undici dispatchers, pools, redirects, decoding, and pipelining.

→

Proxies, Static Files, and Streaming

Build the HTTP boundary where Node forwards requests, streams bodies, filters connection metadata, and serves file-backed responses.

→
11

TLS, HTTPS & HTTP/2

6 topics

TLS Handshake & Ciphers

How a Node.js TCP connection becomes a TLS connection through OpenSSL, records, handshakes, version selection, cipher negotiation, SNI, and session reuse.

→

Certificates, Chains & Trust

How Node decides whether a TLS peer certificate chains to trusted CA material and matches the hostname the client asked for.

→

HTTPS Servers & Clients

Build the Node HTTPS path from encrypted accepts through request handlers, secure contexts, client agents, termination boundaries, validation mistakes, and staged error diagnosis.

→

Mutual TLS

How Node.js HTTPS servers request client certificates, validate them against client CAs, expose peer identity, and keep TLS authentication separate from application authorization.

→

ALPN Negotiation

How TLS negotiates HTTP/1.1 versus HTTP/2 with ALPN, how Node exposes the selected protocol, and where fallback breaks.

→

HTTP/2 Multiplexing & Flow Control

How Node.js maps HTTP/2 sessions, streams, frames, multiplexing, HPACK, SETTINGS, flow-control windows, and shutdown frames onto the node:http2 API.

→
12

API Design, Contracts & Frameworks

7 topics

Resource Modeling & REST

Model REST-style API resources, route patterns, representations, methods, status signals, and client contracts for Node HTTP services.

→

OpenAPI & JSON Schema

Connect OpenAPI documents, JSON Schema, generated clients, runtime validation, coercion, response schemas, and contract drift in Node API services.

→

Express & Fastify Internals

Trace Express and Fastify requests through routing, middleware, hooks, validation, serialization, handler execution, and framework error flow.

→

Errors, Idempotency & Pagination

Define client-visible API behavior for errors, repeated writes, paginated reads, filters, sorting, and field projection.

→

GraphQL Schemas & Resolvers

How GraphQL schemas, selection sets, resolvers, N+1 behavior, DataLoader, persisted queries, and GraphQL over HTTP work in Node services.

→

gRPC & Protocol Buffers

How gRPC uses Protocol Buffers, generated stubs, HTTP/2 streams, metadata, trailers, deadlines, and field-number discipline to build typed Node service contracts.

→

Versioning & Gateways

How API contracts change over time, how to classify compatibility risk, and where gateways fit in version routing, migration, and contract enforcement boundaries.

→
13

Realtime & Streaming APIs

5 topics

WebSocket Protocol & Servers

Trace a WebSocket connection from HTTP upgrade through Node's raw socket handoff, frame parsing, masking, ping/pong liveness, compression, and close behavior.

→

SSE & Long Polling

Implement HTTP-shaped realtime updates with Server-Sent Events, EventSource reconnects, long polling, cursors, and Node response cleanup.

→

Realtime Backpressure

Design bounded realtime send paths in Node.js: per-connection queues, slow consumers, bufferedAmount guards, drop and coalescing policy, replay, gaps, and broadcast pressure.

→

Auth, Heartbeats & Presence

How realtime connections carry identity after upgrade, refresh credentials, reconnect, prove liveness, and derive presence while identity architecture stays in its own layer.

→

Fanout, Rooms & Scaling

Trace one realtime event through room registries, per-connection queues, process boundaries, backplanes, affinity, and shard-level scaling.

→
14

Child Processes & OS Workloads

6 topics

spawn(), exec(), execFile() & fork()

How Node.js starts child processes, where parent and child state split, and when to use spawn(), exec(), execFile(), or fork().

→

stdio Configuration & Piping

The stdio option in depth, from pipes and inheritance to extra descriptors, and the read-and-close habits that keep a parent from hanging on its child.

→

IPC Channels & Handle Passing

How Node wires parent-child IPC channels, serializes messages, applies send backpressure, disconnects cleanly, and passes supported network handles.

→

Shell Injection & Safe Launching

How shell parsing, argv separation, PATH lookup, platform launch rules, timeouts, buffers, and privileges shape safe child-process calls in Node.js.

→

Process Pools & Supervisors

How reusable child-process pools, detached children, POSIX process groups, reaping, and local supervision fit together in Node.js.

→

Cluster as Legacy Scaling

How Node's cluster module forks worker processes, shares server handles, distributes connections, drains workers, and fits into modern scaling decisions.

→
15

Worker Threads & Shared Memory

2 topics

Workers vs Processes

Where worker threads fit beside async I/O, libuv's thread pool, and child processes for CPU-bound JavaScript work.

→

Creating & Supervising Workers

How Node.js creates worker threads, passes startup data, reports lifecycle events, terminates workers, applies resource limits, and supports local supervision.

→