Skip to main content

Command Palette

Search for a command to run...

Node Js Internals (v8 engine, libuv, Js bindings)

Updated
2 min read

Ever wondered how Node.js actually works behind the scenes?

Before Node.js existed, JavaScript was only limited to browsers. You could use it to make buttons interactive, validate forms, or update UI — but that was it.

👉 Want to access files?
👉 Want to create a server?
❌ Not possible with plain browser JavaScript.


Then came Node.js

Node.js changed everything by allowing JavaScript to run outside the browser.

Now you can build:

  • Servers

  • APIs

  • Backend logic

This is what we call server-side JavaScript.


But how does Node.js actually work?

Node.js is not just one thing. It’s made of 3 main internal components working together.


1. V8 Engine

  • Converts JavaScript into machine code - JIT (Just In Time Compiler)

  • Executes your JS code

  • Manages memory (call stack & heap)

But V8 cannot handle file system, network, or async tasks.


2. Libuv (C library)

  • Handles asynchronous operations

  • Manages:

    • Event loop

    • Thread pool

    • File system and network tasks

This is what makes Node.js fast and non-blocking. Heavy or slow tasks are done in the background so your main code doesn’t stop.


3. Node.js Bindings (The Connector)

  • Written in C++

  • Works as a bridge between V8 and Libuv

When you write:

fs.readFile("file.txt", callback);

This is what happens:

  • V8 sees the function but doesn’t know how to read files

  • It goes through Node.js bindings

  • Bindings send the task to Libuv

  • Libuv performs the file reading in the background

So bindings basically help JavaScript say: "Hey Libuv, please handle this task"


So what actually happens?

  1. V8 runs your JavaScript

  2. Async task appears

  3. Bindings pass it to Libuv

  4. Libuv does the work in background

  5. Result comes back via event loop

  6. V8 executes the callback


Final Thought

Node.js is powerful not because of JavaScript alone, but because of how V8, Libuv, and bindings work together.

Now when you write something like fs.readFile or setTimeout, you know what’s happening behind the scenes.

11 views