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

applesauce-common

v5.1.0

Published

Common NIP-specific helpers and models for applesauce

Readme

applesauce-common

Applesauce is a collection of utilities for building reactive nostr applications. The common package provides NIP-specific helpers, models, operations, and utilities for working with various Nostr Improvement Proposals (NIPs). This package contains all the extra functionality that applications can use with nostr events that is not directly related to the core protocol.

Installation

npm install applesauce-common

or

yarn add applesauce-common

or

pnpm add applesauce-common

Key Components

  • Helpers: NIP-specific utility methods for parsing and extracting data from nostr events
  • Models: Complex reactive subscriptions for NIP-specific nostr data patterns
  • Operations: Functions for creating and constructing nostr events according to various NIPs
  • Blueprints: Event blueprints and templates for creating properly formatted nostr events
  • Casts: Type casting utilities for converting between different event representations
  • Observable: Observable utilities and operators for working with reactive streams of nostr events

Documentation

For detailed documentation and guides, visit:

Example

import { EventStore } from "applesauce-core";
import { ThreadModel } from "applesauce-common/models";
import { getNip10References } from "applesauce-common/helpers/threading";
import { Relay } from "nostr-tools/relay";

// Create a single EventStore instance for your app
const eventStore = new EventStore();

// Use any nostr library for relay connections (nostr-tools, ndk, nostrify, etc...)
const relay = await Relay.connect("wss://relay.example.com");

// Subscribe to events and add them to the store
const sub = relay.subscribe([{ ids: ["event-id"] }], {
  onevent(event) {
    eventStore.add(event);
  },
});

// Get NIP-10 thread references
const refs = getNip10References(event);

// Subscribe to a thread using ThreadModel
const thread = eventStore.model(ThreadModel, "event-id");

thread.subscribe((thread) => {
  console.log(thread);
});

Supported NIPs

This package includes helpers, models, and operations for various NIPs including:

  • NIP-10 (Threading)
  • NIP-18 (Reposts)
  • NIP-22 (Comments)
  • NIP-23 (Articles)
  • NIP-25 (Reactions)
  • NIP-28 (Channels)
  • NIP-52 (Calendar Events)
  • NIP-53 (Streams)
  • NIP-57 (Zaps)
  • NIP-88 (Polls)
  • And many more...

Exports

The package provides several export paths:

  • applesauce-common - Main exports (Helpers, Models, Operations, etc.)
  • applesauce-common/helpers - All helper functions
  • applesauce-common/helpers/* - Individual helper modules
  • applesauce-common/models - All model functions
  • applesauce-common/models/* - Individual model modules
  • applesauce-common/operations - All operation functions
  • applesauce-common/operations/* - Individual operation modules
  • applesauce-common/blueprints - Event blueprints
  • applesauce-common/casts - Type casting utilities
  • applesauce-common/observable - Observable utilities