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

node-red-contrib-nostr

v0.1.0

Published

Node-RED nodes for seamless Nostr protocol integration. Features robust WebSocket handling, event filtering, and NPUB-based routing. Built with TypeScript for type safety and extensive testing. Perfect for Nostr automation flows.

Readme

node-red-contrib-nostr

npm version License: MIT Node-RED Tests JavaScript Style Guide Known Vulnerabilities

A Node-RED node for integrating with the Nostr protocol. This node allows you to connect to Nostr relays, publish events, and subscribe to events in the Nostr network.

⚠️ Security Note

A private key is only required if you want to:

  • Publish events to relays
  • Send encrypted direct messages
  • Perform any action that requires signing

For just listening to relays or subscribing to events, no private key is needed.

If you do need to publish events, follow these security guidelines:

  1. Generate a separate key pair specifically for your Node-RED automation using services like:

  2. Keep the scope of this automation key limited:

    • Only give it permissions it actually needs
    • Consider it like a "bot account"
    • Regularly rotate the key if possible
  3. Store the private key securely:

    • Use Node-RED's encrypted credentials
    • Never share or expose the key
    • Don't commit it to version control

Description

This package provides nodes for interacting with Nostr relays, allowing you to:

  • Connect to multiple relays simultaneously
  • Monitor specific NPUBs for events
  • Filter events by type (text notes, DMs, etc.)
  • Post events to relays (using a dedicated automation key)
  • Support for multiple NIPs (see Supported NIPs section)
  • TypeScript support with full type definitions
  • Secure credential management
  • Automatic reconnection handling

Technical Architecture

Module System

This package uses a hybrid approach to module systems to ensure maximum compatibility:

  • Built as CommonJS for Node-RED compatibility
  • Handles ESM dependencies through dynamic imports
  • Supports both modern and legacy Node.js environments

WebSocket Management

Built on nostr-websocket-utils for enterprise-grade reliability:

  • Automatic Reconnection: Smart backoff strategy for connection drops
  • Connection Health: Built-in heartbeat monitoring
  • Type Safety: Full TypeScript support
  • Error Resilience: Comprehensive error handling
  • Memory Efficient: Proper cleanup of resources
  • Debug Support: Detailed logging

Install

From npm (Recommended)

Run the following command in your Node-RED user directory - typically ~/.node-red

npm install node-red-contrib-nostr

From Source

cd ~/.node-red
git clone https://github.com/HumanjavaEnterprises/node-red-contrib-nostr.git
cd node-red-contrib-nostr
npm install
npm run build

Using Docker

git clone https://github.com/HumanjavaEnterprises/node-red-contrib-nostr.git
cd node-red-contrib-nostr
docker compose up -d

Nodes

1. Nostr Relay Config Node

Configuration node for managing relay connections:

  • Multiple relay support
  • Secure private key storage
  • Automatic reconnection handling
  • Connection status monitoring
  • Dynamic import of ESM dependencies

2. Nostr Filter Node

Specialized node for event filtering:

  • Filter by event kinds
  • Filter by authors (NPUBs)
  • Filter by tags
  • Time-based filtering
  • Custom filter combinations
  • Real-time event processing

3. Nostr NPUB Filter Node

Dedicated node for NPUB-based filtering:

  • Monitor specific NPUBs
  • Filter by event types
  • Real-time NPUB event tracking
  • Automatic hex key conversion

Example Flows

Basic Event Monitoring

{
    "id": "basic-monitor",
    "type": "nostr-filter",
    "relay": "wss://relay.example.com",
    "filterType": "kind",
    "eventKinds": [1],
    "wires": [["debug"]]
}

NPUB Tracking

{
    "id": "npub-track",
    "type": "nostr-npub-filter",
    "relay": "wss://relay.example.com",
    "npubValue": "npub1...",
    "eventKinds": [1, 6],
    "wires": [["debug"]]
}

Error Handling

The nodes implement comprehensive error handling:

  • Invalid private key detection
  • Relay connection failures
  • Message parsing errors
  • NPUB validation
  • WebSocket connection issues

Development

Building from Source

npm install
npm run build

Running Tests

npm test

Test coverage includes:

  • Unit tests for all nodes
  • WebSocket connection handling
  • Event filtering logic
  • Error handling

Docker Development

docker compose -f docker-compose.dev.yml up

Supported NIPs

| NIP | Description | Status | |-----|------------|--------| | NIP-01 | Basic Protocol | ✅ Implemented | | NIP-02 | Contact List and Petnames | ✅ Implemented | | NIP-03 | OpenTimestamps Attestations | 🚧 Planned | | NIP-04 | Encrypted Direct Messages | 🚧 Planned | | NIP-09 | Event Deletion | 🚧 Planned | | NIP-11 | Relay Information Document | ✅ Implemented | | NIP-15 | End of Stored Events Notice | ✅ Implemented | | NIP-20 | Command Results | ✅ Implemented | | NIP-28 | Public Chat | 🚧 Planned | | NIP-40 | Expiration Timestamp | 🚧 Planned |

Legend:

  • ✅ Implemented: Fully supported
  • 🚧 Planned: On the roadmap
  • ❌ Not Planned: Not currently planned for implementation

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Node-RED Specific Tags

This module provides nodes for working with Nostr protocol in Node-RED.

Node Properties

  • Category: network
  • Name: node-red-contrib-nostr
  • Types: nostr-relay-config, nostr-filter, nostr-npub-filter
  • Description: Node-RED nodes for interacting with Nostr protocol
  • Author: Vveerrgg
  • Keywords: node-red,nostr,websocket,relay,filter,npub
  • Dependencies: @humanjavaenterprises/nostr-tools,nostr-websocket-utils
  • Node-RED: >= 2.0.0