Skip to content

Architecture

How files and blobs are published, cached and distributed.

Distribution

Distribution architecture

Select the diagram to open it at full size.

Author / SDK

Component Role
SDK Core It coordinates uploads, retries failed operations, resumes interrupted work, and never distributes data itself
Chunker It splits very large files into streamable chunks without loading the full file into memory
Origin Uploader It uploads file data to author-controlled storage such as Ceph or S3
Hasher It calculates SHA256 and Merkle roots to generate an immutable content identifier
Policy Encoder It encodes author intent such as whether the file should propagate, where it should propagate, and how long it is valid
Signer It signs metadata and commands using the author’s private key so intent cannot be forged
Nostr Publisher It publishes signed metadata and commands to the Nostr relay network

Origin Storage

Component Role
Object Gateway It stores the canonical copy of the file and serves range requests to seed peers
Metadata Store It records object size, etag, and last modified time

Control Plane

Component Role
Nostr Relay It stores signed events in an append-only log and does not store file data
Nostr Relay It replicates events from other relays for global availability
Event Stream It carries file manifests, propagation commands, delete commands, and scheduler heartbeats

Aggregation Layer

Component Role
Relay Consumer It subscribes to multiple relays and continuously pulls new events
Signature Verifier It verifies cryptographic signatures and drops invalid or forged events
State Builder It converts the event history into the current state of files, policies, and schedulers
Aggregator DB It stores indexed state such as content registry, scheduler registry, and policies
Hot Cache It keeps frequently accessed state in memory for fast reads
Query API It serves read requests from bridges

Node-local Control Plane (Bridge)

Component Role
Nostr Listener It watches the control plane for new intent and updates local state
Policy Engine It decides whether data should stay cold, become hot, or stop propagating
Consistent Hash Engine It deterministically maps content identifiers to schedulers so swarms are not split
Scheduler Health Monitor It probes schedulers using TCP and latency checks to detect failures
Task Orchestrator It translates intent into actions such as preheating, invalidating, or rewarming data
Decision Cache It stores content-to-scheduler decisions for microsecond responses
Manager API Facade It exposes Dragonfly Manager APIs so Dragonfly components think a manager exists

Data Plane (Dragonfly)

Scheduler

Component Role
Scheduler API It accepts peer registrations, heartbeats, and preheat commands
Task Manager It tracks the lifecycle of each distribution task from creation to expiry
Peer Manager It tracks connected peers, their bandwidth, and reliability
Piece Manager It tracks which peer owns which piece and verifies integrity
Topology Builder It builds optimal peer-to-peer trees for maximum throughput
Load Controller It prevents overload by throttling and admission control
Failure Handler It repairs the swarm when peers disconnect or fail

Seed Peer

Component Role
Origin Fetcher It downloads data from origin storage using range requests
Cache GC It evicts old data when disk pressure or TTL limits are reached
Disk Cache It stores the full file locally so origin is hit only once
Piece Server It serves file pieces to downstream peers

Peers

Component Role
Scheduler Client It registers with the scheduler and receives download instructions
Piece Downloader It downloads pieces in parallel from multiple peers
Integrity Verifier It checks hashes for every downloaded piece
Cache GC It removes unused data from local storage
Local Cache It stores partial or complete pieces on disk
Piece Uploader It serves verified pieces to other peers

Interactions: Distribution

From Interaction To
Origin Uploader uploads data Object Gateway
Object Gateway stores metadata Metadata Store
Nostr Publisher publishes events Nostr Relay
Nostr Relay replicates events Nostr Relay
Query API reads global state Manager API Facade
Manager API Facade assigns scheduler Scheduler API
Manager API Facade triggers preheat Scheduler API
Scheduler API requests origin pull Origin Fetcher

Blob storage

Blob storage architecture

Select the diagram to open it at full size.

Client / Nostr Application

