Backend

Node.js

A server-side JavaScript runtime built on the V8 engine with an event-driven, non-blocking I/O model.

What it is

Node.js runs JavaScript outside the browser. Under the hood sits Chrome's V8 engine and the libuv library, which handles networking, files and timers through an event loop.

Your code runs on one thread, but I/O does not block it: while one request waits for the database, the event loop serves others. For heavy computation there are worker_threads and separate processes.

The npm ecosystem is the largest of any language. That made Node.js the base for APIs, BFFs, build tools (Vite, webpack) and server-side rendering.

Use it when

  • I/O-heavy services: REST and GraphQL APIs, chats, streaming, websockets.
  • The team already writes JavaScript or TypeScript and wants one language on front and back.
  • You need build tooling, CLI utilities or a BFF for a frontend.

Avoid it when

  • Long CPU-bound jobs (video processing, ML) on the main thread: they block the event loop.
  • You need strict static typing without extra tooling: use TypeScript or another language.

Key concepts

Event loop
A loop that takes ready callbacks from queues and runs them one at a time on the main thread.
libuv
The C library for async I/O and the thread pool underneath Node.
Streams
Processing data in chunks without loading the whole file into memory.
npm / ESM
The package manager and the modern import/export module system.

Example

A minimal HTTP server with no dependencies.

Interview questions

  1. 1. What is the event loop?

    It is the mechanism that takes finished async operations from queues and runs their callbacks on one thread. It lets Node serve thousands of connections without a thread per connection.

  2. 2. Why should you not block the main thread?

    While synchronous code runs, the event loop is stuck and every other request waits. Heavy computation moves to worker threads or a separate service.

  3. 3. How does process.nextTick differ from setImmediate?

    nextTick runs right after the current operation, before the loop moves on, while setImmediate runs in the check phase after I/O. Too many nextTick calls can starve the loop.

Logos belong to their owners and are used for identification only. Icons: Simple Icons (CC0), Devicon (MIT).