node-comfortv2.0.0
v2.0.0 Rewritten from the ground up. See what changed

The standard library Node.js deserves

Logging, config, validation, HTTP, SQLite, dates, crypto, CLI tools and 500+ helpers. One package, zero dependencies, documented right in your editor.

$npm install @ix-xs/node-comfort
app.js
const nc = require("@ix-xs/node-comfort");

// Checked at startup: every problem is reported at once
const config = nc.env.validate({
  PORT: { type: "port", default: 3000 },
  DATABASE_URL: { type: "url" },
  CACHE_TTL: { type: "duration", default: "5m" },
});

nc.info(`Listening on port ${config.PORT}`);
nc.log("<% green bold ✔ Ready %> in <% dim 42ms %>");
0dependencies
500+documented functions
~3 msto require
100%typed, in JS and TS

Why node-comfort

Most projects install the same twenty packages, and hundreds of dependencies with them. Node.js can do most of it on its own now. This is the missing layer on top.

Nothing else to install

Built only on Node's own modules: fetch, Intl, node:crypto, node:sqlite. No dependencies, no install scripts, nothing else to audit.

Your editor already knows

Every function, parameter and option is documented and typed. Hover, completion and type checks work in JavaScript and TypeScript.

Loads in about 3 ms

Namespaces load the first time you use them. A script that only logs never loads the database or the HTTP client.

Safe by default

Prototype-pollution-proof objects, scrypt passwords, AES-256-GCM, constant-time comparisons, parameterized SQL, atomic file writes.

Speaks every language

Dates, durations, numbers, currencies and plurals in any language and time zone, through the Intl data Node already ships.

One consistent API

Durations are always "5m" or milliseconds, options always come last, and every error carries a stable code you can check.

Everything in one import

23 namespaces, each with a guide and a full reference.

nc.logger

A console logger that works with zero setup: levels, colors, a small markup for styling,...

nc.fs

Files and folders without try/catch: read and write text or JSON (atomically), copy, move,...

nc.checker

Type checks and validators. Every isX accepts anything and never throws, and most of them are...

nc.env

Environment variables you can trust: .env loading, typed getters, and validate() to check your...

nc.errors

The errors node-comfort throws. They all extend NodeComfortError (itself a regular Error) and...

nc.utils

Everyday helpers: wait, when, dontCrash, and JSON functions that don't throw. They are also...

nc.str

String helpers: case conversion, slugs, truncation, templates, wrapping, fuzzy matching,...

nc.num

Numbers: clamping, rounding that gets decimals right, statistics, and formatting for humans...

nc.arr

Array helpers. None of them mutate what you pass in, and item types carry through...

nc.obj

Object helpers: deep clone, merge, equality, diff, typed dot paths, pick and omit. Inputs are...

nc.time

Dates and durations: formatting, relative time, calendar math, time zones and scheduling, in...

nc.id

Unique ids: UUID v4 and v7, ULID, nanoid-style ids, Snowflakes, tokens and short codes. All of...

nc.schema

Validate data with schemas, in the spirit of zod. Describe your data once and get both a...

nc.func

Function helpers: debounce, throttle, memoize, retry with backoff, timeouts, error handling...

nc.async

Promises and concurrency: map with a limit, queues with priorities, mutexes, polling, and...

Cache

An in-memory cache with a size limit (the least recently used entries go first), expiry per...

Emitter

A small typed event emitter. Declare your events once, and your editor checks every event name...

nc.http

An HTTP client on top of fetch: JSON by default, query objects, base URLs, timeouts, safe...

SQLite

SQLite made pleasant, on the engine built into Node.js (22.13+): CRUD with rich filters, JSON...

nc.cli

What you need for command-line tools: typed arguments with a generated --help, prompts,...

nc.color

Terminal colors you can chain, like chalk. Truecolor is supported and downgraded on older...

nc.sys

Processes and the system: run commands and get their output, find executables, shut down...

nc.crypto

Crypto without the footguns, built on node:crypto: hashes, HMAC, password hashing (scrypt),...

Try it in two minutes

Install it, require it, and type nc. in your editor.