# Node.js

> A way to run JavaScript on servers and computers, outside the browser.

- Level: Intermediate
- Topics: Software
- URL: https://tidbit.legios.com.ar/nodejs/
- In Spanish: [Node.js](https://tidbit.legios.com.ar/es/nodejs/)

For its first years, JavaScript lived only inside web browsers. **Node.js**, released by Ryan Dahl in 2009, took Google Chrome's JavaScript engine, called V8, and wrapped it so it could run on any computer, with access to files, the network and everything a server needs. Suddenly the same language could run both the frontend and the backend.

Node.js is built around an **event loop**. Instead of waiting for a slow task, like reading a file or querying a database, it starts the task, moves on to other work and comes back when the result arrives. That makes a single Node.js process good at juggling many connections at once, which suits APIs, chat apps and real-time tools. It is a poor fit for heavy number-crunching, which blocks the loop for everyone.

Node.js also brought **npm**, the package manager and registry where developers share ready-made code. Today most web tooling runs on Node.js, even for teams whose servers use another language: build tools, test runners and frameworks like Next.js are installed and run with it.

## An analogy

A waiter serving many tables at once. They take an order, pass it to the kitchen and move on to the next table instead of standing by the stove; when a dish is ready, they bring it out.

## Keep in mind

- Node.js runs JavaScript outside the browser, using Chrome's V8 engine.
- Its event loop handles many connections without waiting on each one.
- npm, its package registry, is where most JavaScript libraries live.
- It shines when work is mostly waiting on networks and disks, not heavy computing.

## Go deeper

- [Introduction to Node.js (official docs)](https://nodejs.org/en/learn/getting-started/introduction-to-nodejs)
- [Express/Node introduction (MDN)](https://developer.mozilla.org/en-US/docs/Learn_web_development/Extensions/Server-side/Express_Nodejs/Introduction)
- [Node.js (MDN glossary)](https://developer.mozilla.org/en-US/docs/Glossary/Node.js)

## Related terms

- [JavaScript](https://tidbit.legios.com.ar/javascript/): The programming language that runs inside web pages and makes them interactive.
- [Web browser](https://tidbit.legios.com.ar/web-browser/): The app that fetches web pages from the internet and draws them on your screen.
- [Google](https://tidbit.legios.com.ar/google/): The search company that gives most products away and makes its money on ads.
- [Server](https://tidbit.legios.com.ar/server/): A computer whose job is to answer requests from other computers, all day, every day.
- [Frontend and backend](https://tidbit.legios.com.ar/frontend-and-backend/): The part of an app you see and touch, and the part that works behind it.
- [Database](https://tidbit.legios.com.ar/database/): An organized store of data that programs can search and update safely.
- [API](https://tidbit.legios.com.ar/api/): The menu of things one program lets another program ask for.
- [Software library](https://tidbit.legios.com.ar/software-library/): Ready-made code for a common task that programmers plug into their own programs.
