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

@saplings/miner

v0.1.0

Published

Product analytics, feature targeting, and experiments for application-owned data.

Readme

@saplings/miner

Product analytics, feature targeting, and experiments for application-owned data.

Server setup

Register allowed event names and property types. Pass a transactional store and derive trusted subject, consent, project, environment, and tenant context on the server. Use a server-issued anonymous ID for pre-login tracking. Derive signed-in user identity from the application session and link the visitor only after authentication.

import { createMiner } from '@saplings/miner';

const miner = createMiner({
  store,
  schemas: { 'checkout.completed': { plan: 'string' } },
  retentionDays: 90,
});

await miner.track(actor, {
  id: crypto.randomUUID(),
  name: 'checkout.completed',
  properties: { plan: 'team' },
});

Use InMemoryStore locally. For PostgreSQL, apply the Drizzle adapter migrations including its Miner time index. Use the existing tenant RLS role and DrizzleStore. Configure the application worker to call purge for each registered tenant, project, and environment under miner:privacy. Use deleteSubject for subject erasure. Legacy SDK analytics and flags retain their existing storage and behavior. Attribute backfilled events to a specific scope and use stable source IDs when re-ingesting.

Browser SDK

Install the browser SDK against your own authenticated or consent-aware endpoints. It captures events only when you call it. Reuse the event ID for retries and have the server derive identities from its session and visitor cookie.

import { createMinerClient } from '@saplings/miner/browser';

const miner = createMinerClient();
await miner.track('checkout.completed', { plan: 'team' });

Reports and experiments

Use saveReport and report for trends, breakdowns, ordered funnels, and calendar-day retention in UTC. Use saveCohort to describe membership from an event and an optional property match. Use report access via miner:read and scope all reports to the application's tenant, project and environment. Queries cap the number of events at 50,000 and support selecting narrower windows.

Define flags and experiment drafts with miner:admin. Set an experiment’s flag to gate assignments on an existing flag. Launch the experiment before asking for an assignment and record an exposure after rendering the variant. Results count one exposure and conversion per subject within a 14-day conversion window, with absolute percentage-point lift versus control. The console exposes these workflows. Replay, surveys, autocapture, and significance testing are separate release scope.