Node.js: runtime, files and HTTP services
Node.js is a JavaScript runtime built on Googleโs V8 engine and the libuv I/O library. It runs JavaScript outside the browser, which makes it the platform behind many web servers, APIs, command-line tools, build systems and real-time services. Because the same language runs in the browser and on the server, full-stack teams share skills, tooling and sometimes code across both.
What is Node.js
Section titled โWhat is Node.jsโNode.js runs your code on a single main thread with an event loop and non-blocking I/O. Instead of dedicating a thread to each request and blocking while the database answers, it starts the I/O, continues with other work and runs your callback or await continuation when the result arrives. This makes one process efficient at handling many concurrent connections, as long as the work is mostly waiting on networks, disks and databases rather than computing.
The npm registry gives Node.js the largest package ecosystem of any platform, and the runtime itself now covers much of what used to need packages: fetch, a test runner (node --test), watch mode and .env loading are built in.
Where Node.js fits well
Section titled โWhere Node.js fits wellโ- REST and GraphQL APIs, and backend-for-frontend services that aggregate other APIs
- Real-time features: WebSockets, server-sent events, chat and notifications
- Streaming: file uploads and downloads, proxies, log and data pipelines
- Command-line tools, code generators and build tooling (Vite and ESLint run on Node.js)
- Server rendering for React, Vue and other front-end frameworks
Where to be careful
Section titled โWhere to be carefulโCPU-bound work such as image processing, large report generation or heavy cryptography blocks the event loop and stalls every other request in that process. Move it to worker_threads, a job queue or a service written for that workload. Node.js is also a runtime, not a framework: structure, validation and error handling come from your choices and libraries such as Express.
Which version to use
Section titled โWhich version to useโNode.js releases a new major version every six months; even-numbered versions become Long Term Support (LTS) releases. As of November 2026:
| Line | Status | End of life |
|---|---|---|
| Node.js 26 (Lithium) | Active LTS since October 2026 | April 2029 |
| Node.js 24 (Krypton) | Maintenance LTS | April 2028 |
| Node.js 22 (Jod) | Maintenance LTS | April 2027 |
Use an Active LTS line for production and plan upgrades before end of life. The samples in this section were run with Node.js 22.23, so they work on every supported line.
Reading path
Section titled โReading pathโRead in this order; each page builds on the previous one.
| Step | Page | What you get from it |
|---|---|---|
| 1 | Runtime, modules, npm and config | The event loop and what blocks it, ES modules versus CommonJS, package.json and lockfiles, and validated environment configuration. |
| 2 | Files and streams | node:fs/promises, portable paths, streams, pipeline() and backpressure for large data. |
| 3 | HTTP, Express and REST APIs | The built-in http module, Express 5 routing and middleware, error handling, validation, authentication and REST design. |
| 4 | Node.js interview questions | Practice questions across the runtime, async patterns, modules, streams and APIs. |
Core concepts at a glance
Section titled โCore concepts at a glanceโ| Concept | Where it is covered |
|---|---|
Event loop phases, process.nextTick, microtasks |
Event loop and async IO |
import, require, "type": "module" |
Modules |
npm ci, scripts, semver ranges |
npm and packages |
.env files and configuration |
Environment variables |
| Reading, writing and listing files | File system promises API |
| Large data and compression | Streams and pipelines |
| Routers, middleware, error handlers | Express routing, middleware, error handling |
| Status codes, validation, pagination | REST API design |
Where to go next
Section titled โWhere to go nextโ- Front-end frameworks that use Node.js tooling: React and Vue.
- A .NET alternative for interactive web UI: Blazor.