Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Node.js Bindings

The Node.js binding has a book of its own:

dynamic-config for Node.js

npm install dynamic-config-node
import { DynamicConfig, zodValidator } from "dynamic-config-node"
import { z } from "zod"

const Database = z.object({ host: z.string(), port: z.number().default(5432) })

const db = await new DynamicConfig({ key: "db", validate: zodValidator(Database) })
  .file("config.toml")
  .env("APP_")
  .initAndCurrent()
//    ^? { host: string; port: number }

Rust resolves, your schema validates, JavaScript reads a cached object. One prebuilt binary per platform through Node-API, so the same binary serves every Node version the package claims and nothing compiles at install time.

Why it is a separate book

The same reason the Python one is: the reader is a different person. A Node programmer arriving from npm should not land in a sidebar whose first twenty entries are Rust, and a Rust programmer carries no chapters about an event loop. The store crates stay in this book — a Consul chapter is read by whoever read the builder tour.

What is in it

ChapterWhat it answers
API ReferenceEvery method, every argument, every default
SchemasZod, Ajv, a function of your own, and no schema at all
Watching & HooksThe watcher, onReload, onChange, and the rejected edit that changes nothing
Web FrameworksExpress, Fastify, NestJS, Next.js — and where the browser's boundary is
Remote StoresA store written in JavaScript, and where the eight Rust ones are
Implementation DetailsThe thread rule, and why every load is async
LimitationsWhat it will not do, and why