Skip to main content

Node.js Server SDK

Backend event tracking for Node.js: background batching, retries with backoff and jitter, automatic UUIDv7 idempotency keys. Zero runtime dependencies; Node ≥ 18.

Usage

import { HoberClient } from '@hoberhq/node-sdk';

const hober = new HoberClient(process.env.HOBER_SERVER_KEY!);

hober.track({
name: 'order.placed',
externalId: 'user-483', // your user id — resolved by Hober's registry
properties: { orderId: 'ord_921', totalCents: 12900 },
});

await hober.identify('anon-9f2c', subscriberUuid);
await hober.close(); // flush before process exit

Create the server key under Settings → Server Keys. Full API semantics: Server-Side Event Tracking.

Behavior

  • Batching: batches of 100 (maxBatchSize) or every 5s (flushIntervalMs); flush()/close() drain. The in-memory queue holds 10k events; beyond that track throws rather than growing unbounded.
  • Retries: 429 (honoring Retry-After) and 5xx retry with exponential backoff + jitter (4 retries default); other 4xx are permanent and surface through onError (default: dropped silently — tracking never takes your process down).
  • Idempotency: every event gets a UUIDv7 key unless you set one; supply your own (outbox row id, order id) to make cross-process retries safe.