← Back

The Glossary of Node.js

Core Concepts

Runtime — Node.js is not a language or a framework but a JavaScript runtime:

libuv — The C library underlying Node.js that provides the event loop, thread pool, and asynchronous I/O primitives — the actual machinery that lets Node handle file, network, and DNS operations without blocking.

Single-Threaded — Node.js executes JavaScript on a single main thread, relying on the event loop and background threads (via libuv) to handle concurrency, rather than spawning a new OS thread per request the way many traditional server platforms do.

Non-Blocking I/O — Node's core design philosophy: input/output operations like reading a file or querying a database are started and then handed off, letting the main thread continue running other code instead of waiting idle for the operation to finish.

Event Loop — The mechanism that continuously checks whether the call stack is empty and, if so, pulls the next callback from a queue to execute — the reason a single-threaded runtime can still handle thousands of concurrent connections.

Event Emitter — A core Node.js pattern and built-in class (EventEmitter) for objects that emit named events which listener functions can subscribe to, underlying much of Node's own API surface, from streams to HTTP servers.

Global Object — Node's equivalent of the browser's window, called global, providing runtime-wide values and functions; Node also exposes module-scoped globals like __dirname, __filename, and require that don't exist in browser JavaScript.

Modules

Module Resolution Algorithm — The set of rules Node follows to locate a file when it's import'ed — checking core modules first, then relative paths, then walking up through node_modules directories.

Core Modules — Built-in modules that ship with Node.js itself and require no installation, such as fs, http, path, and crypto, importable directly by name without a file path.

Asynchronous Patterns

Callback — A function passed as an argument to be invoked once an asynchronous operation completes; Node's original and still-present async pattern, historically prone to deeply nested "callback hell."

Error-First Callback — Node's long-standing convention for callback signatures, where the first argument is always reserved for an error object (or null if none occurred), followed by the actual result.

Promise — A modern alternative to callbacks representing the eventual result of an asynchronous operation, supported throughout Node's core APIs via promise-based variants (like fs.promises) alongside their callback originals.

async / await — Syntax that lets Promise-based asynchronous code in Node be written and read sequentially, now the dominant style for asynchronous Node.js code over raw callbacks or chained .then() calls.

Call Stack — The structure tracking function calls currently in progress on Node's single main thread, in last-in-first-out order.

Microtask Queue vs. Macrotask (Timer) Queue — Two categories of queued callbacks the event loop processes differently: Promise callbacks (microtasks) are drained completely between each phase, while timers and I/O callbacks (macrotasks) are processed one phase at a time.

Event Loop Phases — The distinct stages Node's event loop cycles through on each iteration — timers, pending callbacks, poll, check, and close callbacks — each responsible for a different category of queued work.

process.nextTick() — A Node-specific function that queues a callback to run immediately after the current operation completes, before the event loop continues — even higher priority than standard Promise microtasks.

Worker Threads — A core module (worker_threads) that allows genuinely parallel JavaScript execution across multiple threads within a single Node.js process, used for CPU-intensive work that would otherwise block the main thread.

Cluster Module — A core module that lets a Node.js application spawn multiple child processes sharing the same server port, distributing incoming connections across them to take advantage of multi-core systems.

Streams & Buffers

Stream — An abstract interface for working with data incrementally, piece by piece, rather than loading an entire resource (like a large file) into memory at once.

Readable Stream — A stream from which data can be read, such as a file being read from disk or an incoming HTTP request body.

Writable Stream — A stream to which data can be written, such as a file being written to disk or an outgoing HTTP response.

Duplex / Transform Stream — A Duplex stream is both readable and writable (like a network socket); a Transform stream is a Duplex stream that also modifies data as it passes through (like a compression stream).

pipe() — The core stream method that connects a readable stream's output directly to a writable stream's input, automatically managing the flow of data and backpressure between them.

Backpressure — The condition where a writable stream can't consume data as fast as a readable stream produces it, and the mechanism streams use to signal "slow down" and prevent memory from ballooning.

Buffer — A Node.js class for working directly with raw binary data, predating JavaScript's standardized TypedArray, still used throughout Node's file system, network, and cryptography APIs.

Core APIs

fs (File System) — The core module for interacting with the file system, offering callback-based, Promise-based (fs.promises), and synchronous versions of operations like reading, writing, and watching files.

http / https — The core modules for creating HTTP(S) servers and making HTTP(S) requests, forming the low-level foundation that frameworks like Express are built on top of.

path — The core module for working with file and directory paths in a way that's consistent across operating systems, handling differences like Windows backslashes versus POSIX forward slashes.

os — The core module exposing operating-system-level information, such as CPU architecture, available memory, and network interfaces.

crypto — The core module providing cryptographic functionality, including hashing, encryption, and HMACs, built on top of OpenSSL.

events — The core module exporting the EventEmitter class, the pattern underlying much of Node's own asynchronous API design.

child_process — The core module for spawning and managing external system processes from within a Node.js program, letting Node script or shell out to other executables.

Environment Variables (process.env) — The mechanism for reading configuration values injected from outside the application (API keys, environment flags, ports), commonly managed in development via a .env file and the dotenv package.


Taken together, this glossary traces Node.js's project from the start: taking a language built for the browser and giving it a event loop, a module system, and direct access to the file system and network, so JavaScript could run a server as naturally as it ran a page. Callbacks gave way to Promises and async/await; CommonJS is gradually giving way to ES Modules; and a single-threaded runtime learned to reach for Worker Threads and clustering when one thread wasn't enough. Each term here marks a place where server-side JavaScript had to solve a problem the browser never asked it to — which is, in miniature, the foundation everything in The Glossary of Next.js is ultimately built on top of.

*written with Claude Sonnet 5