npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cue-vin/analytics-server

v0.1.2

Published

Self-hostable analytics endpoint for cue Demo Theater SDK

Readme

@cue-vin/analytics-server

Self-hostable analytics endpoint for the cue Demo Theater SDK. Receives demo events via HTTP, stores them in append-only NDJSON, and serves aggregate stats. Zero runtime dependencies — uses only Node.js built-ins.

Install

npm install @cue-vin/analytics-server

Quick Start

CLI

# Start server on default port 3001
npx cue-analytics

# Custom port and data directory
npx cue-analytics --port 3001 --data ./my-analytics-data

Programmatic API

import { startServer, query, store, readAllEvents } from "@cue-vin/analytics-server";

// Start the HTTP server
const server = await startServer({ port: 3001, dataDir: "./data" });

// Later: query stats offline (no server needed)
const events = readAllEvents({ dataDir: "./data" });
const stats = query.queryStats("my-saas-demo", events);
console.log(`Views: ${stats.totalViews}, Completion: ${stats.completionRate}`);

Send Events from CuePlayer

import { CueAnalytics } from "@cue-vin/core";

const analytics = new CueAnalytics({
  demoId: "product-tour",
  endpoint: "http://localhost:3001/event",
  totalSteps: 3,
});

analytics.track("demo_start");
analytics.track("step_view", { step: 0 });
analytics.track("step_view", { step: 1 });
analytics.track("hotspot_click", { step: 1, hotspotId: "h3" });
analytics.track("demo_complete");

HTTP Endpoints

POST /event

Ingest an analytics event. Required fields: demoId, sessionId, event, ts.

curl -X POST http://localhost:3001/event \
  -H "Content-Type: application/json" \
  -d '{"demoId":"my-demo","sessionId":"sess-abc","event":"start","step":0,"totalSteps":4,"ts":1700000000000}'

Response: { "ok": true }

GET /stats/:demoId

Query aggregate stats for a demo.

curl http://localhost:3001/stats/my-demo

Response:

{
  "demoId": "my-demo",
  "totalViews": 42,
  "completionRate": 0.71,
  "avgStepsReached": 3.2,
  "stepDropoff": [42, 38, 35, 30],
  "hotspotClicks": { "upload-hotspot-0": 18 }
}

GET /health

Health check returning total event count.

curl http://localhost:3001/health

Response: { "ok": true, "events": 150 }

All endpoints include CORS headers (Access-Control-Allow-Origin: *).

Exports

Server

| Export | Kind | Description | |--------|------|-------------| | startServer | Function | (config?: ServerConfig) => Promise<Server> — start the HTTP server. Returns Node.js http.Server instance. | | ServerConfig | Type | { port?, dataDir? }. Defaults: port from CUE_PORT env or 3001, dataDir from CUE_DATA_DIR env or "data". |

Store

| Export | Kind | Description | |--------|------|-------------| | appendEvent | Function | (event: StoredEvent, options?) => void — append event to events.ndjson. Sync I/O. | | readAllEvents | Function | (options?) => StoredEvent[] — read and parse all events. Skips malformed lines. | | readEventsByDemo | Function | (demoId: string, options?) => StoredEvent[] — filter events by demo ID. | | countEvents | Function | (options?) => number — count non-empty lines (fast, no full parse). | | store | Namespace | All store functions re-exported as a namespace for import { store } from "@cue-vin/analytics-server". |

Query

| Export | Kind | Description | |--------|------|-------------| | queryStats | Function | (demoId: string, events: StoredEvent[]) => DemoStats — pure aggregation. No I/O. | | listDemoIds | Function | (events: StoredEvent[]) => string[] — unique demo IDs from event log. | | getSessionEvents | Function | (sessionId: string, events: StoredEvent[]) => StoredEvent[] — events for one session, sorted by timestamp. | | query | Namespace | All query functions re-exported as a namespace. |

Types

| Export | Description | |--------|-------------| | StoredEvent | { demoId, sessionId, event: string, step?, totalSteps?, hotspotId?, ts: number } | | DemoStats | { demoId, totalViews, completionRate, avgStepsReached, stepDropoff: number[], hotspotClicks: Record<string, number> } | | StoreOptions | { dataDir? } |

Dependencies

None — uses only Node.js built-ins (http, fs, path).