How relaystr/ndk works
High-Level Architecture Overview
┌─ NDK Core ─────────────────────────────────────────┐
• ┌─ Domain Layer ─┐ ┌─ Data Layer ──┐ │
• Use Cases │◄─►│ Repositories │ │
• Entities │ │ Data Sources │ │
• ┘ └───────────────┘ │
• ┘
┌─ Implementation Packages ───────────────────────────┐
• ┌─ Amber ─────┐ ┌─ Storage ────┐ ┌─ Rust ────┐ │
• ObjectBox │ │ │ │
• Signer │ │ - Isar │ │ Verifier │ │
• ┘ └─────────────┘ └───────────┘ │
• ┘
Detailed Component Breakdown
a. Domain Layer:
┌─ Domain Layer ──────────────────────────────────┐
• ┌─ Entities ───┐ ┌─ Use Cases ────────────┐ │
• Events │ │ - Broadcast │ │
• Metadata │ │ - Cache Read/Write │ │
• Filters │ │ - JIT Engine │ │
• Relays │ │ - Metadata Management │ │
• ┘ └────────────────────────┘ │
• ┌─ Repositories (Interfaces) ───────────────┐ │
• EventSigner │ │
• EventVerifier │ │
• CacheManager │ │
• NostrTransport │ │
• ┘ │
• ┘
b. Data Layer:
┌─ Data Layer ───────────────────────────────────┐
• ┌─ Data Sources ─┐ ┌─ Repositories ───────┐ │
• WebSocket │ │ - WebSocketTransport │ │
• HTTP Request │ │ - MemCacheManager │ │
• ┘ └───────────────────────┘ │
• ┌─ Implementation Bridges ──────────────────┐ │
• Amber Signer │ │
• Rust Verifier │ │
• ObjectBox/Isar Storage │ │
• ┘ │
• ┘
Implementation Details
• Database implementations:
┌─ Storage Implementations ─────────────────────┐
• ┌─ ObjectBox ──┐ ┌─ Isar ─────────────┐ │
• DB Schema │ │ DB Schema │ │
• Cache Manager│ │ Cache Manager │ │
• ┘ └──────────────────────┘ │
• ┘
Deployment View
┌─ Application Integration ──────────────────────┐
• ┌─ Flutter App ─┐ │
• NDK Core │──► Nostr Network │
• Storage │ │
• Signer │ │
• ┘ │
• ┘
Remember to:
• Use consistent notation throughout
• Clear boundaries between components
• Both synchronous and asynchronous interactions
• Document any important architectural decisions
This structure reflects the project's clean architecture approach while showing how the different packages interact to provide a complete Nostr development solution.