TopStats SDK

Node.js analytics SDK

Zero-dependency TypeScript client for Node 20+. capture() buffers in memory and sends in batches from a timer loop - it never blocks your request path and never throws into your code. Feature flag evaluation rides the same client. Express, Fastify, Hono and NestJS get dedicated middleware packages built on it.

Install

npm install @topstats/analytics

Capture your first event

import { TopStats } from '@topstats/analytics'

const client = new TopStats(process.env.TOPSTATS_API_KEY!)

client.capture('order_placed', { total: 42 }, { actor: 'user-123' })
await client.shutdown() // flushes the tail on exit

Behaviour you can rely on

Every other language

Your first event is minutes away.

Twelve language SDKs, middleware for nine web frameworks, plugins for seven games, and raw HTTP - all working today. Free plan, 2M events a month, no card.