Skip to content
Latchkey

What Is Node.js? The JavaScript Runtime Explained

Node.js is a runtime that lets JavaScript run outside the browser, powering servers, build tools, and most of the CI/CD JavaScript toolchain.

Node.js took the V8 JavaScript engine from Chrome and wrapped it with APIs for files, networking, and processes, so JavaScript could run on servers and command lines. It is the foundation under npm, bundlers, test runners, and countless CI tools.

What Node.js is

Node.js is an open-source, cross-platform runtime built on the V8 engine. It provides a standard library for filesystem, HTTP, streams, and child processes, plus the module system that lets you import packages. When you run a build script or a test runner written in JavaScript, Node.js is executing it.

The event loop

Node.js uses a single-threaded, non-blocking event loop. Instead of waiting on slow I/O, it registers callbacks and continues, processing results as they complete. This makes it efficient for I/O-heavy work. CPU-bound work can still block the loop, which is why heavy tasks are often offloaded to worker threads or separate processes.

A small example

A few lines start an HTTP server, showing the runtime and its standard library.

A minimal Node.js server
import { createServer } from "node:http";

createServer((req, res) => {
  res.end("hello from node");
}).listen(3000);

Role in CI/CD

Node.js is everywhere in CI even for non-JavaScript projects: package managers, linters, bundlers, and many GitHub Actions are Node-based. Pipelines pin a Node version (often via a setup step or .nvmrc) so builds are reproducible. Mismatched Node versions between local and CI are a common source of "works on my machine" failures, so the version is worth being explicit about.

Alternatives

Deno and Bun are newer JavaScript and TypeScript runtimes. Deno emphasizes security and built-in TypeScript; Bun focuses on speed and bundles a package manager and test runner. Node.js remains the default for its enormous ecosystem and long-term support releases.

Key takeaways

  • Node.js runs JavaScript outside the browser, on the V8 engine.
  • Its non-blocking event loop suits I/O-heavy workloads.
  • It underpins most CI/CD JavaScript tooling; pin the version for reproducible builds.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →