Package Exports
- applesauce-core
- applesauce-core/event-store
- applesauce-core/helpers
- applesauce-core/helpers/__tests__/blossom.test
- applesauce-core/helpers/__tests__/bookmarks.test
- applesauce-core/helpers/__tests__/comment.test
- applesauce-core/helpers/__tests__/contacts.test
- applesauce-core/helpers/__tests__/emoji.test
- applesauce-core/helpers/__tests__/event.test
- applesauce-core/helpers/__tests__/events.test
- applesauce-core/helpers/__tests__/exports.test
- applesauce-core/helpers/__tests__/file-metadata.test
- applesauce-core/helpers/__tests__/hidden-tags.test
- applesauce-core/helpers/__tests__/mailboxes.test
- applesauce-core/helpers/__tests__/mutes.test
- applesauce-core/helpers/__tests__/nip-19.test
- applesauce-core/helpers/__tests__/relays.test
- applesauce-core/helpers/__tests__/tags.test
- applesauce-core/helpers/__tests__/threading.test
- applesauce-core/helpers/blossom
- applesauce-core/helpers/bolt11
- applesauce-core/helpers/bookmarks
- applesauce-core/helpers/cache
- applesauce-core/helpers/channels
- applesauce-core/helpers/comment
- applesauce-core/helpers/contacts
- applesauce-core/helpers/content
- applesauce-core/helpers/delete
- applesauce-core/helpers/direct-messages
- applesauce-core/helpers/dns-identity
- applesauce-core/helpers/emoji
- applesauce-core/helpers/event
- 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/index
- applesauce-core/helpers/json
- applesauce-core/helpers/lists
- applesauce-core/helpers/lnurl
- applesauce-core/helpers/lru
- applesauce-core/helpers/mailboxes
- applesauce-core/helpers/mutes
- applesauce-core/helpers/nip-19
- applesauce-core/helpers/picture-post
- applesauce-core/helpers/pointers
- applesauce-core/helpers/profile
- applesauce-core/helpers/relays
- applesauce-core/helpers/share
- 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/zap
- applesauce-core/observable
- applesauce-core/promise
- applesauce-core/queries
- applesauce-core/queries/__tests__/exports.test
- applesauce-core/queries/blossom
- applesauce-core/queries/bookmarks
- applesauce-core/queries/channels
- applesauce-core/queries/comments
- applesauce-core/queries/contacts
- applesauce-core/queries/index
- applesauce-core/queries/mailboxes
- applesauce-core/queries/mutes
- applesauce-core/queries/pins
- applesauce-core/queries/profile
- applesauce-core/queries/reactions
- applesauce-core/queries/relays
- applesauce-core/queries/simple
- applesauce-core/queries/thread
- applesauce-core/queries/user-status
- applesauce-core/queries/zaps
- applesauce-core/query-store
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 queries 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
- QueryStore: Manages queries and ensures efficient subscription handling
- Queries: Complex subscriptions for common nostr data patterns
Documentation
For detailed documentation and guides, visit:
Example
import { EventStore, QueryStore } from "applesauce-core";
import { Relay } from "nostr-tools/relay";
// Create a single EventStore instance for your app
const eventStore = new EventStore();
// Create a QueryStore to manage subscriptions efficiently
const queryStore = new QueryStore(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 ProfileQuery
const profile = queryStore.createQuery(
ProfileQuery,
"3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d",
);
profile.subscribe((parsed) => {
if (parsed) console.log(parsed);
});
// Subscribe to a timeline of events
const timeline = queryStore.createQuery(TimelineQuery, { kinds: [1] });
timeline.subscribe((events) => {
console.log(events);
});