Node.js is a JavaScript runtime based on the V8 engine, the same one used by Google Chrome. With it, JavaScript code stops running only inside the browser and can run on your computer or on a server.

How it works

Node.js uses an event-driven model. Instead of waiting for each task to finish, it registers what needs to be done and keeps handling other requests. When the response arrives, it runs the function that was waiting for it.

This works well for tasks that spend a lot of time waiting, such as reading files, querying a database, or calling an AI model API.

Node.js comes with npm, the package manager that gives access to a huge library of ready-made code. To install a dependency, just run a command:

Terminal
npm install express

To run a file, you use:

Terminal
node servidor.js

Practical example

Imagine you have an online store and you want to receive a WhatsApp notification whenever a new order comes in. With Node.js, you create a small server that receives the store's alert, formats the message, and sends it to your phone.

Another example: a developer creates a script that reads a list of products, sends each description to a language model, and saves the improved text to a file.

JavaScript · servidor.js
const http = require('http');

http.createServer((req, res) => {
  res.end('Olá do Node.js');
}).listen(3000);

If you run this file and open localhost:3000 in the browser, you will see the message.

What it's for

Node.js is used for several types of projects:

  • APIs and web servers, which power websites and applications.
  • Command line tools, like many code agent CLIs.
  • Automations, integrations and bots.
  • AI applications, which call models via API and organize the flow between them.

One big advantage is using the same language on the front end and back end. One person can handle both parts without switching languages.

Many AI tools for programming are distributed as npm packages, so having Node.js installed is often the first step to try them out. bridgecode also lives within this ecosystem by orchestrating agents that work on Node.js projects.

Difference between Node.js and JavaScript

JavaScript is the language. Node.js is one of the places where it can run. The browser is another. That is why in Node.js you do not have access to the page DOM, but you gain access to files, network and system processes.

In short, Node.js turned JavaScript into a general purpose language, and today it is a common piece in software and AI projects.