Nostr-LD is a powerful and extensible library for transforming Nostr events and profiles into JSON-LD format. By leveraging JSON-LD, a W3C standard, Nostr-LD allows Nostr data to be interpreted and used by a wide range of tools and applications, enhancing interoperability and integration across the web.
npm install nostr-ld
import { eventld } from 'nostr-ld';
const event = '{...}'; // Your Nostr event here.
const jsonLD = eventld(event);
console.log(JSON.stringify(jsonLD, null, 2));
import { profileld } from 'nostr-ld';
const user = '...'; // Your user pubkey here.
const mergedData = '{...}'; // Merged user data.
const jsonLD = profileld(user, mergedData);
console.log(JSON.stringify(jsonLD, null, 2));
The adoption of JSON-LD for Nostr events and profiles brings several benefits:
/.well-known/nostr/
directory, Nostr-LD helps to maintain the decentralized nature of Nostr and doesn’t put pressure on individual relays.We welcome contributions! Please see our contributing guide for more details.
By embracing standards like JSON-LD, Nostr-LD aims to keep Nostr open, interoperable, and ready for the future of the web. We hope you find this library useful in your Nostr-related projects.