How Node.js works

node-js

Updated August 29, 2026

Node.js is a runtime that executes JavaScript outside a browser. It uses Google's V8 engine and exposes server-side APIs such as files, networking, and processes.

A Node process commonly runs JavaScript on one main event-loop thread. When code starts network or file I/O, Node can ask the operating system or its worker pool to do the waiting, then queue a callback or promise continuation when the operation completes. That is why an I/O-heavy server can handle many connections without one thread per request.

import { readFile } from 'node:fs/promises';

const text = await readFile('message.txt', 'utf8');
console.log(text);

The event loop is not magic: a long CPU-bound loop blocks other callbacks. Move expensive CPU work to a worker, a separate process, or a service when appropriate. Promises and async/await make asynchronous control flow easier to read, but they do not make synchronous work non-blocking. Node is a runtime, not a language or a framework; libraries and frameworks sit on top of it.

Sources

related.

Ruslan Osipov

Ruslan Osipov

About the author