Node Server Sync
@monoverse/node is an npm package that pushes your Node.js catalog and content to
Monoverse so the assistant can answer about your real products, categories and pages.
It is a producer client for the Monoverse canonical signed-ingest contract: it pairs once with your
site's pk_ key, sends a full snapshot to establish a baseline, then streams small incremental
deltas as your data changes. Everything runs server-to-server over an HMAC-signed HTTP protocol —
no browser, no end-user involvement, no LLM SDK on your side. Monoverse calls back into one handler you
mount on your site, /monoverse, to prove your domain when you pair and to ask for a sync. Voice and
retrieval stay on the Monoverse backend. It is the Node/TypeScript twin of the
Laravel and WordPress sync producers.
┌──────────────────┐ gzip-NDJSON snapshot ┌──────────────┐
│ Your Node app │ + signed /events deltas │ Monoverse │
│ + this package │ ───────────────────────────▶ │ ingest │
│ (entity │ HMAC-SHA256, https only │ (catalog, │
│ builders) │ │ RAG) │
└──────────────────┘ └──────────────┘
The widget answers questions using this data. Until a backend sync runs, there is nothing for it to talk about. Get the catalog in first.
The lifecycle at a glance
Four steps from an empty connection to a self-maintaining feed:
- Pair — paste your site's
pk_key and callclient.ensurePaired(): once Monoverse has proved your domain at/monoverse/pair-challenge, you get your tenant id + an encrypted shared secret. - Map — build canonical entities from your data with the typed builders (
product,category, …). - Snapshot —
client.snapshot(...)streams a complete baseline of every kind you emit. - Schedule — deltas every few minutes via
client.sendEvents(...), plus a periodic full to reconcile deletes.
Two channels, two keys
Monoverse reads your store over two independent channels. They use different credentials and flow in opposite directions — don't confuse them.
| Data channel (this package) | Widget channel (browser) | |
|---|---|---|
| Direction | Your server → Monoverse (push) | End-user browser ↔ Monoverse (live) |
| Credential | HMAC shared secret (per-tenant, secret) | Publishable key pk_… (public, embeddable) |
| Obtained via | client.ensurePaired(), which trades your pk_ key for it | Copied from the cabinet, dropped in a <script> |
| Carries | Catalog + content snapshots and deltas | Voice/text conversation traffic |
| Trust | Secret, encrypted at rest, never logged | Public identifier, safe to ship in markup |
The same pk_ key starts both channels. The widget ships it as is; the data channel trades it once, after
Monoverse has proved you serve the key's domain, for a shared secret. The shared secret minted by pairing
is stored encrypted at rest (AES-256-GCM, keyed by your encryptionKey) and is never printed, logged,
or returned in any output.
When to use it
Use this package when:
- Your storefront runs on Node.js (Express, NestJS, Fastify, a headless backend, a custom shop).
- You want the assistant to answer about live products, prices, stock, categories and pages.
- You can mount one HTTP handler (
/monoverse) on your site and run a script on a schedule (cron, a worker, a platform scheduler).
You do not need this package if your store runs on WordPress/WooCommerce (use the WordPress sync plugin) or Laravel (use the Laravel package), or if you'd rather not run a producer at all.
If you can't run a producer, Monoverse can ingest your store with no code on your side — a managed crawler reads your public pages, and supported platforms can be pulled read-only. See No-code & read-only alternatives.
What it sends
The package maps your data to Monoverse's canonical entity schema via typed builder functions and
emits the kinds you have — products, categories, pages and more. Money is integer minor units,
categories/tags are slug lists, and page.contentText is plain text; the builders enforce
these. See Mapping for how to build entities and Syncing for how to
push them.
Requirements
- Node.js 18+ (uses built-in
node:cryptoand globalfetch; zero runtime dependencies). - Your site's publishable key (
pk_…) from the cabinet, and a public https origin on the domain it is bound to: Monoverse fetches/monoverse/pair-challengethere while you pair. - A full-entropy 32-byte
encryptionKeyto encrypt the stored shared secret (openssl rand -hex 32). - A reachable Monoverse ingest endpoint over https (
localhostis allowed for local dev).
The five-minute path
- Install & pair —
npm install, construct the client with yourpk_key, mount the handler and callensurePaired(). - Map your data to canonical entities.
- Push a baseline:
client.snapshot(catalog()). - Sync deltas + a periodic full.
- Operate it —
status,unpair, retries, scheduling.
Next steps
- Installation & pairing — install, construct the client, pair.
- Ingest Protocol Reference — the contract this package implements.
- Tenant isolation — how the HMAC plane stays scoped to your tenant.