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

hearth-client

v0.1.0

Published

Light weight client for [Hearth](https://github.com/rxbryan/hearth). It presents one small interface over both of Hearth's surfaces: an HTTP control plane for provisioning rooms and minting capabilities, and a WebSocket runtime plane for live messaging.

Readme

hearth-client

Light weight client for Hearth. It presents one small interface over both of Hearth's surfaces: an HTTP control plane for provisioning rooms and minting capabilities, and a WebSocket runtime plane for live messaging.

Install

npm install hearth-client

Quickstart

import { Hearth } from "hearth-client";

const hearth = new Hearth("http://localhost:4000");

// Claim a room.
const { ownerToken } = await hearth.claim("lobby");

// Mint a short-lived invite to hand to someone else.
const { inviteToken } = await hearth.invite("lobby", ownerToken, { ttlSeconds: 600 });

// Join with a token.
const room = await hearth.join("lobby", inviteToken, { who: "sarah" });

// Listen for messages and presence.
room.on("message", (msg) => console.log(`#${msg.seq}: ${msg.body}`));
room.on("presence", (state) => console.log("here:", Object.keys(state)));

// Send a message: returns the server assigned sequence number.
const seq = await room.send("hello");

room.typing(true);
room.leave();

working with the client

Hearth has no accounts. Access is by bearer token: whoever holds a valid token for a room may act on it. An owner token is your long-lived key to a room you claimed and can mint invites; an invite token is a short-lived capability you hand to a joiner.

The client hides the transport, deriving both the HTTP endpoint (for claim/invite) and the WebSocket endpoint (for the live room) from the base url.

The client recover missed messages after a disconnect without gaps or duplicates use the last seen messages seqence number.

API

Control plane

hearth.claim(room: string): Promise<{ room: string; ownerToken: string }>
hearth.invite(room, ownerToken, opts?: { ttlSeconds?: number }): Promise<{ room; inviteToken; ttlSeconds }>

claim throws RoomAlreadyClaimedError if the name is taken. invite throws NotOwnerError if the token does not own the room. All SDK errors extend HearthError.

Runtime plane

hearth.join(room, token, opts?: { who?: string }): Promise<Room>

room.send(body: string): Promise<number>   // resolves with the assigned sequence
room.typing(isTyping: boolean): void
room.on("message", (msg) => void)           // { seq, body }
room.on("presence", (state) => void)         // who is here / typing
room.history: Message[]                       // recent messages, loaded on join
room.leave(): void

join throws UnauthorizedError if the token is rejected for the room.

Coverage

The client reaches every Hearth route and channel event:

  • [x] POST /api/rooms claim a room (hearth.claim)
  • [x] POST /api/rooms/:room/invites mint an invite (hearth.invite)
  • [x] channel join with token (hearth.join)
  • [x] shout send and receive messages (room.send, room.on("message"))
  • [x] typing typing indicator (room.typing)
  • [x] presence_state / presence_diff presence (room.on("presence"))
  • [x] replay missed-message catch-up on join (consumed; deduped by sequence)

Status

The control and runtime faces are complete and the client exercises every route and channel above. Work tracked in issues:

Development

npm install
npm run build        
npm test             
npm run lint         
npm run format