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

@stamhoofd/backend-statistics-syncer

v2.152.0

Published

Keeps the platform statistics database up to date: the separate, de-identified database that Metabase reports on. It runs the nightly sync from the main administration.

Readme

Statistics syncer

Keeps the platform statistics database up to date: the separate, de-identified database that Metabase reports on. It runs the nightly sync from the main administration.

It is deliberately its own service. The sync reads the whole administration in one pass, and the cron scheduler has no distributed lock, so running it inside the API would mean one full pass per API instance, competing with request handling. It runs on a replica server and pushes to the statistics database on the Metabase server, so it holds two connections: STAMHOOFD.stamhoofdDatabase for the administration it reads, STAMHOOFD.statisticsDatabase for the schema it writes.

It owns the schema it writes into: src/migrations/ holds the migrations of the statistics database, src/schema.ts runs them and src/database.ts connects to it. That database keeps a migration history of its own, in its own migrations table, so it can be moved to another server without dragging the main one along.

The report read off the schema lives in @stamhoofd/metabase. It depends on nothing here: it is a shared package, so the dependency could only run the wrong way.

Running

yarn start        # boot the service
yarn migrations   # migrate the statistics database (part of `yarn migrate` from the repo root)

Wherever this service runs, it syncs: there is nothing to switch off in configuration, so deploy it only for a platform that has statistics to report on. In development it runs on every cron tick; elsewhere once a night between 03:00 and 05:00 (see src/crons.ts).

STAMHOOFD.IMPORTED_UNTIL marks how far back the numbers come from an external import instead of from this administration; periods ending before it are frozen and left to that import.

A period the administration has locked stops being synced as well, one run later: the run that first sees the lock still writes the changes and the deletions of that day, and settles the period at the end if it came through in full. Unlocking a period brings it back into the sync, unless it ended more than a year ago.