Nodea — logo

Node.js

Node.js is an open-source runtime environment that allows JavaScript code to run outside the browser — on the server. It is built on the V8 engine (the same one that powers Chrome) and lets you use a single language on both the front end and the back end of an application. Since its 2009 release it has become the foundation of many modern web stacks.

How Node.js works

Node.js's defining feature is its non-blocking, asynchronous I/O model based on an event loop. Instead of creating a separate thread for each request and waiting for an operation to finish (for example a database read), Node.js dispatches it and immediately moves on to other tasks, handling the result once it is ready. As a result, a single process can efficiently serve a very large number of concurrent connections while using few resources.

The Node.js ecosystem is built around the npm package manager, which provides access to hundreds of thousands of ready-made libraries. Node.js underpins popular back-end frameworks such as Express.js, as well as front-end tooling (bundlers, transpilers) and full-stack frameworks like Next.js.

Practical application

Node.js is especially well suited to network-intensive applications: APIs and REST services, real-time apps (chats, notifications, WebSocket), microservices and tools handling many simultaneous connections. It is less optimal for CPU-heavy computation, which can block the event loop.

Running a Node.js application requires an environment where the process stays up continuously, so typical PHP shared hosting will not do. The natural choice is a VPS or dedicated server, which gives full control over the environment, the process manager and the Node.js version — letting you keep the application running stably in production.

Powiązane pojęcia

Najczęstsze pytania

Is Node.js a programming language?

No. Node.js is a runtime that lets you execute code written in the JavaScript language outside the browser, on the server. The language itself remains JavaScript — Node.js provides it with the V8 engine plus access to the file system, network and external libraries installed via npm.

What hosting does a Node.js app require?

A Node.js app runs as a continuously running process, so it will not work on typical PHP shared hosting. You need a VPS or dedicated server, or a platform with a Node.js runtime, where the application process can be started and kept alive, for example by a process manager.