Node.js is a server-side JavaScript runtime built on Chrome's V8 engine, designed for building scalable network applications. It uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, particularly well-suited for data-intensive real-time applications. As of Node.js 26 (released April 2026, the last release under the old even/odd LTS model), the runtime has reached a "batteries-included" maturity, with native TypeScript type stripping, a built-in Permission Model, native fetch() and WebSocket client, a built-in SQLite module, and a built-in test runner that eliminate many previously required npm dependencies. Understanding Node.js means understanding that most operations are asynchronous by default and that the event loop's single-threaded model shapes every architectural decision.
What This Cheat Sheet Covers
This topic spans 22 focused tables and 206 indexed concepts, 140 flashcards, 7 practice tests with 259 questions. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: Runtime & Architecture
To reason about Node.js performance, you first have to understand the machinery underneath your code: the V8 engine that compiles your JavaScript, libuv that supplies the event loop and thread pool, and the single-threaded, event-driven model that ties them together. These concepts explain why Node excels at I/O-heavy workloads and why blocking the event loop is the cardinal sin. The last few rows cover the developer-facing surface (--watch, native TypeScript, and the REPL) that has made the modern runtime feel batteries-included.
| Concept | Example | Description | |
|---|---|---|---|
Processes callbacks from timers, I/O, and setImmediate queues in phases | • Core mechanism enabling non-blocking I/O • continuously cycles through six phases (timers, pending callbacks, idle/prepare, poll, check, close callbacks); each phase owns a FIFO queue, so a callback runs in the phase matching its kind of work, not in scheduling order. | ||
Compiles JS to machine code using JIT compilation | • Google's open-source JavaScript engine that powers Node.js • JIT-compiles rather than merely interpreting (Ignition interpreter feeding the TurboFan optimizing compiler), and handles memory allocation and garbage collection; Node.js 26 ships V8 14.6. | ||
Cross-platform async I/O library underneath Node.js | • Provides the event loop and a thread pool (default 4 threads, tunable via UV_THREADPOOL_SIZE) used by file system, dns.lookup(), crypto and zlib work• network I/O does NOT use the pool: it goes through the kernel (epoll/kqueue/IOCP). | ||
fs.readFile(path, callback) returns immediately | • Operations return control immediately, they are not finished when the call returns • results are delivered later via callbacks, promises, or async/await. | ||
Main event loop runs on one thread | • JavaScript execution stays on a single thread, while I/O operations are delegated to the kernel or thread pool • a long synchronous callback therefore stalls every pending client, which is a DoS risk as well as a performance one. | ||
Uses EventEmitter pattern for async communication | Many core APIs signal completion by emitting named events ( net.Server on connect, fs.ReadStream on open), which listeners registered with .on() handle asynchronously. | ||
node --watch app.jsnode --watch-path=./src app.js | • Built-in file watcher since Node.js 18.11 • restarts the whole process on file changes (it is not hot module replacement, so in-memory state is lost); a simpler nodemon alternative, with --watch-path for scoping to specific directories. | ||
node example.ts | • Type stripping runs .ts files with no flags since v22.18 (disable with --no-strip-types), using the Amaro library, so no ts-node or build step is required• erasable syntax only ( enum, parameter properties need more) and no type checking is performed: run tsc --noEmit separately. | ||
node in terminal launches interactive shell | • Read-Eval-Print-Loop environment for interactive JavaScript • useful for quick testing and debugging single expressions; it prints the value of each expression entered. |