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

@plinthjs/pulse

v0.1.0

Published

Mason application performance recorder (the Laravel Pulse equivalent, headless).

Readme

@plinthjs/pulse

A headless application performance recorder for Mason, the Laravel Pulse equivalent (minus the dashboard). Pulse records small { type, key, value?, tags? } measurements into a swappable PulseStore, and rolls them up with count, min, max, sum, avg and p95 aggregates, optionally bucketed into fixed time windows. Recorder helpers turn slow queries, slow requests, exceptions, cache hits, user activity and queue jobs into entries.

The clock is injected (epoch milliseconds), so timestamps and buckets are deterministic in tests.

Install

npm install @plinthjs/pulse

Usage

import { Pulse } from '@plinthjs/pulse'

const pulse = new Pulse() // ArrayPulseStore + Date.now by default

pulse.record('slow_query', 'select * from users', 1450)
pulse.record('slow_query', 'select * from users', 1200)
pulse.record('slow_query', 'select * from orders', 2100)

pulse.aggregate('slow_query', { aggregate: 'max', limit: 5 })
// [{ key: 'select * from orders', value: 2100, count: 1 }, { key: 'select * from users', value: 1450, count: 2 }]

pulse.aggregate('slow_query', { aggregate: 'sum', period: 60 }) // one row per key per 60s bucket
pulse.values('slow_query') // [1450, 1200, 2100]
pulse.entries({ type: 'slow_query', since: Date.now() - 3_600_000 }) // most recent first

aggregate() defaults to count, ordered by value descending (orderBy: 'asc' flips it), and accepts since / before bounds. period is in seconds, and bucketed rows carry a bucket start instant.

Recorders

import {
  cacheInteraction,
  exceptionEntry,
  PulseType,
  queueEntry,
  slowQuery,
  slowRequest,
  userRequest,
} from '@plinthjs/pulse'

// Threshold recorders return undefined below the threshold (default 1000 ms).
const draft = slowQuery(sql, durationMs, { threshold: 500 })
if (draft) pulse.ingestDraft(draft)

pulse.ingestDraft(slowRequest('GET /reports', 1800))
pulse.ingestDraft(exceptionEntry(new TypeError('boom'))) // keyed by error name
pulse.ingestDraft(cacheInteraction('user:1', true)) // cache_hit or cache_miss
pulse.ingestDraft(userRequest(42))
pulse.ingestDraft(queueEntry('emails', 320))

pulse.aggregate(PulseType.CacheMiss) // most-missed keys

Filtering, buffering and toggling

const pulse = new Pulse({ lazy: true }) // buffer entries until flush()

pulse.filter((entry) => !entry.key.startsWith('/health')) // drop matching entries

pulse.record('user_request', '7')
pulse.pending() // 1
pulse.flush() // writes the buffer to the store, returns the count

pulse.disable() // record() becomes a no-op
pulse.recording() // false
pulse.enable()

Reads (aggregate, values, entries) flush the buffer first, so they always see every recorded entry.

Storage and retention

import { ArrayPulseStore, Pulse } from '@plinthjs/pulse'

let now = 0
const pulse = new Pulse({ store: new ArrayPulseStore(), now: () => now })

pulse.prune(now - 7 * 24 * 3_600_000) // remove entries older than a week, returns the count
pulse.clear() // drop the buffer and every stored entry

Implement the PulseStore interface (record, entries, aggregate, prune, clear) to persist entries elsewhere.