nostralink

Crates.ionostralink
lib.rsnostralink
version0.2.3
created_at2025-05-18 17:13:48.96038+00
updated_at2025-06-01 02:09:07.783082+00
descriptionLinked data library for nostr
homepage
repositoryhttps://codeberg.org/nostralink/nostralink
max_upload_size
id1678782
size421,075
(PancakesArchitect)

documentation

README

nostralink

nostralink is a Rust crate that allows you to transform nostr events to linked data and save them to an RDF triple store. It also offers APIs to write events as linked data (using JSON-LD) and make queries.

JSON-LD contexts for various content types are provided, as well as SparQL queries for common operations.

Discuss

IRC: #nostralink channel on libera.chat.

Usage

use nostralink::prelude::*;
use std::path::PathBuf;

#[tokio::main]
async fn main() -> Result<(), RdfStoreError> {
    let keys = Keys::generate();

    let store = RdfEventsStore::open(PathBuf::from("store")).expect("Cannot open store");

    let client = Client::builder().database(store).signer(keys).build();
    client.add_relay("wss://relay.damus.io").await?;

    client
        .subscribe(
            Filter::new()
                .kind(Kind::TextNote)
                .limit(50)
                .since(Timestamp::now() - 3600),
            None,
        )
        .await?;

    Ok(())
}

Projects using nostralink

  • paz is an experimental nostr client built with nostralink and egui.

Examples

Client

This example fetches recent notes to a store, and shows each incoming event in the ttl (Turtle) format.

cargo run -r --example client

Resources

Commit count: 0

cargo fmt