8000 GitHub - mmalmi/nostr-notification-server
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

mmalmi/nostr-notification-server

Repository files navigation

Nostr Notification Server

A server that sends web push notifications and calls webhooks when Nostr events match user-defined filters.

Built on Rust, Heed (LMDB) and Flatbuffers.

Features

  • Receives events from Nostr relays and REST API
  • Receives web hook and web push subscriptions over REST API
  • Sends notifications when events match subscription filters

Setup

  1. Install dependencies:
cargo build
  1. Configure settings in config/default.toml

  2. Run server:

cargo run

Configuration

Edit config/default.toml:

# Server settings (required for NIP-98 auth)
http_port = 3030
base_url = "https://example.com"  # Set to your public address where the application will be accessed

# Nostr relays to connect to
relays = [
    "wss://relay.damus.io",
    "wss://nos.lol"
]

# Database size limit in bytes
db_map_size = 1073741824  # 1GB
...

Configuration can also be set via environment variables with the NNS_ prefix:

NNS_HTTP_PORT=8080
NNS_BASE_URL=https://example.com
NNS_DB_MAP_SIZE=2147483648
NNS_RELAYS='["wss://relay1.com","wss://relay2.com"]'

API (Default port: 3030)

Get VAPID public key for web push

curl http://localhost:3030/info

Manage Subscriptions

Requires NIP-98 HTTP Auth

# Get subscription
curl http://localhost:3030/subscriptions/<pubkey> -H "Authorization: <nostr-auth>"

# Create/update subscription
curl -X POST http://localhost:3030/subscriptions/<pubkey> \
  -H "Authorization: <nostr-auth>" \
  -H "Content-Type: application/json" \
  -d '{"webhooks":["https://example.com/hook"], "filter":{"kinds":[1]}}'

# Delete subscription
curl -X DELETE http://localhost:3030/subscriptions/<pubkey> -H "Authorization: <nostr-auth>"

Post Event

curl -X POST http://localhost:3030/events \
  -H "Content-Type: application/json" \
  -d '{"id":"...","pubkey":"...","kind":1,...}'

Development

Run tests:

RUST_LOG=debug cargo test

Watch tests:

RUST_LOG=debug cargo watch -x test

Update schema:

flatc --rust -o src/schema/ src/schema/subscription.fbs

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0