Skip to content

Production Posture

A one-screen checklist to run before you ship. Each item is one line, linked to the page that covers it in full.

A short checklist to run before you ship. Each item is one line and a link to the page that covers it in full.

  • Use a durable storage on every secure connection. A memory-backed store mints a new crypto identity on each load, and the peer’s pin rejects every one after the first, permanently. → Identity & Trust
  • Know how to recover an identity_pin_mismatch. It’s permanent for that id+key pair. Recover under a new persistent id, or clear the peer-side pin. → Identity & Trust
  • On Cloudflare, persist the TOFU pins (the serveWireDurableObject default; serveWorker keeps them in memory unless given a verifyKeyResolver), so a hibernation wake doesn’t forget them and trust whichever key shows up next as if it were first contact. → Identity & Trust
  • Pick a security level deliberately. authenticated proves the device; use encrypted for anything that must stay sealed past TLS. → Security Levels
  • Or run level none behind your own sign-in, inside TLS, with allowedOrigins set. A secure endpoint takes plain callers too, unless none is left out of its securityLevel. → A Plain Endpoint
  • Know what each browser can run. The secure levels need WebCrypto curves that some browsers lack. → Browser Support
  • Set a call’s timeout where ten seconds is wrong, and retry a timed-out call only if it is safe to run twice. → Calling Actions
  • Bound your state cardinality. The engine caps each frame and write, not the total tree. Cap growing records (rosters, logs) with a rule. → Limits & Production
  • Prefer transient / ephemeral for presence-shaped state, so it never persists and cold-starts empty. → Limits & Production
  • Mind at-rest storage. encrypted protects data on the wire, not the DO’s SQLite. Keep secrets out of persisted state, and out of rejection errors. → Realm Security
  • The library logs no payload content by default. Nothing about a write’s values, an action’s input, or a realm’s state leaves the process on its own. Any observation you turn on can expose user data, so scope wireTap to an allow-list, not whole frames.
  • Devtools are inert in production, fail-closed. The handles disable when NODE_ENV === "production" (or stage: "production" on a DO), the token never lives in the app bundle, and no endpoint is registered. Shipping a build with devtools wired costs nothing. → The Devtools Window → in production
  • Upgrade every @nice-code/* package in lockstep, and rely on the wire-format skew promise to deploy without a flag-day. → Stability & Versioning
  • Check lockstep where you check everything else. nice-code-lockstep fails when two versions are installed. → Checking lockstep
  • Pin a deployed API’s version before you change it, so older clients keep working. → Evolving a deployed API
  • Program against error ids, never messages. Every id the stack can raise is listed with what to do about it. → Error Reference

An upgrade that stops half-way leaves two versions in one tree, and the package manager installs both without a word. @nice-code/util ships a command that says so:

Terminal window
bunx --package @nice-code/util nice-code-lockstep
# or: npx --package @nice-code/util nice-code-lockstep

It reads the project’s lockfile (bun.lock, package-lock.json, pnpm-lock.yaml or yarn.lock, and node_modules when there is none), lists every @nice-code/* package with the versions it is installed at, and exits 1 unless they are all on one version. Workspace packages are left out. Run it from the project’s root, or pass the root as its one argument.

With @nice-code/util among your own dependencies, the command is on your scripts’ path, so it can run beside your other checks:

{ "scripts": { "check-lockstep": "nice-code-lockstep" } }

At run time, @nice-code/error gives the same news once, as it loads, through console.warn: [@nice-code/error] Version … was loaded beside …. Copies that give this warning also read each other’s errors, so a refusal stays a refusal. A copy released before the warning does neither: the newer copy warns when it first receives one of that copy’s errors, and an error going the other way can still fail inside the older copy. Either way, treat the warning as an install to repair.