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

nv-random-npm-pkg

v1.0.1

Published

A small utility library for generating random npm package data, primarily designed for testing a local in-memory npm registry implement

Readme

nv-random-npm-pkg

A small utility library for generating random npm package data, primarily designed for testing a local in-memory npm registry implement

Overview

This project provides helpers to:

  • Randomly sample package IDs from the npm registry
  • Fetch package metadata and README content
  • Iterate through the full npm dataset via _changes
  • Generate realistic test data for registry implementations

The main goal is to support development and testing of a local in-memory npm server, especially one backed by mmap-based storage.

Use Case

This library is not intended for production use against the public registry at scale.

Instead, it is useful for:

  • Testing custom npm registry implementations
  • Benchmarking in-memory or mmap-based package stores
  • Generating random real-world package data
  • Stress-testing metadata parsing and storage layers

Features

  • Random package ID generation (via CouchDB _all_docs)
  • Metadata fetching from the official registry
  • README extraction
  • Full dataset traversal using _changes
  • File export for offline indexing

Installation

npm install nv-random-npm-pkg

Usage

Get a random package

const rnd = require("nv-random-npm-pkg");

const pkg = await rnd();
console.log(pkg.name);

Get a random README

const { readme } = require("nv-random-npm-pkg");

const md = await readme();
console.log(md);

Get total document count

const { get_total_count } = require("nv-random-npm-pkg");

const count = await get_total_count();
console.log(count);

Iterate all package IDs

const { get_all_ids } = require("nv-random-npm-pkg");

await get_all_ids(512, "./ids.json");

Notes

  • Many randomly sampled IDs are not valid packages (deleted or incomplete documents).

  • The library includes retry and filtering logic, but success is probabilistic.

  • For high-performance scenarios, it is recommended to:

    • Pre-build a local index
    • Store data using mmap or similar techniques

Architecture Hint

This library is often used together with:

  • A local registry mirror
  • A memory-mapped storage layer
  • Zero-copy lookup structures (e.g. offset tables + buffers)

Limitations

  • Depends on public npm registry endpoints
  • Subject to network latency and rate limits
  • Random sampling is not uniform over valid packages

License

MIT