Stop 02 · Node.js FundamentalsTopics · 1/18

Node.js Runtime

Part of the Backend Developer Roadmap

In short

JavaScript once lived only inside browsers. Node.js let it out, with access to files, networks and processes, so you can build a whole backend in a language you already know.

A JavaScript runtime built on Chrome's V8 engine that lets you run JS outside the browser — the foundation that turned JavaScript into a full backend language.

The mascot cook stands in a fully equipped dhaba kitchen holding a ladle.

Think of it like this

From home kitchen to a full dhaba

At home, the cook can only use what the house allows. Node.js gives the same cook a full dhaba kitchen: gas, water, a delivery window, a phone line. The cooking skill (JavaScript) stays the same, the tools around it grow.

Watch it happen

What's inside Node.js

Node.js
V8 engine
libuv
Core modules
node:fs
node:http
npm (bundled)

1/5Node.js is a program you install. Run node app.js and it executes your JavaScript outside any browser.

The big ideas

What you need to know

No browser, no DOM

There's no window, document or localStorage in Node. Instead you get process, fs, Buffer and network modules.

One thread for your JS

Your JavaScript runs on a single main thread. Slow work like disk and network happens in the background.

Web APIs where they fit

Modern Node includes fetch, URL, setTimeout and crypto.randomUUID, so much browser knowledge carries over.

Use an LTS version

Even-numbered releases become Long Term Support and get fixes for years. Run those on servers.

See it in code

Walk through the code

js
1// info.mjs  (run: node info.mjs)2import os from "node:os";3import { readFile } from "node:fs/promises";4 5console.log("Node version:", process.version);6console.log("Platform:", process.platform, os.arch());7console.log("CPU cores:", os.availableParallelism());8 9const me = await readFile(new URL(import.meta.url), "utf8");10console.log("This file has", me.split("\n").length, "lines");11 12console.log(typeof window); // "undefined": no browser here

1/4Core modules are imported with the node: prefix.

Top-level await works because .mjs files are ES modules. Everything used here comes built into Node, so there's nothing to npm install.

Save yourself the pain

Common mistakes

Oops

Using window, document or localStorage in Node code.

Do this instead

Node has no page. Use process, fs and environment variables instead, and keep browser-only code in the frontend.

Oops

Running an odd-numbered 'Current' release in production.

Do this instead

Pick an Active LTS release for servers. It gets security fixes for much longer.

Your mission

Meet your runtime

~10 min

Quick check

Which of these exists in Node.js but not in a normal browser tab?

Go deeper

  1. 1Install Node.js and run a simple script from the command line.
  2. 2Learn what Node adds on top of V8: file system access, networking, modules.
  3. 3Compare Node's single-threaded, event-driven model to traditional multi-threaded servers.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge