# whsprs/android-whisp-sdk architecture

> Architecture diagram of the GitHub repository whsprs/android-whisp-sdk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/whsprs/android-whisp-sdk
- Repository: https://github.com/whsprs/android-whisp-sdk

## Overview

##### High-Level Architecture Components

a) SDK Modules (Core Components):
- SDK-UI Module (UI Components)
- SDK-BE Module (Backend Services)
- SDK-ALL Module (Integration Layer)

b) Supporting Infrastructure:
- Build System
- Common Components
- Core Services

##### Component Relationships

**Client Application**
- ↓
**SDK-ALL (Integration Layer)**
- ↙        ↘
**SDK-UI    SDK-BE**
- ↓         ↓
**Common Components**
- ↓
**Core Services**

##### Detailed Component Breakdown

SDK-BE Module:
- Chat Core System
- Session Management
- Message Controllers
- Transport Layer
- WebSocket Server
- API Integration

SDK-UI Module:
- Chat UI Components
- Theme System
- Animations
- Message Input/Output
- Custom Views

Common Components:
- DI System
- MVI Architecture
- UI Components
- Build Conventions

##### Data Flow Representation

Key flows:
- Message Flow: Client → SDK → Backend Services
- UI Updates: Backend → SDK-BE → SDK-UI → Client
- WebSocket Events: Backend ↔ SDK-BE
- Transaction Handling: SDK-BE → Blockchain

##### Technical Details

Implementations:
- Message Queue System
- Session Management
- Transaction Signing
- Polling Mechanism
- Component Dependencies

##### The dependency injection system

Keep the abstraction level high enough to be understandable but detailed enough to show the sophisticated architecture of the SDK.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        CA[Client Application]
    end

    subgraph Integration
        SDKALL[SDK-ALL Module]
    end

    subgraph "SDK Modules"
        subgraph "SDK-UI"
            SDKUI[SDK-UI Module]
            TH[Theme System]
            UICOMP[UI Components]
            ANIM[Animations]
            MSGIO[Message Input/Output]
            CVIEWS[Custom Views]
        end

        subgraph "SDK-BE"
            SDKBE[SDK-BE Module]
            subgraph "Chat Core"
                CCS[Chat Core System]
                MC[Message Controllers]
                TL[Transport Layer]
                SM[Session Management]
                MQ[Message Queue System]
            end
            WS[WebSocket Server]
            API[API Integration]
        end
    end

    subgraph "Infrastructure"
        subgraph "Common Components"
            DI[DI System]
            MVI[MVI Architecture]
            CUIC[Common UI Components]
        end
        BS[Build System]
        CS[Core Services]
    end

    %% Relationships
    CA --> SDKALL
    SDKALL --> SDKUI
    SDKALL --> SDKBE
    SDKUI --> DI
    SDKBE --> DI
    SDKUI --> MVI
    SDKBE --> MVI
    SDKUI --> CUIC
    DI --> CS
    MVI --> CS
    CUIC --> CS

    %% SDK-UI Internal
    SDKUI --> TH
    SDKUI --> UICOMP
    SDKUI --> ANIM
    SDKUI --> MSGIO
    SDKUI --> CVIEWS

    %% SDK-BE Internal
    SDKBE --> CCS
    CCS --> MC
    CCS --> TL
    CCS --> SM
    CCS --> MQ
    SDKBE --> WS
    SDKBE --> API

    %% Styling
    classDef ui fill:#3498db
    classDef backend fill:#2ecc71
    classDef integration fill:#f1c40f
    classDef infrastructure fill:#95a5a6
    classDef critical fill:#e74c3c

    class SDKUI,TH,UICOMP,ANIM,MSGIO,CVIEWS ui
    class SDKBE,CCS,MC,TL,SM,WS,API backend
    class SDKALL integration
    class DI,MVI,CUIC,BS,CS infrastructure
    class MQ critical

    %% Click Events
    click SDKUI "https://github.com/whsprs/android-whisp-sdk/tree/master//sources/sdk/ui"
    click SDKBE "https://github.com/whsprs/android-whisp-sdk/tree/master//sources/sdk/be"
    click SDKALL "https://github.com/whsprs/android-whisp-sdk/tree/master//sources/sdk/all"
    click CCS "https://github.com/whsprs/android-whisp-sdk/tree/master//sources/sdk/be/src/main/kotlin/ai/whsprs/sdk/be/chat/core"
    click MC "https://github.com/whsprs/android-whisp-sdk/tree/master//sources/sdk/be/src/main/kotlin/ai/whsprs/sdk/be/chat/core/messaging/controller"
    click WS "https://github.com/whsprs/android-whisp-sdk/tree/master//sources/sdk/be/src/main/kotlin/ai/whsprs/sdk/be/ws"
    click UICOMP "https://github.com/whsprs/android-whisp-sdk/tree/master//sources/sdk/ui/src/main/kotlin/ai/whsprs/sdk/ui/components"
    click TH "https://github.com/whsprs/android-whisp-sdk/tree/master//sources/sdk/ui/src/main/kotlin/ai/whsprs/sdk/ui/theme"
    click DI "https://github.com/whsprs/android-whisp-sdk/tree/master//sources/common/di"
    click MVI "https://github.com/whsprs/android-whisp-sdk/tree/master//sources/core/mvi"
    click MQ "https://github.com/whsprs/android-whisp-sdk/tree/master//sources/sdk/be/src/main/kotlin/ai/whsprs/sdk/be/chat/core/messaging/queue"
    click SM "https://github.com/whsprs/android-whisp-sdk/tree/master//sources/sdk/be/src/main/kotlin/ai/whsprs/sdk/be/chat/core/session"
    click TL "https://github.com/whsprs/android-whisp-sdk/tree/master//sources/sdk/be/src/main/kotlin/ai/whsprs/sdk/be/chat/core/messaging/transport"
    click CUIC "https://github.com/whsprs/android-whisp-sdk/tree/master//sources/common/ui"
    click BS "https://github.com/whsprs/android-whisp-sdk/tree/master//build-conventions"
```