Component Role
Server Discovery module Fetches the nip96.json document and determines upload endpoints and accepted content types.
Auth Builder Constructs a NIP-98 authentication event, signs it using the user’s private key, and encodes it into the HTTP Authorization header.
Mirror Requester Instructs additional servers to mirror a blob using its hash or source URL without re-uploading bytes.
Upload Client Streams multipart form data to the server and attaches the signed NIP-98 authorization header.
Retrieval Client Downloads files from listed URLs and verifies integrity by recomputing the SHA-256 hash.
Index Publisher Constructs and signs a NIP-94 file metadata event that maps a content hash to multiple storage URLs.

Nostrcheck Server (Stateless Compute)

Component Role
HTTP API Exposes NIP-96 and Blossom endpoints, validates request structure, and enforces protocol compliance.
Auth Verifier Validates NIP-98 authentication events, verifies signatures, and enforces ownership constraints.
Payment Gate Enforces paid upload policies using Lightning or Cashu before accepting storage requests.
Upload Handler Receives multipart data streams, performs preliminary validation, and forwards data to object storage.
Mirror Handler Fetches blobs from external Blossom servers and verifies content hashes before acceptance.
Hash Engine Computes the SHA-256 hash of uploaded content and enforces content-addressed identity.
Metadata Builder Assembles NIP-94 compatible metadata and prepares response payloads for clients.
Response Signer Signs server responses to prevent equivocation and support auditing.

Object Storage (S3 / MinIO)

Component Role
Object Store Persists blobs indexed strictly by their SHA-256 hash and exposes immutable read paths.
Storage Metadata Database Stores object size, MIME type, creation time, and integrity attributes.

CDN / Edge Cache

Component Role
Edge Cache Serves GET and HEAD requests for blobs, caches immutable content aggressively, and absorbs the majority of read traffic.

Nostr Relay Network

Component Role
Relay 1 Persists signed events and exposes them to subscribed clients.
Relay 2 Replicates events independently to provide availability and censorship resistance.

Interactions: Blob storage

From Interaction To
Server Discovery module selects endpoint Auth Builder
Auth Builder generates auth header Upload Client
Upload Client sends multipart data HTTP API
HTTP API verifies authorization Auth Verifier
Auth Verifier approves request Payment Gate
Payment Gate permits upload Upload Handler
Upload Handler streams bytes Hash Engine
Hash Engine derives content hash Upload Handler
Upload Handler writes object Object Store
Object Store records metadata Storage Metadata Database
Hash Engine provides hash Metadata Builder
Metadata Builder constructs response Response Signer
Response Signer returns signed metadata Upload Client
Mirror Requester requests mirroring HTTP API
HTTP API authorizes mirror Auth Verifier
Auth Verifier permits fetch Mirror Handler
Mirror Handler pulls remote blob Object Store
Mirror Handler verifies hash Hash Engine
Hash Engine confirms integrity Storage Metadata Database
Object Store serves immutable content Edge Cache
Edge Cache delivers cached blobs Retrieval Client
Index Publisher publishes file metadata event Relay 1
Relay 1 replicates event Relay 2
Retrieval Client fetches primary url Edge Cache
Retrieval Client falls back on failure Edge Cache
HTTP API authorizes delete Auth Verifier
Auth Verifier marks object invalid Storage Metadata Database
Storage Metadata Database signals cache purge Edge Cache
Client / Nostr Application requests deletion HTTP API

Assets and containers

Asset architecture

Select the diagram to open it at full size.

Client SDK

Component Role
CLI interface Takes the path of a JSON metadata file and an optional asset file
Uploader Coordinates signing, uploading and publication
Metadata signer, signer client and key store Sign the metadata with the client's private key
Path resolver Finds the asset when a path is given in the JSON
Multi-threaded chunked uploader and file reader Read the file as chunks and upload them in parallel
Hyperdrive client Uploads to Hyperdrive and returns the key
Nostr client Publishes the signed metadata to the configured relays

