How getalby/hub works
Key Components to Include:
Core Services Layer
• "LNClient Interface" which abstracts different wallet implementations
• "Transactions Service" for managing payment records
• "Event Publisher" system for internal communication
Wallet Implementations
• LDK (Lightning Development Kit)
• LND
• Phoenixd
• Cashu
• Breez
• Greenlight
Frontend Layer
• Dual-mode architecture:
• HTTP Web App mode
• Desktop (Wails) mode
• React components and routing
• Authentication flow (JWT for HTTP mode)
Communication Layer
• NIP-47 Protocol handlers
• Nostr relay communication
• Internal API endpoints
• WebSocket connections for real-time updates
Storage Layer
• SQLite database
• Encrypted storage for sensitive data
• Channel backup system
External Integrations
• Alby OAuth service
• Lightning Network
• Nostr network
• External apps using NWC
• Blue: Core services
• Green: Wallet implementations
• Orange: Frontend components
• Purple: Communication layers
• Gray: Storage components
• Yellow: External integrations
Specific flows
• Payment flow
• Authentication flow
• Event propagation
• App connection flow
Event Flow
• LNClient -> Event Publisher -> Transaction Service -> NIP-47 Notifier -> Connected Apps
Authentication Chain
• Frontend -> Auth Service -> JWT/Wails -> Protected Services
Payment Flow
• NIP-47 Request -> Handler -> Transaction Service -> LNClient -> Lightning Network
Demonstrate the relationship between NIP-47 and internal API
• Component types
• Different connection types
• Important event types
• Version information
This architecture should clearly show how Alby Hub functions as a self-sovereign, self-custodial, single-user NWC-first application while maintaining security and providing flexibility in deployment options.