Nostr social graph library
npm install 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:
- https://graph-api.iris.to/social-graph?maxBytes=2000000
- https://graph-api.iris.to/profile-data?maxBytes=2000000&noPictures=true
- Used in production at iris.to.
The main logic is in SocialGraph.ts.