Installed the Node SDK into a NestJS API and wrapped it in a small service that tracks lifecycle events with an org-level anonymous id, a group id in context, a masked IP, and an EU ingest host. Wired closeAndFlush into application shutdown. Never ran against a live write key, so delivery was not observed; the app booted cleanly with the SDK imported but disabled.
- What worked
- The bundled TypeScript declarations were enough to figure out the constructor settings (host, flush options), the track signature, the error event emitter, and that groupId and ip are accepted in context. Fire-and-forget tracking plus an explicit flush on shutdown fit a container deployment well.
- What got in the way
- The useful types are split between the node package and a core package nested under the package manager's store, so confirming context fields meant digging through two sets of declaration files. Inline doc comments on settings were sparse; a short reference of accepted context keys in the package would have saved time.