L2 aggregator

Component Role
Nostr client and timer Crawl L1 for metadata publications periodically
Event reader and parser Read events, perform basic validation and sort by timestamp
Dedup checker and cache Look up existing assets by hash
Internal event buffer and signature validator Validate signatures
Record mapper Converts records to the database schema
Version resolver Creates a version branch when the same asset arrives with a different version
DB writes batcher and connection pool Write to the database
Config store and config API server Service configuration
Query GraphQL and REST APIs and controller Let users query the L2 directly to discover assets and containers

Cluster

Component Role
df-daemon Pulls through the proxies and synchronizes peer to peer
df-daemon TCP proxy Evaluates a policy to check whether this node can pull the chunk, using the local chunk index
Local chunk index chunk_hash, asset_id and metadata
Docker v2 proxy Serves df-daemons, with a Harbor HTTP proxy client for pulls and an upload proxy for layers
Harbor proxy Checks whether the asset is present in Harbor, and starts ingestion on demand when it is not
Kubernetes driver Creates the ingestion job
Ingestion job Queries the L2, streams chunks from Hyperdrive and uploads them to Harbor
Harbor APIs Cluster upload, download and query with streaming modules

Relays

Relay and registry architecture

Select the diagram to open it at full size.

Author & Asset Origin

Component Role
Author Identity module Manages cryptographic keys or DIDs and signs every create, update, and delete operation.
Personal Relay Accepts only author-signed events, enforces local access rules, and serves as an authoritative personal metadata source.
Decentralized Asset Storage Persists immutable asset files using content addressing and exposes retrieval via hash or CID.

Layer 1

RELAY NETWORK (METADATA PLANE).

Component Role
Ingress Handler Accepts websocket connections, parses incoming events, and performs protocol-level validation.
Authentication Engine Validates optional challenge-response authentication such as NIP-42 before accepting writes.
Spam Filter Enforces proof-of-work, rate limits, and custom filtering rules to protect relay health.
Event Validator Verifies cryptographic signatures, event IDs, and schema correctness.
Relay Write-Ahead Log Ensures durable ingestion and crash-safe recovery of incoming events.
Relay Event Database Stores signed metadata events with configurable retention, indexing, and pruning policies.
Relay Indexer Builds basic indexes for author, kind, tags, and timestamps to support direct queries.
Negentropy Sync Engine Compares local state with peer relays and synchronizes missing events efficiently.
Retention Policy Engine Applies time-based or capacity-based deletion rules on stored events.
Relay Query Engine Executes filtered subscription queries over indexed metadata.
Subscription Manager Tracks active client subscriptions and streams matching events in real time.

Power User / Raw L1 Access

Component Role
Raw Nostr Client Subscribes directly to relays without relying on indexers.
Filter Engine Applies tag, author, and kind filters locally over streamed events.
Compute Executor Runs custom ranking or analysis code over raw datasets.

Layer 3

Component Role
Registry Scanner Queries Layer 1 for registry advertisements and builds a dynamic provider catalog.
Selection Engine Selects registries based on user choice, tags, or automated rules.
Fan-Out Engine Dispatches parallel queries to multiple registry APIs.
Response Collector Gathers asynchronous responses and tracks timeouts and failures.
Result Normalizer Unifies heterogeneous registry responses into a common schema.
Result Deduplicator Removes duplicate assets appearing across registries.
Federated Ranker Applies global ranking logic over merged results.
Presentation API Exposes a single unified search interface to end users.

Layer 2

Component Role
Bulk Subscriber Pulls complete historical event streams from relays using backfill mechanisms.
Archive Normalizer Ensures canonical ordering and schema consistency across datasets.
Archive Database Stores full historical metadata with long-term durability guarantees.
Sync Planner Computes diffs against peer archivers to identify missing data.
Export API Serves bulk snapshots, incremental exports, and recovery feeds to authorized consumers.
Sync Executor Transfers only missing records using efficient batch protocols.

