What Node.js actually is — V8, libuv, and the event loop's extra pieces

Node isn't a new programming language or a browser without a window — it's the same V8 engine Chrome uses, paired with a C++ library (libuv) that gives JavaScript access to the filesystem, network, and processes a browser deliberately never exposes.

Beginner

3 min read

Two real pieces bolted together: V8 for the language, libuv for everything else

V8 (Google's JavaScript engine, also inside Chrome)
  → parses and executes JavaScript — same engine, same language semantics
  → has NO concept of files, sockets, or processes on its own

libuv (a C++ library, written specifically for Node)
  → provides the actual OS-level I/O: filesystem access, networking, timers
  → this is what makes fs.readFile, http.createServer, etc. possible at all

V8 alone only knows how to run JavaScript — it has no built-in concept of reading a file or opening a network socket, the same as it does inside a browser tab. Node pairs V8 with libuv, a separate C++ library that provides the actual operating-system-level I/O operations, and exposes them to JavaScript as the built-in modules (fs, net, http) this domain covers. This is the real, mechanical answer to "what is Node, actually": the same JavaScript engine you already know from the browser, given a fundamentally different set of capabilities by what surrounds it.

Why some browser globals don't exist in Node, and vice versa

// In a BROWSER — these exist, Node doesn't have them at all
window.document; // there's no DOM, no window — Node isn't running inside any browser
 
// In NODE — these exist, browsers don't have them at all
require("fs").readFileSync("./data.txt"); // real filesystem access — a browser tab can't do this
process.env.API_KEY;                       // real OS environment variables

Because Node and a browser tab expose genuinely different capabilities through their respective host environments (not through the JavaScript language itself, which is identical), code written assuming one environment's globals (window, document, fs, process) simply fails in the other — not because the language differs, but because each environment surrounds the same V8 engine with a different set of built-in objects and modules, matched to what that environment is actually for.

The event loop this domain's JavaScript Fundamentals covered — with real, additional phases in Node specifically

setImmediate(() => console.log("immediate"));
setTimeout(() => console.log("timeout"), 0);
// Order isn't strictly guaranteed at the top level, but INSIDE an I/O callback,
// setImmediate is GUARANTEED to run before a 0ms setTimeout — a Node-specific
// ordering guarantee that doesn't exist in browser JavaScript at all

Node's event loop builds on the same fundamental call-stack/microtask/macrotask model covered in this platform's JavaScript Fundamentals domain, but libuv adds real, Node-specific phases and APIs that a browser's event loop simply doesn't have — setImmediate() (no browser equivalent) and specific, documented ordering guarantees for I/O callbacks. This is worth knowing explicitly: "the event loop" isn't one universal specification shared identically by every JavaScript environment — the language-level microtask/macrotask split is standard, but the exact phases and extra scheduling APIs around it are genuinely environment-specific.

process: the object that represents the running Node program itself

process.argv;      // command-line arguments the script was started with
process.env;         // OS environment variables, as a plain object
process.exit(1);       // ends the program immediately, with a given exit code
process.on("exit", () => console.log("shutting down")); // a real, observable process lifecycle event

process is a global object, available everywhere in Node with no require() needed, representing the currently-running Node process itself — its command-line arguments, its environment variables, and hooks into its own lifecycle (this domain's later lesson on graceful shutdown depends directly on process's signal-handling capabilities). There's no equivalent object in browser JavaScript, because a browser tab isn't a standalone OS process the way a Node script genuinely is.

Further reading

Check your understanding

A quick comprehension check — not tracked, not graded, just for you.

1. What are the two real, separate pieces that make up Node.js?

2. Why does code using `window.document` fail in Node, while code using `fs.readFileSync` fails in a browser?

3. What does the `process` global object represent in Node?