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

@rachelallyson/spectra

v0.6.0

Published

Stratum-style typed observability primitives — bring your own catalog, get typed emit, publisher fan-out, request context, test harness, and coverage report.

Readme

Spectra

Typed observability primitives for TypeScript apps. Bring your own catalog; Spectra handles the rest.

npm version npm provenance CI docs License

📚 Docs: https://rachelallyson.github.io/spectra/

Spectra is a tiny library for app-wide observability built around the Capital One Stratum-Observability patterns: a typed catalog as the single source of truth, runtime-validated emit(), and publisher fan-out to whatever vendors you use. No runtime dependencies (zod is a peer); ~1.7k lines of TypeScript; full IDE autocomplete on every event.

import { defineCatalog, consolePublisher } from '@rachelallyson/spectra'
import { z } from 'zod'

const catalog = defineCatalog({
  'app.started': z.object({ env: z.string(), version: z.string() }),
  'guest.created': z.object({ tenantId: z.string(), guestId: z.string() }),
})

catalog.setPublishers([consolePublisher()])

catalog.emit('app.started', { env: 'production', version: '1.0.0' })
//                            ^ TypeScript and Zod both validate this

Why

Most observability is unstructured console.log plus whatever Sentry sees. That works until it doesn't — and when it doesn't, you spend an hour grepping logs for the one signal that would have closed the case in seconds.

The Stratum pattern fixes this by making every observable behavior a named, typed entry in a catalog. The catalog becomes the contract: every emit validates against it, tests assert sequences against it, and a coverage report flags which catalog entries no test ever exercises.

Spectra ships the patterns, not the framework. No runtime dependencies; full type safety; small enough to read in one sitting.

How is this different from…

  • OpenTelemetry — OTel is the right answer for distributed traces and vendor-portable metrics. It is not a great fit for "here are the 60 named business events our app cares about, with typed payloads." Spectra sits above OTel: catalog-defined events, validated at the edge, fanned out to whatever sinks you already use.
  • pino / winston — log lines, not events. No catalog, no schema, no test-time coverage report telling you which events are unreachable.
  • PostHog / Segment / Amplitude SDKs — vendor-specific. Spectra is vendor-neutral by construction: write a 20-line Publisher and any vendor becomes a fan-out target. Use as many as you want.
  • Stratum-Observability (Capital One) — same patterns. Spectra is the small, isomorphic, zero-dep TypeScript take, with first-class test harness and browser support.

Features

  • Typed catalog factorydefineCatalog(schemas) returns a fully- typed emitter. TS rejects bad event names; Zod validates payloads at runtime.
  • Publishersconsole, memory (for tests), http (browser → server fan-out, with sendBeacon on unload), fileSink (Node-only durable JSONL). Bring your own for Sentry / Axiom / PostHog.
  • CoveragecoveragePublisher() tallies hit counts in memory on either side of the wire; mergeCoverage combines a browser snapshot with a server snapshot; formatCoverageSummary(report) returns Coverage: 12/15 (80%) — missed: foo, bar, … for CI annotations.
  • Request contextcreateContext<T>() returns an AsyncLocalStorage store generic over your app's shape. Set once at the edge, read anywhere.
  • Error pathwaycaptureError is intentionally separate from emit(). Events describe things that happened; errors describe things that went wrong. Sentry is the right place for the latter.
  • Lifecycle wrapperscreateWrappers({ catalog, procedure, job }) emits started/succeeded/failed around any async function. Drop one middleware on tRPC, wrap your Inngest handlers, get uniform signal.
  • Test harnessexpectSequence(['a.started', 'a.succeeded']) for flow tests; assertFullCoverage([...]) for catalog backstop.
  • Coverage report — Vitest globalTeardown reads a JSONL event log and writes obs-coverage.md so PR diffs surface drift.
  • Browser-safe core — root entry, /publishers, /coverage, /catalog, /errors, /wrappers ship without node: imports. Node-only sinks live behind explicit subpaths (/publishers/node, /coverage-report, /context, /test-harness).

Install

pnpm add @rachelallyson/spectra zod
# or: npm install @rachelallyson/spectra zod

Node 18+. Zod 3 or 4 works.

Documentation

Inspiration

Spectra deliberately doesn't try to replace OpenTelemetry — it's the typed-events-and-business-state layer that sits above OTel traces and metrics.

License

MIT