What is Node.js? A Beginner's Guide to Server-Side JavaScript in 2026
Learn what Node.js is, why it changed JavaScript forever, and how its event-driven architecture powers servers, tools, and APIs in 2026. A friendly guide for absolute beginners.
JavaScript started as a language that ran only inside browsers. Then in 2009 Ryan Dahl wrapped Google's V8 engine with a C++ runtime, exposed file-system and networking APIs, and called it Node.js. Suddenly the same language that animated buttons could spin up an HTTP server, watch the file system, talk to a database, and ship a CLI. Almost every modern tool you touch — npm, Vite, Next.js, ESLint, Prettier, your build pipeline — runs on Node.
This guide explains what Node.js really is, how it differs from the browser, what npm and node_modules actually do, and how to write your first script. By the end you will understand the foundation every JavaScript backend tutorial assumes you already know.
What Node.js Actually Is
Node.js is a runtime — software you install on your machine that executes JavaScript files outside the browser. Under the hood it is V8 (Chrome's JavaScript engine) plus a C++ event loop and a standard library that gives JS the ability to read files, open sockets, and run servers.
When you run node app.js, Node:
- Reads the file from disk.
- Hands it to V8 to compile and execute.
- Lets the script schedule async work (HTTP requests, file reads, timers) on the event loop.
- Exits when there is nothing left to do.
The current LTS in 2026 is Node.js 22 ("Jod"), released October 2024 and supported until April 2027. Node.js 24 is the active line. New projects should target Node 22 or 24. Anything older than 20 is end-of-life.
How Node Differs from Browser JavaScript
Same language, different APIs. The differences worth knowing on day one:
- No DOM. No
document, nowindow, nofetchuntil Node 18+ (which now has it built in). - File system access.
import { readFile } from "node:fs/promises"lets you read and write files. - Process and OS access.
process.env,process.argv,os.cpus()— things browsers (rightly) forbid. - Modules. Modern Node uses ES modules (
import/export) whenpackage.jsonhas"type": "module". CommonJS (require) still works for legacy code. - Single-threaded with an event loop. Long synchronous work blocks everything. You write async code by default.
Because the language is the same, React developers can move to backend Node code on their first day with no syntax overhead — only new APIs to learn.
npm, Packages, and node_modules in 90 Seconds
npm (Node Package Manager) ships with Node and gives you access to the public registry of over 3 million packages. npm init -y creates a package.json. npm install express adds Express as a dependency, downloads it into node_modules/, and pins the version in package.json and package-lock.json.
npm init -y
npm install express
node app.jsTwo files matter:
package.json— your project's manifest: name, version, scripts, declared dependencies.package-lock.json— the exact version of every package and sub-package, sonpm ciproduces identical installs everywhere.
Alternatives exist (pnpm and Bun are excellent and faster), but npm is the default and works for everything.
Your First Real Script
Make a file, write some JavaScript, run it:
// hello.js
import { readFile } from "node:fs/promises";
const text = await readFile("hello.txt", "utf8");
console.log(`File says: ${text}`);
console.log(`Running on Node ${process.version}`);Save, then node hello.js (with "type": "module" in package.json so import works). That is server-side JavaScript: file I/O, environment access, and direct execution without a browser anywhere in sight.
For an HTTP server, the standard library can do it in eight lines, though most people reach for Express immediately because it makes routing and middleware much nicer.
What People Actually Build with Node
Five categories cover almost everything:
- HTTP backends and APIs — Express, Fastify, Hono, NestJS, or your framework's built-in server (Next.js, Remix, SvelteKit all run on Node).
- Build tools and bundlers — Vite, Webpack, esbuild, Rollup, Parcel.
- CLIs — almost every dev tool you install with
npm i -gis a Node script. - Real-time services — WebSocket servers, chat apps, live dashboards (Node's event loop is great at this).
- Scripts and automation — file processors, scrapers, deploy pipelines, codegen.
If you have used Next.js, you have already been using Node — its dev server and build pipeline run on it.
How to Install Node.js the Right Way
Three options, ordered by what most professionals do in 2026:
- fnm (
brew install fnmon macOS) or Volta — version manager. Lets you switch Node versions per project. Recommended. - Official installer from nodejs.org. Fine if you only ever need one version.
nvm— older, popular, slower than fnm. Still works.
Check the install with node --version and npm --version. You want Node 22 LTS or newer.
Common Mistakes Beginners Make
- Installing Node globally with
sudo. Use a version manager (fnm) instead — it avoids permission errors and lets you change versions per project. - Committing
node_modulesto git. It can be hundreds of megabytes..gitignoreit. - Running heavy CPU work in a single request handler. Node is single-threaded — long work blocks every other request. Move it to a worker thread or a queue.
- Using
varandrequirein 2026. Modern Node usesconst/letand ES modules. - Ignoring
package-lock.json. Commit it; it is what makes installs reproducible.
Quick Reference
- Run a file:
node app.js - Init a project:
npm init -y - Install:
npm install <pkg>(-Dfor dev only) - Run a script from
package.json:npm run <name> - Reproducible install:
npm ci - Use ES modules: add
"type": "module"topackage.json - Built-in modules:
node:fs,node:path,node:http,node:crypto,node:url - Env vars:
process.env.MY_VAR(load .env files vianode --env-file=.env app.jsin Node 20+) - Check version:
node --version
Rune AI
Key Insights
- Node.js is a JavaScript runtime built on V8 that executes JS outside the browser.
- Use Node 22 LTS or 24 in 2026; install via fnm or Volta for easy version switching.
- npm manages dependencies; commit
package.jsonandpackage-lock.json, ignorenode_modules. - Node is single-threaded with an async event loop — write async code and never block the main thread.
- Common uses: HTTP APIs, build tools, CLIs, real-time services, and almost every modern web framework.
Frequently Asked Questions
Is Node.js a programming language?
Node.js vs Deno vs Bun in 2026?
Do I need to know front-end JavaScript first?
Is Node fast enough for production?
Why so many `node_modules` files?
Conclusion
Node.js is JavaScript with a runtime that lets it touch the file system, open sockets, and run servers. Once you understand that, every backend tool — Express, Next.js, npm itself, your build pipeline — stops feeling like magic. Install Node 22, write a tiny CLI script, then build a small HTTP API. By the second project, the runtime fades into the background.