Package Exports
- applesauce-core
- applesauce-core/event-store
- applesauce-core/helpers
- applesauce-core/helpers/app-data
- applesauce-core/helpers/app-handlers
- applesauce-core/helpers/article
- applesauce-core/helpers/blossom
- applesauce-core/helpers/bolt11
- applesauce-core/helpers/bookmarks
- applesauce-core/helpers/cache
- applesauce-core/helpers/calendar
- applesauce-core/helpers/calendar-event
- applesauce-core/helpers/calendar-rsvp
- applesauce-core/helpers/channels
- applesauce-core/helpers/comment
- applesauce-core/helpers/contacts
- applesauce-core/helpers/content
- applesauce-core/helpers/delete
- applesauce-core/helpers/dns-identity
- applesauce-core/helpers/emoji
- applesauce-core/helpers/encrypted-content
- applesauce-core/helpers/encrypted-content-cache
- applesauce-core/helpers/encryption
- applesauce-core/helpers/event
- applesauce-core/helpers/event-cache
- applesauce-core/helpers/event-tags
- applesauce-core/helpers/expiration
- applesauce-core/helpers/external-id
- applesauce-core/helpers/file-metadata
- applesauce-core/helpers/filter
- applesauce-core/helpers/gift-wraps
- applesauce-core/helpers/groups
- applesauce-core/helpers/hashtag
- applesauce-core/helpers/hidden-content
- applesauce-core/helpers/hidden-tags
- applesauce-core/helpers/highlight
- applesauce-core/helpers/index
- applesauce-core/helpers/json
- applesauce-core/helpers/legacy-messages
- applesauce-core/helpers/lists
- applesauce-core/helpers/lnurl
- applesauce-core/helpers/lru
- applesauce-core/helpers/mailboxes
- applesauce-core/helpers/messages
- applesauce-core/helpers/mutes
- applesauce-core/helpers/picture-post
- applesauce-core/helpers/pointers
- applesauce-core/helpers/poll
- applesauce-core/helpers/profile
- applesauce-core/helpers/reactions
- applesauce-core/helpers/relay-selection
- applesauce-core/helpers/relays
- applesauce-core/helpers/reports
- applesauce-core/helpers/share
- applesauce-core/helpers/stream
- applesauce-core/helpers/stream-chat
- applesauce-core/helpers/string
- applesauce-core/helpers/tags
- applesauce-core/helpers/threading
- applesauce-core/helpers/time
- applesauce-core/helpers/url
- applesauce-core/helpers/user-status
- applesauce-core/helpers/wrapped-messages
- applesauce-core/helpers/zap
- applesauce-core/models
- applesauce-core/models/blossom
- applesauce-core/models/bookmarks
- applesauce-core/models/calendar
- applesauce-core/models/channels
- applesauce-core/models/comments
- applesauce-core/models/common
- applesauce-core/models/contacts
- applesauce-core/models/encrypted-content
- applesauce-core/models/gift-wrap
- applesauce-core/models/index
- applesauce-core/models/legacy-messages
- applesauce-core/models/mailboxes
- applesauce-core/models/mutes
- applesauce-core/models/outbox
- applesauce-core/models/pins
- applesauce-core/models/profile
- applesauce-core/models/reactions
- applesauce-core/models/relays
- applesauce-core/models/thread
- applesauce-core/models/user-status
- applesauce-core/models/wrapped-messages
- applesauce-core/models/zaps
- applesauce-core/observable
- applesauce-core/promise
Readme
applesauce-core
AppleSauce is a collection of utilities for building reactive nostr applications. The core package provides an in-memory event database and reactive models to help you build nostr UIs with less code.
Key Components
- Helpers: Core utility methods for parsing and extracting data from nostr events
- EventStore: In-memory database for storing and subscribing to nostr events
- Models: Complex subscriptions for common nostr data patterns
Documentation
For detailed documentation and guides, visit:
Example
import { EventStore } from "applesauce-core";
import { ProfileModel, TimelineModel } from "applesauce-core/models";
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([{ authors: ["3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"] }], {
onevent(event) {
eventStore.add(event);
},
});
// Subscribe to profile changes using ProfileModel
const profile = eventStore.model(ProfileModel, "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d");
profile.subscribe((parsed) => {
if (parsed) console.log(parsed);
});
// Subscribe to a timeline of events
const timeline = eventStore.model(TimelineModel, { kinds: [1] });
timeline.subscribe((events) => {
console.log(events);
});