nostr-social-graph
v1.0.36
Published
Nostr social graph library
Readme
Nostr Social Graph TS
This directory contains the published TypeScript package for building and querying Nostr social graphs.
Quickstart:
import { SocialGraph, type NostrEvent } from "nostr-social-graph";
const graph = new SocialGraph(rootPubkey);
graph.handleEvent(nostrEvent as NostrEvent, true);
const binary = await graph.toBinary();
const restored = await SocialGraph.fromBinary(rootPubkey, binary);Notes:
handleEventonly uses kind3and10000events.- Unknown authors are ignored by default. Pass
truewhen ingesting from a cold start. await graph.setRoot(pubkey)before reading follow distances for a new root.- If you connect a new root into preloaded graph data, run
recalculateFollowDistances()before reading distances.
Key paths:
Common commands:
pnpm testpnpm buildpnpm docspnpm e2e
Package metadata lives in package.json. For repo-wide context and the Rust workspace, see the root README.
