# zingolabs/zingo-mobile architecture

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

- Interactive diagram: https://gitdiagram.com/zingolabs/zingo-mobile
- Repository: https://github.com/zingolabs/zingo-mobile

## Overview

##### Key Components

a) Frontend Layer:
- React Native UI Components (from /components directory)
- Wallet Interface (Send, Receive, History)
- Settings & Configuration
- Address Book
- Transaction Management
- QR Scanner Integration

b) State Management & Business Logic:
- AppState Management (/app/AppState)
- Context Providers
- State Controllers
- Wallet Settings
- RPC Module Interface (/app/RPCModule)
- Transaction Processing
- Wallet Operations
- Blockchain Interaction

c) Native Bridges:
- iOS Bridge (Swift)
- RPCModule.swift
- Native iOS Components
- Android Bridge (Kotlin)
- RPCModule.kt
- BackgroundSyncWorker.kt

d) Rust Core Layer:
- Zingolib Integration (/rust)
- Wallet Operations
- Cryptographic Functions
- Blockchain Interaction

e) External Services:
- LightwalletD Server Connection
- Price Fetching Services
- Blockchain Network (Zcash)

##### Connection Flows

- User Interface → State Management
- State Management → RPC Module
- RPC Module → Native Bridges
- Native Bridges → Rust Core
- Rust Core → External Services

##### Technical Details to Note

Annotations for:
- Communication Protocols
- Security Measures
- Data Flow Directions
- State Management Patterns
- Error Handling Routes

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Mobile_Apps
        iOS["iOS App"]
        Android["Android App"]
    end

    subgraph Frontend
        UI_Components["UI Components"]:::frontend
        Send["Send Component"]:::frontend
        Receive["Receive Component"]:::frontend
        History["History Component"]:::frontend
        Settings["Settings Component"]:::frontend
        AddressBook["Address Book"]:::frontend
        
        UI_Components --> Send
        UI_Components --> Receive
        UI_Components --> History
        UI_Components --> Settings
        UI_Components --> AddressBook
    end

    subgraph State_Management
        AppState["App State"]:::state
        Context["Context Providers"]:::state
        StateControllers["State Controllers"]:::state
    end

    subgraph RPC_Layer
        RPCModule["RPC Module"]:::rpc
        TransactionProcessor["Transaction Processor"]:::rpc
        WalletOps["Wallet Operations"]:::rpc
    end

    subgraph Native_Bridges
        iOSBridge["iOS Bridge"]:::native
        AndroidBridge["Android Bridge"]:::native
        BackgroundSync["Background Sync Worker"]:::native
    end

    subgraph Rust_Core
        ZingoLib["Zingolib"]:::rust
        CryptoOps["Crypto Operations"]:::rust
        BlockchainInteraction["Blockchain Interaction"]:::rust
    end

    subgraph External_Services
        LightwalletD["LightwalletD Server"]:::external
        PriceService["Price Service"]:::external
        ZcashNetwork["Zcash Network"]:::external
    end

    subgraph Security
        Biometrics["Biometric Auth"]:::security
        SecurityTypes["Security Types"]:::security
    end

    subgraph Localization
        Translations["Translation Files"]:::i18n
    end

    %% Connections
    Mobile_Apps --> Frontend
    Frontend --> State_Management
    State_Management --> RPC_Layer
    RPC_Layer --> Native_Bridges
    Native_Bridges --> Rust_Core
    Rust_Core --> External_Services

    %% Click Events
    click Send "https://github.com/zingolabs/zingo-mobile/blob/dev/components/Send/Send.tsx"
    click Receive "https://github.com/zingolabs/zingo-mobile/blob/dev/components/Receive/Receive.tsx"
    click History "https://github.com/zingolabs/zingo-mobile/blob/dev/components/History/History.tsx"
    click Settings "https://github.com/zingolabs/zingo-mobile/blob/dev/components/Settings/Settings.tsx"
    click AddressBook "https://github.com/zingolabs/zingo-mobile/blob/dev/components/AddressBook/AddressBook.tsx"
    click AppState "https://github.com/zingolabs/zingo-mobile/blob/dev/app/AppState/AppStateLoaded.ts"
    click Context "https://github.com/zingolabs/zingo-mobile/blob/dev/app/context/contextAppLoaded.tsx"
    click RPCModule "https://github.com/zingolabs/zingo-mobile/blob/dev/app/RPCModule/RPCModule.ts"
    click iOSBridge "https://github.com/zingolabs/zingo-mobile/blob/dev/ios/RPCModule.swift"
    click AndroidBridge "https://github.com/zingolabs/zingo-mobile/blob/dev/android/app/src/main/java/org/ZingoLabs/Zingo/RPCModule.kt"
    click BackgroundSync "https://github.com/zingolabs/zingo-mobile/blob/dev/android/app/src/main/java/org/ZingoLabs/Zingo/BackgroundSyncWorker.kt"
    click ZingoLib "https://github.com/zingolabs/zingo-mobile/blob/dev/rust/lib/src/lib.rs"
    click Biometrics "https://github.com/zingolabs/zingo-mobile/blob/dev/app/simpleBiometrics.ts"
    click SecurityTypes "https://github.com/zingolabs/zingo-mobile/blob/dev/app/AppState/enums/SecurityTypeEnum.ts"
    click Translations "https://github.com/zingolabs/zingo-mobile/tree/dev/app/translations"

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef state fill:#2ecc71,stroke:#27ae60,color:white
    classDef rpc fill:#e67e22,stroke:#d35400,color:white
    classDef native fill:#9b59b6,stroke:#8e44ad,color:white
    classDef rust fill:#e74c3c,stroke:#c0392b,color:white
    classDef external fill:#34495e,stroke:#2c3e50,color:white
    classDef security fill:#f1c40f,stroke:#f39c12,color:black
    classDef i18n fill:#95a5a6,stroke:#7f8c8d,color:white
```
