npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@toon-protocol/relay

v2.0.1

Published

Nostr relay app: free NIP-01 reads + HTTP POST /write

Readme

@toon-protocol/relay

A Nostr relay app: free NIP-01 WebSocket reads plus an HTTP POST /write surface for storing events.

The relay contains no ILP, connector, settlement, or pricing logic. Payment is enforced entirely upstream by an external terminator — by the time a write reaches this process it is already proven paid, so the relay simply stores the event and serves reads.

Install

npm install @toon-protocol/relay

Run (CLI)

NOSTR_SECRET_KEY=<64-char-hex> npx @toon-protocol/relay
# reads:  ws://localhost:7100
# writes: http://localhost:3100/write
# health: http://localhost:3100/health

| Env var | Default | Description | |---------|---------|-------------| | TOON_SECRET_KEY / NOSTR_SECRET_KEY | — | 64-char hex identity key (one of these or TOON_MNEMONIC is required) | | TOON_MNEMONIC | — | BIP-39 mnemonic (NIP-06 derivation) | | TOON_RELAY_PORT | 7100 | WebSocket read port | | TOON_BLS_PORT | 3100 | HTTP write/health port | | TOON_DATA_DIR | ./data | SQLite data directory | | TOON_DEV_MODE | false | Skip event-signature verification on POST /write |

Run (programmatic)

import { startRelay } from '@toon-protocol/relay';

const relay = await startRelay({ secretKey });
// ... POST /write on 3100, read NIP-01 on 7100 ...
await relay.stop();

HTTP surface

| Method | Path | Description | |--------|------|-------------| | POST | /write | Store an event. Body { "event": <NostrEvent> }. Trusts injected X-TOON-Payer/-Amount/-Chain headers (echoed, not validated); verifies only the event signature. | | GET | /health | Liveness, identity (pubkey), capabilities, and version. |

WebSocket Relay Server

NIP-01 compliant WebSocket server that stores and serves Nostr events in TOON format.

import { NostrRelayServer, SqliteEventStore } from '@toon-protocol/relay';

const eventStore = new SqliteEventStore('./events.db');
const relay = new NostrRelayServer({ port: 7100 }, eventStore);

await relay.start();
relay.broadcastEvent(event); // push to matching subscriptions
await relay.stop();

Event Storage

import { InMemoryEventStore, SqliteEventStore } from '@toon-protocol/relay';

const memStore = new InMemoryEventStore();      // ephemeral
const sqlStore = new SqliteEventStore('./events.db'); // persistent

memStore.store(event);
const found = memStore.get(event.id);
const results = memStore.query([{ kinds: [1], limit: 10 }]);

TOON Codec

Re-exported from @toon-protocol/core for convenience.

import { encodeEventToToon, decodeEventFromToon } from '@toon-protocol/relay';

Full API

| Category | Exports | |----------|---------| | Launcher | startRelay, RelayConfig, RelayInstance, RelaySubscription, ResolvedRelayConfig | | Relay | NostrRelayServer, ConnectionHandler, RelayServerConfig, DEFAULT_RELAY_CONFIG | | Storage | EventStore, InMemoryEventStore, SqliteEventStore, RelayError | | Write/Health | createWriteHandler, createHealthResponse | | Codec | encodeEventToToon, decodeEventFromToon, ToonEncodeError, ToonDecodeError | | Subscriber | RelaySubscriber, RelaySubscriberConfig | | Filter | matchFilter | | Constants | VERSION |

License

MIT