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

@osrs-tracker/models

v3.0.0

Published

Typings for OSRS Tracker API

Readme

@osrs-tracker/models · NPM package GitHub license

The shared TypeScript types for OSRS Tracker: players, hiscores, items and news, plus the code that stores hiscore entries compactly. They're used by the website, the API and the background jobs, so all of them agree on the shape of the data. Works with both ES modules and CommonJS, in Node and the browser, with no runtime dependencies.

Install

npm install @osrs-tracker/models

Usage

import { Item, Player } from '@osrs-tracker/models';

function describe(player: Player): string {
  return `${player.username} has ${player.hiscoreEntries?.length ?? 0} hiscore snapshots`;
}

Stored hiscore entries

Entries are stored by position in a layout (the skill and activity names Jagex used), and a value that didn't change since the entry before is stored as its bare rank. Writers encode and prepend; readers load the layouts and decode:

import {
  createHiscoreLayout,
  decodeHiscoreEntries,
  encodeHiscoreEntry,
  hiscoreEntriesWriteExpression,
} from '@osrs-tracker/models';

const layout = createHiscoreLayout(names, new Date()); // upsert it in `hiscoreLayouts` before the entry
await players.updateOne({ username }, [
  { $set: { hiscoreEntries: hiscoreEntriesWriteExpression(encodeHiscoreEntry(entry, layout)) } },
]);

const entries = decodeHiscoreEntries(player.hiscoreEntries, layoutsById); // newest first, as stored

This package defines the encoding. Which job writes which players and hiscoreLayouts field, and owns which index, is in osrs-tracker-aws's DATA-MODEL.md.

Reading entries

A value is null when there's no xp or score; don't make up a value for it. Show an untrained skill's level with skillLevel(entry.skills[name]) (1), or its level, xp and progress with skillProgress(entry.skills[name]), read Overall with overallOf(entry), and iterate a HiscoreDiff with Object.entries: its values are never null.

Enums and XP

SkillEnum and ActivityEnum hold skill and activity names exactly as the name in Jagex's JSON hiscores (SkillEnum.Overall is 'Overall', ActivityEnum.LastManStanding is 'LMS - Rank'). Entries are keyed by those names, and a name Jagex adds is stored before the enums know it, so the enums list only the names code refers to. PlayerType and PlayerStatus are a Player's type (normal, ironman, …) and status (default, de_ironed, de_ultimated).

calculateXPForSkillLevel(level) is the total xp a level needs, also past level 126, and calculateXPToNextLevel(xp, level) the xp left to the next level. MAX_SKILL_LEVEL is 99.

Development

OSRS Tracker was originally built entirely without AI assistance. Since October 2026, I've started using Claude, Anthropic's AI coding assistant, to help improve development speed and reliability.