Skip to the solution
HardSystem Design7 min read

Describe the Node.js architecture.

449 views

The problem

Question presented to candidate: "Draw or describe the pieces that make up a running Node.js process, from your JavaScript code down to the operating system. What actually talks to what?"

What a strong answer should cover:

  • Node's architecture is a layered stack, not one undifferentiated "runtime": your JavaScript code runs on V8 (parsing, JIT-compiling, executing β€” covered in its own dedicated question), which is embedded inside Node alongside libuv (the event loop, thread pool, and cross-platform async I/O β€” covered in its own dedicated question), connected by a layer of C++ bindings that expose native functionality (the file system, networking, process control) to JavaScript.
  • πŸ“Œ Verified, not assumed: V8 and libuv are two separate, independently versioned embedded components β€” confirmed directly via process.versions.v8 and process.versions.uv, each reporting its own distinct version number bundled with the same Node release, not one combined "Node version."
  • Node's standard library (fs, http, net, crypto, and others) is the JavaScript-facing API built on top of those C++ bindings β€” application code almost never touches the C++ layer directly; it calls the JavaScript standard library, which calls into C++, which calls into libuv/V8/the OS as appropriate.
  • The event loop (libuv's own loop, exposed to JavaScript scheduling β€” covered fully in its own dedicated question) is the mechanism tying this together at runtime: JavaScript callbacks are invoked by the event loop as libuv's phases advance, in response to I/O completion, timers, or thread-pool task completion.
  • A precise answer names the request flow through these layers concretely: application JS calls a standard-library function (e.g. fs.readFile) β†’ that calls into a C++ binding β†’ the binding dispatches to libuv (the thread pool, for file I/O) β†’ libuv notifies the event loop on completion β†’ the event loop invokes the original JavaScript callback β€” a full round trip through every layer, not just "Node reads a file."
  • A precise answer also names what changed over time worth being aware of, without overclaiming specifics: Node has migrated some internal binding mechanisics (e.g. history around N-API for native addon stability) β€” the broad layered structure (JS β†’ C++ bindings β†’ libuv/V8 β†’ OS) has remained stable even as specific internal implementation details have evolved across releases.

Clarifying questions expected:

  • "Does the interviewer want the high-level layer diagram, or a specific request's full round trip through those layers?" β€” both are reasonable answers to "describe the architecture," at different depths.
  • "Is Node's standard library itself part of what should be described, or just the lower-level runtime components (V8, libuv)?"

Code / implementation expected: Optional β€” confirming V8 and libuv's distinct, independently-reported version numbers via process.versions is a small, concrete way to demonstrate the "separate components" claim rather than assert it.

  • architecture
  • v8
  • libuv
  • event loop

Try it yourself

Sketch your approach before you read the solution. That is what the interview tests.

Stuck? Get a hint.

A short nudge toward the approach. It will not give the answer away.

Solution

The solution is hidden so you can try first

7 min read Β· 10 sections

Read the code

Confirming V8, libuv, and Node are three genuinely separate, independently-versioned components
$ node -e "console.log('v8:', process.versions.v8, '| uv:', process.versions.uv, '| node:', process.versions.node)"
v8: 13.6.233.17-node.51 | uv: 1.52.1 | node: 24.19.0

# Three genuinely distinct version strings β€” V8 and libuv are separate,
# independently-released components embedded and versioned together for
# this one Node release, not a single combined "Node runtime" number.

Discussion

Other approaches, follow-ups and how it went in real interviews.

Sign in to join the discussion.

No comments yet. Share how you would answer it.

Question 137 of 152 in Node.js

Keep your momentum going.

Mark this question solved to track your progress, then take the next one while it is fresh.

All Node.js questions
Up nextHard

Explain 'dependency injection' and how it can be used in Node.js.

Continue