
# What is nstdlib?

> Node.js standard-library modules for any JavaScript runtime.

**nstdlib** is a small, runtime-agnostic version of the Node.js standard
library. It packages modules such as `path`, `stream`, `url`, and `assert` as
plain ES modules for browsers, workers, bundlers, and other JavaScript
runtimes. It is built from Node.js's own source rather than reimplemented, so
you can use familiar imports such as `import path from "nstdlib/path"`
without running Node.js itself.

## Who it's for

- **Bundlers** - `nstdlib/*` subpaths are ordinary ES modules a bundler can
  import, alias `node:*` specifiers to, and tree-shake like any package.
- **Workers and other constrained runtimes** - Cloudflare Workers, service
  workers, and similar places Node itself can't run, but you still want
  `path.join`, a real `URL`, or `EventEmitter`.
- **Browsers** - the pure-JavaScript half of the standard library runs in a
  browser tab. The half that needs an operating system fails loudly instead
  of silently - see [Usage](/nstdlib/usage).
- **Other JavaScript runtimes** - anything that is neither Node nor a
  browser.
- **[nstd](/guide)**, the standalone runtime binary built on
  top of nstdlib - it pairs nstdlib with a host written in Zig so it can run
  real Node programs with no Node installed. It's the proof that nstdlib
  works outside Node.

## Compatibility

A good part of the pure-JavaScript half of Node's standard library behaves
like the real thing; the half that needs the operating system has more gaps.
Within a single module some exports are fully verified against real Node,
some only have the right shape and throw when you call them, and some are
simply untested. The [API pages](/api) list every module's actual,
measured status.

## nstdlib vs. nstd

This page, and the rest of this section, are about the package: something you
`npm install` and import from your own code. [What is nstd?](/guide)
covers the other half of this project - a single executable, built from
nstdlib, that runs Node programs with no Node installed at all. If you want a
library to import, you're in the right place; if you want to run a `.js` file
without installing Node, that's `nstd`.
