My First Week with Node.js: Understanding the Core, Modules, and the Magic Behind the Scenes

My First Week with Node.js: Understanding the Core, Modules, and the Magic Behind the Scenes

This week, I dove into the foundational world of Node.js.
Coming from the browser-based JavaScript environment, this shift to server-side JS gave me a fresh perspective on how JavaScript actually works under the hood.

I also briefly explored Generative AI, but quickly realized that my curiosity lies deeper in the backend world — in understanding real systems, performance, and building dev tools.

So here’s what I learned in my first deep week with Node.js.👇


✅ Topics Covered This Week

  • What is ECMAScript and its role in JavaScript

  • V8 Engine and how it runs JavaScript (written in C++)

  • Node.js REPL environment

  • JavaScript hierarchy:
    JS (High Level) → Assembly → Binary → Machine Understanding

  • The difference between window (Browser) and global (Node)

  • globalThis: the universal way to access global scope across environments

  • The require() function – how it works internally

  • CommonJS (CJS) vs ES Modules

  • IIFE (Immediately Invoked Function Expressions)

  • Explored the Node.js GitHub repository to understand open-source architecture and contribution model


🧠 Deep Dives & Personal Takeaways

🔹 ECMAScript & V8 Engine

Reading about ECMAScript made me realize it’s the actual standard that JS engines follow.
Then discovering how V8 (written in C++) compiles JavaScript to machine code using Just-In-Time compilation blew my mind.

🔹 REPL & Global Scope

Using the Node REPL was fun. Playing with global objects made the difference between browser vs Node very clear.

  • In browser, window is the global scope

  • In Node.js, it’s global

  • But globalThis works everywhere – one API to rule them all!

🔹 Modules: require() & CommonJS

I didn’t just use require() — I dove into how it actually works. From module caching to wrapping code in IIFEs internally, Node does a lot behind the scenes to support modular code.

Also understood the upcoming shift from CommonJS to ES Modules, and the differences in import/export patterns.

🔹 IIFE & JS Execution Hierarchy

Studying IIFE gave me a better sense of scoping. I also looked into how JS code goes from human-readable to binary execution through several layers — fascinating stuff!


🐛 Challenges I Faced

  1. Wrapping my head around how exactly require() executes internally

  2. Understanding the difference between module formats (CJS vs ESM)

  3. Transitioning mentally from frontend JS to server-side concepts


🧩 How I Solved Them

  • Explored GitHub repos & open-source Node source code for clarity

  • Watched deep-dive YouTube videos explaining require() internals

  • Created mini test scripts in REPL to experiment with module formats and scope


📦 Resources That Helped


🔮 Next Week’s Focus

Starting with Solidity and Blockchain – Smart Contracts, Remix IDE, and learning Ethereum fundamentals.
Aiming to build real-world dApps soon!


🧠 Final Thought

This week taught me the real power of slowing down and understanding the "why" behind the tech.
Instead of just using features, I now want to know how they work, why they were made that way, and how to build with them more effectively.

See you in next week’s update! 💻💥

0
Subscribe to my newsletter

Read articles from Aditya Singh Rajput directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Aditya Singh Rajput
Aditya Singh Rajput