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

mooncakes-protocol

v0.1.0

Published

Protocol library for accessing mooncakes.io content and package data

Readme

Mooncakes Protocol

TypeScript protocol library for accessing mooncakes.io website content and package data.

Installation

npm install mooncakes-protocol

Features

  • Get module list and statistics
  • Get module/package details
  • Parse package documentation data (types, traits, functions, etc.)
  • Support nested module structures
  • Batch fetch multiple packages
  • Download full module data recursively
  • Complete TypeScript type definitions

Data Structures

Resource Types

  • Resource - Resource info, contains three kinds:
    • Module - Module (root of package, contains metadata)
    • Package - Sub-package (contains code documentation)
    • RootPackage - Both module and package

Module Index

  • ModuleIndex - Tree-like index structure of module
  • PackageIndex - Package index containing types, traits, values, etc.

Package Data

  • PackageData - Complete package documentation data
  • TypeDoc - Type documentation
  • TraitDoc - Trait documentation
  • ValueDoc - Value/function documentation
  • ImplDoc - Implementation documentation

Usage

import { 
  MooncakesClient, 
  getAllPackagePaths,
  getDescendantPackages,
  findNodeByPath,
} from 'mooncakes-protocol';

// Create client
const client = new MooncakesClient();

// Get recently updated modules
const recent = await client.getRecentModules(20);

// Get module resource info
const resource = await client.getResource('moonbitlang/core');

// Get package documentation data
const pkgData = await client.getPackageData('moonbitlang/core/array');

// Get module index
const index = await client.getModuleIndex('moonbitlang/core');

// Get all package paths from index
const paths = getAllPackagePaths(index);

// Find nested package node
const node = findNodeByPath(index, 'moonbitlang/core/immut/list');

// Get all descendant packages of a node
const packages = getDescendantPackages(node);

// Batch fetch multiple packages
const packageDataMap = await client.getPackageDataBatch(paths, (done, total) => {
  console.log(`Progress: ${done}/${total}`);
});

// Download full module data (resource + index + all packages)
const fullData = await client.getFullModuleData('moonbitlang/core', (done, total, path) => {
  console.log(`Fetching ${path} (${done}/${total})`);
});

API Endpoints

| Method | Endpoint | Description | |--------|----------|-------------| | getRecentModules | /api/v0/modules/recent | Get recently updated modules | | getAllModules | /api/v0/modules/all | Get all modules | | getStatistics | /api/v0/modules/statistics | Get statistics | | getUser | /api/v0/user/{username} | Get user info | | getResource | /assets/{path}/resource.json | Get resource info | | getPackageData | /assets/{path}/package_data.json | Get package data | | getModuleIndex | /assets/{path}/module_index.json | Get module index |

Batch Operations

| Method | Description | |--------|-------------| | getPackageDataBatch | Fetch multiple packages concurrently | | getFullModuleData | Download complete module with all packages |

Utility Functions

| Function | Description | |----------|-------------| | traverseModuleIndex | Iterate all nodes in module index | | getPackageNodes | Get all nodes with package data | | getAllPackagePaths | Get all package paths from index | | findNodeByPath | Find node by path | | getDescendantPackages | Get all descendant packages | | getChildPackages | Get direct child packages | | buildSearchEntries | Build search entries from index | | fuzzySearch | Fuzzy search in entries |