Funnelcake

DiVine Funnelcake Nostr Relay

NIP-11 JSON LLM Guide Funnel API
v0.1.0

Architecture

DiVine FunnelCake is more than a standard Nostr relay—it's a unified video platform combining real-time event streaming with powerful analytics APIs, all backed by ClickHouse for superior performance.

┌─────────────────┐ ┌─────────────────┐ │ Nostr Clients │ │ REST Clients │ └────────┬────────┘ └────────┬────────┘ │ WebSocket │ HTTP ▼ ▼ ┌─────────────────┐ ┌─────────────────┐ │ cake │ │ funnel │ │ (relay:7777) │ │ (api:8080) │ └────────┬────────┘ └────────┬────────┘ │ │ └───────────┬───────────┘ ▼ ┌─────────────────┐ │ ClickHouse │ └─────────────────┘

cake — WebSocket Relay

High-performance Nostr relay optimized for video events

  • Real-time event streaming
  • Subscription management
  • Multi-node via Redis pub/sub
  • Batch writes for high throughput

funnel — REST API

Video analytics and discovery API for applications

  • Video stats & engagement metrics
  • Trending & popular feeds
  • Full-text search
  • NIP-86 management interface

ClickHouse Backend

Column-oriented database for blazing-fast analytics

  • Shared storage for both services
  • Materialized views for trending
  • ReplacingMergeTree for events
  • Optimized for high write throughput

Relay Information

Software DiVine FunnelCake (Cake Relay)
Version 0.1.0
Operator Pubkey 121b915baba659cbe59626a8afaf83b01dc42354dfecaad9d465d51bb5715d72

REST API (funnel)

The funnel service provides a comprehensive REST API for video analytics, user profiles, search, and platform management.

Videos List, stats, views, categories, bulk operations
Users Profiles, social graph, feeds, creator analytics
Search Full-text and hashtag search
Platform Stats, health probes, NIP-86 management
View Full API Documentation

All endpoints return JSON. Some endpoints require NIP-98 authentication.

Supported NIPs

NIP-01
Basic Protocol
Core Nostr protocol: events, subscriptions, and filters
NIP-09
Event Deletion
Request deletion of events by ID or coordinates
NIP-11
Relay Information
Machine-readable relay metadata at root URL
NIP-16
Event Treatment
Regular, replaceable, and ephemeral event handling
NIP-18
Reposts
Reposting and quote-reposting events (kinds 6, 16)
NIP-22
Comments
Threaded comments on non-kind-1 events (kind 1111)
NIP-25
Reactions
Likes, emoji reactions, and upvotes (kind 7)
NIP-33
Parameterized Replaceable
Addressable events with d-tag coordinates
NIP-40
Expiration Timestamp
Events with expiration tags are filtered from query results
NIP-45
Event Counting
COUNT message for subscription result counts
NIP-50
Search Capability
Full-text search in event content
NIP-51
Lists
Mute lists, bookmark lists, bookmark sets, and curation sets (kinds 10000, 10003, 30003, 30005)
NIP-71
Video Events
Video metadata and streaming support (kinds 34235, 34236, 34237)
NIP-86
Relay Management
Administrative RPC via HTTP POST
NIP-98
HTTP Authentication
NIP-98 signed authorization headers

Resource Limits

Max Message 512 KB
Max Content 100 KB
Max Subscriptions 100
Max Filters/REQ 10
Max Events/Query 5000
Max Tags/Event 2000
Max Sub ID Length 256

Event Kinds

0
Profile
User profiles with display names, avatars, and bios
1
Text Note
Short-form text posts and replies
3
Contacts
Follow lists and social graph connections
5
Deletion
Requests to delete previously published events
6
Repost
Share a text note to your followers
7
Reaction
Likes, emoji reactions, and upvotes on content
16
Generic Repost
Share any event type to your followers
1111
Comment
Threaded comments and replies on videos
10000
Mute List
Private list of muted users and content
10003
Bookmark List
User's saved content bookmarks
30003
Bookmark Set
Categorized bookmark collections with d-tag identifier
30005
Curation Set
Curated video playlists and collections
34235
Horizontal Video
Standard landscape video content
34236
Vertical Video
Short-form portrait video content
34237
Video Chapters
Chapter markers and timestamps for videos

Nostr WebSocket Protocol

Nostr (Notes and Other Stuff Transmitted by Relays) is a decentralized protocol where clients connect to relays via WebSocket to publish and subscribe to events. Events are cryptographically signed JSON objects identified by the author's public key. Learn more about Nostr →

Connect to this relay

How it works

1
Connect — Open a WebSocket connection to the relay URL above
2
Subscribe — Send a REQ message with filters to receive matching events
3
Receive — Relay sends matching EVENT messages, then EOSE when history is complete
4
Publish — Send signed EVENT messages; relay responds with OK
5
Real-time — New events matching your subscriptions are pushed automatically

Client → Relay Messages

EVENT Publish a signed event to the relay for storage and broadcast ["EVENT", <signed event object>]
REQ Subscribe to events matching filters (by author, kind, tags, time, etc.) ["REQ", "sub-id", <filter1>, <filter2>, ...]
CLOSE Unsubscribe from a subscription by its ID ["CLOSE", "sub-id"]
COUNT Request a count of events matching filters (NIP-45) ["COUNT", "sub-id", <filter>]

Relay → Client Messages

EVENT An event matching your subscription ["EVENT", "sub-id", <event object>]
OK Acknowledgment after publishing (true = accepted, false = rejected with reason) ["OK", "event-id", true, ""]
EOSE End of Stored Events — all historical matches sent, now streaming live ["EOSE", "sub-id"]
NOTICE Human-readable message from relay (errors, warnings, info) ["NOTICE", "rate limited"]
COUNT Response to COUNT request with matching event count ["COUNT", "sub-id", <count result>]