Internals of Node.js

Yonatan Merkebu
2 min readOct 23, 2022

In this post, we will discuss how Node.js actually works internally.

Node.js has a collection of dependencies internally that actually executes our code.

The two most important ones are the V8 and libuv projects.

V8 is an open-source project by Google. The project enables the execution of javascript outside of the browser. It is used to translate Node.js values that we place inside our code like arrays, objects, booleans.. and translate it to their C++ equivalent.

libuv is also an open-source project that gives Node access to the operating systems underlying file-system, networking… and also handles some sort of concurrency as well.

If you go inside the Node.js repo on GitHub, you can see how Node uses V8 and libuv.

You might ask what the purpose of Node.js actually is.

The first thing to understand is, these libraries are not entirely javascript. You can't just use them directly. libuv is almost 100% C code and V8 is 70% C++ and 30% javascript.

Node.js gives us an interface to relate our javascript code to the actual C++ libraries to interpret and execute our javascript code.

Node.js provides wrappers and consistent and unified APIs for us to use inside our projects. Example: HTTP, crypto, path…

This is how Node.js internally works and in the next post, we will look into the Event Loop and Threads. Follow me not to miss them.