How irislib/iris-messenger works
Main Components
• Web Frontend: This is the core client built using Vite and Preact. It includes all the user-facing components (views, UI elements, components for feed, chat, profiles, settings, etc.), state management (local state, storage adapters), and helper utilities.
• Tauri Desktop Backend: The “src-tauri” folder holds the Rust-based Tauri integration that wraps the web app into standalone native desktop applications for Windows, macOS, and Linux.
• Static Assets & Build Configuration: This covers the “public” folder (with images, configuration files such as assetlinks.json, robots.txt, etc.), build files (Dockerfile, docker-compose.yml), and project configuration (eslint, prettier, tsconfig, vite.config, etc.).
• Scripts and Tools: The “scripts” directory for CSV/translation utilities and the tests directory for verification.
• External Interfaces: (a) Communication with Nostr relays through various NIP implementations (the README clearly lists a number of NIPs such as NIP-04 for DMs, NIP-42 for relay authentication, etc.) and (b) External integrations for sign up, offline-first capabilities, and browser-based Nostr keys (window.nostr).
Relationships and Interactions
• The Web Frontend (Preact components, state management, routing) communicates with:
• User inputs and events (chat, feeds, profile management) via client-side event handlers.
• The Tauri backend when running as a desktop application; this is often a bidirectional message exchange to tap into native APIs.
• External Nostr relays for real-time event propagation and message exchange.
• The Tauri backend (Rust layer) provides a bridge between the web UI and native OS capabilities (such as file system access, notifications, etc.).
• Docker and build configurations provide environments for development and deployment – using Docker Compose to spin up the environment easily.
• The static assets layer holds assets required for UI presentation, SEO files, and other metadata.
Architectural Patterns & Design Principles
• Separation of Concerns: The project is cleanly split between frontend (view components, state management) and native desktop functionalities (Tauri).
• Component-Based Structure: In the “src/js/components” folder, individual UI pieces (headers, feeds, modals, chat views, etc.) are separated and can be individually updated or reused.
• Offline-first and local state: There’s a clear focus on local event storage (IndexedDB and in-memory adapters) that’s crucial for offline performance.
Including Relevant Technologies and Frameworks
• Vite (for development and bundling) and Preact (for the frontend UI).
• Tailwind CSS and DaisyUI (for styling and UI components).
• TypeScript for safer code in the “src” folder.
• Tauri / Rust (for native desktop builds).
• Docker for containerized development environments.
• GitHub Actions workflows (CI/CD pipelines are visible in the “.github/workflows” folder) that can be shown as supporting automation.
Putting It All Together
1. Client Layer: Include “UI Components”, “Utility Modules”, “Local State Management”, and “Translations/Helpers”.
2. Native/Desktop Layer: Represented by the “src-tauri” block (Rust-Tauri), connected to the Client Layer.
3. Infrastructure & Integration: Include external Nostr relays, Docker and CI/CD pipelines, and static assets/deployment configurations.