Modules
nostr-feed
Optional module — subscribe to kind:1 notes, publish signed posts, and zap creators via WebLN and NIP-57.
Social feed demo combining Nostr relays with optional Lightning zaps. Reads and writes kind-1 text notes; zaps use NIP-57 (LNURL + WebLN payment + zap receipt).
Files added
| File | Purpose |
|---|---|
lib/nostr/relay.ts | WebSocket relay subscription helpers |
lib/nostr-zap.ts | NIP-57 zap request + receipt logic |
components/nostr/NostrFeedProvider.tsx | Feed context with live subscription |
components/nostr/NoteFeed.tsx | Scrollable note list |
components/nostr/NoteCard.tsx | Single note display |
components/nostr/PublishNote.tsx | Compose + sign + publish |
components/nostr/ZapButton.tsx | NIP-57 zap flow |
app/demo/nostr-feed/page.tsx | Demo page |
Dependencies
nostr-tools— relay protocol, event verificationreact-markdown— note content rendering
Environment variables
| Key | Required | Description |
|---|---|---|
NEXT_PUBLIC_NOSTR_RELAY | no | Comma-separated relay URLs (default: public relays) |
Requires
nostr-identity— signing posts and zap requests- WebLN (always included) — paying zap invoices
PublishNote
Signs kind-1 event and publishes to configured relays:
const { signEvent } = useIdentity();
const event = await signEvent({
kind: 1,
created_at: Math.floor(Date.now() / 1000),
tags: [],
content: noteText,
});
// publish via relay.tsShows "Connect your Nostr identity (NIP-07)" when provider unavailable.
ZapButton (NIP-57)
Zap flow:
- Fetch recipient's LNURL from their
lud16lightning address (kind:0 profile) - Create signed zap request (kind:9734)
- Get invoice from LNURL callback with zap request embedded
- Pay via WebLN
sendPayment - Publish zap receipt (kind:9735) to relay
Disabled with message when WebLN unavailable.
NoteFeed
Subscribes to kind:1 notes from NEXT_PUBLIC_NOSTR_RELAY on mount. Live updates via WebSocket EVENT messages.
Demo route
/demo/nostr-feed — read feed, publish notes, zap posts (requires Fedi for zaps).