Node.js is a JavaScript runtime that runs JavaScript outside the browser — on servers, your computer and the command line. It is built on Chrome's V8 engine.
What can you build?
- Web servers and REST APIs
- Real-time apps: chat, live notifications (WebSockets)
- Command-line tools
- Build tools (Vite, Webpack and npm itself run on Node)
- Microservices and backend for React, Vue or mobile apps
Why is Node.js fast?
Node uses a single thread with a non-blocking, event-driven model. While it waits for a database or a file, it handles other requests instead of sitting idle. This makes it great for apps with many users doing I/O.
Node.js vs browser JavaScript
| Browser | Node.js |
|---|---|
window, document, DOM |
No DOM |
| Limited file access | Full file system access (fs) |
| Runs on the user's device | Runs on the server |
Same language, different environment. Know basic JavaScript (variables, functions, objects, arrays) before you start.
Example
// hello.js
const name = 'AgyanAdda';
console.log(`Hello from Node.js, ${name}!`);
console.log('Node version:', process.version);
// Run in the terminal:
// node hello.js
Output: Hello from Node.js, AgyanAdda! and the Node version, e.g. Node version: v22.x.x.