Layer 2

INDEXERS / REGISTRY PROVIDERS.

Component Role
Relay Client Maintains persistent subscriptions to multiple relays and manages replay windows.
Event Normalizer Converts raw relay events into canonical internal representations.
Deduplication Engine Removes duplicates and resolves replaceable and deletion events deterministically.
Indexer Write-Ahead Log Records ingestion steps to ensure replay and recovery.
Indexer Database Stores normalized records, tag indexes, author mappings, and registry advertisements.
Search Index Builds inverted and vector-friendly indexes to support high-performance queries.
Query Planner Analyzes user queries and selects optimal execution strategies.
Ranking Engine Scores and orders results based on relevance, freshness, reputation, or custom logic.
Registry API Exposes search, filtering, access control, metrics, and quota management endpoints.
Provider Policy Engine Enforces specialization filters, content policies, and access constraints.
Metrics Collector Records query latency, usage statistics, and operational health indicators.

Asset Retrieval & Verification

Component Role
Asset Fetcher Retrieves immutable assets directly from decentralized storage using recorded identifiers.
Integrity Verifier Recomputes hashes to ensure retrieved assets match declared identities.

Meta-registration On L1

Component Role
Registry Descriptor Defines registry provider identity, specialization, API endpoints, and tags.
Descriptor Signer Signs the registry descriptor using the provider’s identity key.

Interactions: Relays

From Interaction To
Author Identity module signs metadata Personal Relay
Author Identity module uploads assets Decentralized Asset Storage
Personal Relay pushes metadata Ingress Handler
Ingress Handler authenticates client Authentication Engine
Authentication Engine filters writes Spam Filter
Spam Filter passes valid events Event Validator
Event Validator logs event Relay Write-Ahead Log
Relay Write-Ahead Log persists event Relay Event Database
Relay Event Database indexes metadata Relay Indexer
Relay Indexer serves queries Relay Query Engine
Relay Query Engine streams results Subscription Manager
Relay Event Database applies retention Retention Policy Engine
Relay Event Database syncs state Negentropy Sync Engine
Relay Query Engine streams events Relay Client
Relay Client normalizes events Event Normalizer
Event Normalizer deduplicates records Deduplication Engine
Deduplication Engine logs ingestion Indexer Write-Ahead Log
Indexer Write-Ahead Log writes records Indexer Database
Indexer Database updates search structures Search Index
Search Index supports queries Query Planner
Query Planner executes ranking Ranking Engine
Ranking Engine returns results Registry API
Registry API enforces policy Provider Policy Engine
Registry API emits metrics Metrics Collector
Relay Query Engine feeds history Bulk Subscriber
Bulk Subscriber normalizes data Archive Normalizer
Archive Normalizer stores history Archive Database
Archive Database plans sync Sync Planner
Sync Planner executes sync Sync Executor
Sync Executor updates archive Archive Database
Archive Database serves exports Export API
Registry API creates descriptor Registry Descriptor
Registry Descriptor signs descriptor Descriptor Signer
Descriptor Signer publishes descriptor Ingress Handler
Relay Query Engine provides registry ads Registry Scanner
Registry Scanner selects registries Selection Engine
Selection Engine dispatches queries Fan-Out Engine
Fan-Out Engine collects responses Response Collector
Response Collector normalizes results Result Normalizer
Result Normalizer deduplicates assets Result Deduplicator
Result Deduplicator ranks results Federated Ranker
Federated Ranker serves results Presentation API
Relay Query Engine streams raw events Raw Nostr Client
Raw Nostr Client filters locally Filter Engine
Filter Engine executes code Compute Executor
Registry API provides asset references Asset Fetcher
Asset Fetcher downloads asset Decentralized Asset Storage
Asset Fetcher verifies integrity Integrity Verifier