Skip to main content
Home

Built and signed on GitHub Actions

A collection of caching and querying techniquies used by https://snort.social to serve all content from the nostr protocol.

This package works with Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Node.js, Bun
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score
82%
Published
a year ago (1.4.0)

@snort/system

A collection of caching and querying techniquies used by https://snort.social to serve all content from the nostr protocol.

Simple example:

import { NostrSystem, RequestBuilder, StoreSnapshot, NoteCollection } from "@snort/system";

// Singleton instance to store all connections and access query fetching system
const System = new NostrSystem({});

(async () => {
  // Setup cache system
  await System.Init();

  // connec to one "bootstrap" relay to pull profiles/relay lists from
  // also used as a fallback relay when gossip model doesnt know which relays to pick, or "authors" are not provided in the request
  await System.ConnectToRelay("wss://relay.snort.social", { read: true, write: false });

  // ID should be unique to the use case, this is important as all data fetched from this ID will be merged into the same NoteStore
  const rb = new RequestBuilder("get-posts");
  rb.withFilter()
    .authors(["63fe6318dc58583cfe16810f86dd09e18bfd76aabc24a0081ce2856f330504ed"]) // Kieran pubkey
    .kinds([1])
    .limit(10);

  const q = System.Query(rb);
  // basic usage using "onEvent", fired every 100ms
  q.on("event", evs => {
    console.log(evs);
    // something else..
  });
})();
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@enjikaka/snort-system

Import symbol

import * as snort_system from "@enjikaka/snort-system";
or

Import directly with a jsr specifier

import * as snort_system from "jsr:@enjikaka/snort-system";

Add Package

pnpm i jsr:@enjikaka/snort-system
or (using pnpm 10.8 or older)
pnpm dlx jsr add @enjikaka/snort-system

Import symbol

import * as snort_system from "@enjikaka/snort-system";

Add Package

yarn add jsr:@enjikaka/snort-system
or (using Yarn 4.8 or older)
yarn dlx jsr add @enjikaka/snort-system

Import symbol

import * as snort_system from "@enjikaka/snort-system";

Add Package

vlt install jsr:@enjikaka/snort-system

Import symbol

import * as snort_system from "@enjikaka/snort-system";

Add Package

npx jsr add @enjikaka/snort-system

Import symbol

import * as snort_system from "@enjikaka/snort-system";

Add Package

bunx jsr add @enjikaka/snort-system

Import symbol

import * as snort_system from "@enjikaka/snort-system";