Main development is on decentralized git:
htree://npub1xdhnr9mrv47kkrn95k6cwecearydeh8e895990n3acntwvmgk2dsdeeycm/nostr-social-graph
A TypeScript library for building and querying social graphs from Nostr follow events.
- Build social graphs from Nostr follow events
- Query followed users, followers, and follow distances
- Change social graph root user with efficient distance recalculation
- Low memory consumption
- Efficient binary serialization (55% smaller than JSON)
- Pre-crawled datasets
- Server for maintaining and serving the up-to-date social graph, for quick initialization in web apps
See tests for detailed usage examples.
- Demo: graph.iris.to (examples dir)
- Documentation: mmalmi.github.io/nostr-social-graph/docs
- API Endpoints:
- Used in production at iris.to.
To point the examples search at a hashtree index, set VITE_PROFILE_SEARCH_INDEX=nhash1qqsgm4ex4d4dxgz39hj6q7t7ax7u4k57gp2zkjuxtfga7wpw6dy6xpg9yqu6y09zecw9hzettkaulu928dt58ndt0h2exw6qg5kxyrprucz0cukym2c (and optionally VITE_BLOSSOM_SERVERS=url1,url2).
Latest published profile search index (2025-01-23): nhash1qqsgm4ex4d4dxgz39hj6q7t7ax7u4k57gp2zkjuxtfga7wpw6dy6xpg9yqu6y09zecw9hzettkaulu928dt58ndt0h2exw6qg5kxyrprucz0cukym2c.
To publish the profile search index to Blossom, run BLOSSOM_NSEC=... yarn publish-profile-index.
The TypeScript implementation lives in SocialGraph.ts, and the Rust workspace lives under rust/.
The Rust workspace now has two interchangeable backends:
rust/crates/nostr-social-graph: in-memory core graph and binary formatrust/crates/nostr-social-graph-heed: optional LMDB/heedbackend for persistent large graphs
Both Rust backends implement the shared SocialGraphBackend runtime trait from the core crate.