# marcoleder/afribit-wallet architecture

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

- Interactive diagram: https://gitdiagram.com/marcoleder/afribit-wallet
- Repository: https://github.com/marcoleder/afribit-wallet

## Overview

##### Main Components

a. Mobile Application Layer (Frontend)
- React Native Core (iOS & Android)
- UI Components (/app/components)
- Navigation System (/app/navigation)
- Screen Management (/app/screens)
- State Management (/app/store)
- Internationalization System (/app/i18n)

b. Data & Communication Layer
- GraphQL Client (/app/graphql)
- Apollo Client Configuration
- Cache Management
- API Integration

c. Authentication & Security
- Biometric Authentication
- PIN/Password Management
- Secure Storage
- TOTP Implementation

d. Core Wallet Features
- Payment Processing
- Transaction Management
- Bitcoin Operations (Lightning/OnChain)
- QR Code Scanning/Generation

##### Component Relationships

**[Mobile UI Layer] ←→ [State Management]**
- ↕
**[Authentication Layer] ←→ [Secure Storage]**
- ↕
**[GraphQL Client] ←→ [Cache Layer]**
- ↕
**[Galoy Backend API]**

##### Specific Implementation Details

Key architectural patterns:
- Component-based architecture (/app/components structure)
- Screen-based navigation (/app/screens organization)
- GraphQL-based data fetching
- Persistent storage management
- Multi-language support

##### Integration Points

Crucial connections:
- Mobile ←→ Backend Communication
- Payment Processing Flow
- Authentication Flow
- Storage Management

##### Technical Stack Indicators

Technology badges for:
- React Native
- GraphQL/Apollo
- Bitcoin/Lightning Network
- Secure Storage Solutions
- Testing Framework (Jest/Detox)

##### External Integration Layer (Galoy Backend)

Remember to maintain a balance between showing enough detail to understand the system architecture while keeping it clean and readable. Focus on the wallet-specific features and their interaction with the Galoy backend infrastructure.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Mobile Application Layer"
        UI["UI Components"]
        NAV["Navigation System"]
        SCREEN["Screen Management"]
        STATE["State Management"]
        I18N["Internationalization"]
        THEME["Theme System"]
    end

    subgraph "Data & Communication Layer"
        GRAPHQL["GraphQL Client"]
        APOLLO["Apollo Client"]
        CACHE["Cache Management"]
        API["API Integration"]
    end

    subgraph "Authentication & Security"
        AUTH["Authentication"]
        BIO["Biometric Auth"]
        SECURE["Secure Storage"]
        TOTP["TOTP System"]
    end

    subgraph "Core Wallet Features"
        PAY["Payment Processing"]
        TRANS["Transaction Management"]
        BTC["Bitcoin Operations"]
        QR["QR Code System"]
    end

    subgraph "External Layer"
        GALOY["Galoy Backend API"]
        TEST["Testing Infrastructure"]
    end

    %% Relationships
    UI --> NAV
    NAV --> SCREEN
    SCREEN --> STATE
    UI --> I18N
    UI --> THEME

    STATE --> GRAPHQL
    GRAPHQL --> APOLLO
    APOLLO --> CACHE
    APOLLO --> API
    API --> GALOY

    AUTH --> BIO
    AUTH --> SECURE
    AUTH --> TOTP

    SCREEN --> PAY
    SCREEN --> TRANS
    SCREEN --> BTC
    BTC --> QR

    %% Click events
    click UI "https://github.com/marcoleder/AfriBit-wallet/tree/main/app/components"
    click NAV "https://github.com/marcoleder/AfriBit-wallet/tree/main/app/navigation"
    click SCREEN "https://github.com/marcoleder/AfriBit-wallet/tree/main/app/screens"
    click STATE "https://github.com/marcoleder/AfriBit-wallet/tree/main/app/store"
    click I18N "https://github.com/marcoleder/AfriBit-wallet/tree/main/app/i18n"
    click THEME "https://github.com/marcoleder/AfriBit-wallet/tree/main/app/rne-theme"
    click GRAPHQL "https://github.com/marcoleder/AfriBit-wallet/tree/main/app/graphql"
    click APOLLO "https://github.com/marcoleder/AfriBit-wallet/blob/main/apollo.client.js"
    click CACHE "https://github.com/marcoleder/AfriBit-wallet/blob/main/app/graphql/cache.ts"
    click API "https://github.com/marcoleder/AfriBit-wallet/blob/main/app/graphql/client.tsx"
    click BIO "https://github.com/marcoleder/AfriBit-wallet/blob/main/app/utils/biometricAuthentication.ts"
    click SECURE "https://github.com/marcoleder/AfriBit-wallet/blob/main/app/utils/storage/secureStorage.ts"
    click TOTP "https://github.com/marcoleder/AfriBit-wallet/tree/main/app/screens/totp-screen"
    click AUTH "https://github.com/marcoleder/AfriBit-wallet/tree/main/app/screens/authentication-screen"
    click PAY "https://github.com/marcoleder/AfriBit-wallet/tree/main/app/screens/send-bitcoin-screen"
    click TRANS "https://github.com/marcoleder/AfriBit-wallet/tree/main/app/screens/transaction-detail-screen"
    click BTC "https://github.com/marcoleder/AfriBit-wallet/tree/main/app/screens/receive-bitcoin-screen"
    click TEST "https://github.com/marcoleder/AfriBit-wallet/tree/main/e2e"

    %% Styling
    classDef ui fill:#3498db
    classDef data fill:#2ecc71
    classDef security fill:#e74c3c
    classDef bitcoin fill:#f1c40f
    classDef external fill:#9b59b6

    class UI,NAV,SCREEN,STATE,I18N,THEME ui
    class GRAPHQL,APOLLO,CACHE,API data
    class AUTH,BIO,SECURE,TOTP security
    class PAY,TRANS,BTC,QR bitcoin
    class GALOY,TEST external
```
