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

@tinyacre/telemetry

v0.4.0

Published

Tinyacre's first-party analytics and front-end error reporting

Readme

@tinyacre/telemetry

Front-end analytics (Umami) and error reporting (GlitchTip, through @sentry/browser) for Tinyacre's apps. What it may send is fixed by docs/data-boundary.md; ADR-0001 records why.

What the package guarantees:

  • Pageviews and error events carry the route template your app maps the location to, never the concrete URL, query or hash.
  • Every pageview carries display as Umami's tag: standalone for an installed PWA, else browser. No title or referrer is sent.
  • Custom events are names from your app's event list, with no properties. A name outside the list does not compile.
  • Error events are rebuilt from a whitelist: exception type, stack trace, route template (transaction), release, and navigation breadcrumbs with templated paths. The exception message, request data, user, tags, extra and contexts are left behind; events without an exception type (such as captureMessage) are not sent.
  • The switch: off (cached choice) means neither SDK is imported. Turned off mid-session, the Sentry client is closed and Umami stops.
  • It knows nothing about accounts. Your app stores the user's "help improve" preference on the account and calls setEnabled with it.
  • Held: while the account's choice is unknown, nothing is sent and nothing is kept to send later.

Install

The package is public on npm.

pnpm add @tinyacre/telemetry   # or: bun add / npm install

Reverse proxy

The browser only talks to your app's own origin. Forward two paths (the prefixes are your choice; they go into the config below):

  • /_s/ to Umami, prefix stripped, so the browser posts to /_s/api/send.
  • /_e/ to GlitchTip, prefix stripped and query string kept, so the browser posts envelopes to /_e/api/<project-id>/envelope/. The body is text/plain, and the DSN's public key arrives in the X-Sentry-Auth header, so the proxy must pass that header on. Keep sentry_key out of the URL: ad blockers drop requests that carry it.

Both need the real client IP in X-Forwarded-For (Umami's visitor hash) and GlitchTip should scrub IP addresses. Umami needs SALT_ROTATION=day.

Use

import { startTelemetry } from "@tinyacre/telemetry";

export const events = ["card_added", "card_removed"] as const;

const telemetry = await startTelemetry({
  release: import.meta.env.VITE_RELEASE, // X.Y.Z, or the short sha of an edge build
  events,
  routeTemplate: ({ pathname }) => matchRoute(pathname)?.template ?? "/unknown",
  umami: { endpoint: "/_s/api/send", websiteId: "<umami website id>", hostname: "<canonical host>" },
  sentry: {
    dsn: "https://<public-key>@<glitchtip host>/<project-id>",
    tunnel: "/_e/api/<project-id>/envelope/",
  },
});

router.afterEach(() => telemetry.pageview()); // reads `location`; or pass { pathname, search, hash }
telemetry.track("card_added");
telemetry.captureException(error);            // for caught errors; uncaught ones are reported automatically

// On sign-in, before the account's choice has been read:
telemetry.hold();

// Once it is read, and whenever the user flips the account's "help improve" switch:
await telemetry.setEnabled(account.telemetryEnabled);

startTelemetry reads the switch cached on the device (localStorage key tinyacre.telemetry.enabled, default on) and imports the SDKs only when it is on. setEnabled writes that cache; turning it back on in the same session starts a fresh Sentry client. Browser privacy signals (GPC, DNT) are not read: the switch alone decides.

hold() puts telemetry on hold until the next setEnabled. Until then, error events (uncaught ones included) and breadcrumbs are dropped, pageviews and custom events are dropped rather than queued, and the device cache is left as it was. setEnabled(true) resumes with what happens from then on; setEnabled(false) closes the Sentry client, stops Umami and caches off. An app that knows at start-up that a signed-in session exists can pass held: true to startTelemetry so the cache is not trusted: no SDK is imported until setEnabled(true).

routeTemplate must map every location to a template (/cards/:id); a query or hash it returns is cut off. Errors use the template of the last pageview, so call pageview on the initial load as well.

umami.hostname is the app's canonical host; every event reports it, whichever host served the page.

fetch and storage are optional overrides for the platform's fetch and localStorage, used by the tests.

Develop

bun install
bun run typecheck   # also checks the type-level tests in src/*.test-d.ts
bun run test
bun run build

Release

Bump version in package.json, commit, then push a matching tag (git tag v0.1.0 && git push origin v0.1.0). The Publish workflow checks that the tag matches the version, then runs typecheck, tests and build and publishes to npm through trusted publishing (GitHub OIDC, no token).