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

@ossy/analytics

v3.21.0

Published

Analytics module — Host visitor traffic for registered domains

Downloads

1,818

Readme

@ossy/analytics

Host-traffic analytics. See SPEC.md.

Platform-wide (ops) insights belong in a back-office Mongo dashboard — ADR 0014.

Pages

| Page | Path | Audience | |------|------|----------| | analytics/home | /analytics · /analys | Signed-in + entitled → traffic for a registered Host. No domain → empty state. Otherwise the public sales page (no stats loads). |

Workspace member/resource counts are not this package — they belong on workspace settings.

Actions

| Action | Access | Notes | |--------|--------|-------| | @ossy/analytics/actions/create-page-view | public | Ingest. Server resolves Host (hostname / Origin) with @ossy/domains/actions/find-by-domain (content.domain). www is a different host. Unknown Host → 200 no-op (recorded: false). Connection ip is stamped on the eventstore row (ADR 0016). | | @ossy/analytics/actions/get-page-view-stats | workspace | Stats for a Host this workspace registered (host required). The Host is confirmed with ListResources on /@ossy/domains/. Window is whole UTC days of resource created. Traffic from per-day PageViewStatsProjection snapshots; byCountry from the location projection. | | @ossy/analytics/actions/get-workspace-kpis | workspace | Member + resource counts — UI on /settings; not shown on /analytics. |

Locations (#769)

Event (source of truth): after Host allowlist, the page-view eventstore row carries the trusted connection IP (ip, ADR 0016). Client body ip / countryCode and viewer geo headers are ignored. Unknown Hosts never write an event.

Read models:

  • PageViewStatsProjection (@ossy/analytics/data/page-view-stats) — one snapshot per Host per UTC day (workspaceId:host:YYYY-MM-DD). Stores that day's view count, the set of visitorIds, and up to 2000 path counts (#960). A range unions those id sets, so a returning visitor counts once.
  • PageViewLocationProjection (@ossy/analytics/data/page-view-location) — same per-day scope (workspaceId:host:YYYY-MM-DD). Maps event.ip → ISO countryCode via MaxMind GeoLite2-Country (GEOLITE2_COUNTRY_MMDB) and stores { views, visitors } per country for that day (#966). A range unions those ids. Rebuilding with a new .mmdb refreshes historical countries while events keep raw IPs.

Day keys use envelope created as a UTC date. from / to include those whole days.

Database on containers (#804): @ossy/platform startServer downloads GeoLite2-Country at boot when MAXMIND_LICENSE_KEY is set (same path on ossy.se, plexus-sanitas, and any future website image). ECS sets GEOLITE2_COUNTRY_MMDB=/tmp/GeoLite2-Country.mmdb. Do not commit .mmdb files. Locally: export the key (and optionally the path) before npx platform start. Startup rebuild (AggregateRebuild.BuildAndSaveAll) then fills historical byCountry. This product includes GeoLite2 data created by MaxMind, available from https://www.maxmind.com

UI: location tiles show unique visitors per country — never show IP. Host-scoped (pick a domain on /analytics).

Preview

Enable Analytics, register a domain on the workspace, then open /analytics and select that Host.