# csc301-2025-f/project-9-orali-project-for-android architecture

> Architecture diagram of the GitHub repository csc301-2025-f/project-9-orali-project-for-android, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/csc301-2025-f/project-9-orali-project-for-android
- Repository: https://github.com/csc301-2025-f/project-9-orali-project-for-android

## Overview

##### Project Type and Purpose
- Type: Multi-module Android mobile wallet application with supporting libraries.
– A shared Kotlin library (“taler-kotlin-android”) providing common Taler utilities.
– A local SQLite transaction database module (“transaction-database”).
– The main Android wallet app (“wallet”) built with Jetpack Compose, MVVM, and Kotlin.

##### File Structure
- Top-level modules:
– taler-kotlin-android: reusable Kotlin code (HTTP utils, data models, crypto, QR code).
– transaction-database: local SQLite schema, data-access layer, database models & filters.
– wallet: Android application, MVVM structure, Compose UI, network/backend layer, local preferences via Protobuf, CI/CD scripts, Fastlane.
- Other artifacts:
– Gradle wrapper, settings.gradle, build scripts.
– GitHub Actions workflows and contrib/ci jobs for building & deploying each module.
– deliverables and planning docs (non-runtime).

##### Extract Architectural Insights from README
- Architecture style: Modular layered architecture on the client (library → data → UI).
- MVVM pattern: ViewModels, managers, repository-style classes.
- Core technologies: Kotlin, AndroidX, Jetpack Compose, SQLite, Protobuf, Fastlane, GitHub Actions.
- External dependency: GNU Taler backend (HTTP API called by WalletBackendApi).

##### Main Components & Their Relationships

A. taler-kotlin-android library
- Provides:
– Common data models (Amount, CurrencySpecification, Tranx, etc.)
– Utilities (HttpUtils, QrCodeManager, CryptoUtils)
- Dependencies: None (top-level reusable library).

B. transaction-database module
- Provides:
– SQLite database schema & data-access (Queries, TranxDatabase)
– Filter classes for history.
- Depends on: taler-kotlin-android (shared data model classes).

C. wallet Android App
- Layers:
1. UI (Jetpack Compose screens, Fragments)
2. ViewModels & Managers (BalanceManager, DepositManager, PeerManager, TransactionManager, etc.)
3. Data/Backend Layer:
– Local storage: Transaction-database, user-prefs Protobuf via SettingsManager
– Remote API: WalletBackendApi, BackendManager over NetworkInterface/RequestManager
- Depends on:
– taler-kotlin-android (models, utilities)
– transaction-database (for history)

D. External Services
- GNU Taler Backend: REST API endpoints for payment, deposit, withdraw.
- QR Code: scanning & generation within device via QrCodeManager.

E. CI/CD & Deployment
- GitHub Actions + contrib/ci jobs:
– Module builds & tests
– Fastlane for wallet’s Play Store / FDroid deployment

– From each Manager/ViewModel to either local DB module or remote API module.
– From remote API module to external GNU Taler backend.
– From wallet to Protobuf user-prefs storage.
– From taler-kotlin-android utilities to both wallet and transaction-database modules.
– CI/CD pipeline orchestrating builds of all modules and deployment of the wallet APK.

##### Architectural Patterns & Principles
- Modularity: clear separation into library, database, and application modules.
- Layering: UI → ViewModel → Data Repository (DB / Network).
- MVVM: Compose UI bound to ViewModels.
- Repository Pattern: Managers abstract data sources.
- Single Responsibility: Each module and class has a focused role.
- Dependency Flow: Only top-level modules depend on lower-level libraries.

##### Relevant Technologies & Frameworks
– Kotlin + Android Gradle Plugin
– Jetpack Compose, AndroidX (Lifecycle, Navigation)
– SQLite (via transaction-database module)
– Protobuf (user_prefs.proto)
– HTTP/REST via Retrofit-style RequestManager
– Fastlane (app distribution)
– GitHub Actions & custom CI scripts

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Library Module"
        TK["taler-kotlin-android"]:::library
        QR["QrCodeManager"]:::library
    end

    subgraph "Database Module"
        TD[(transaction-database)]:::database
    end

    subgraph "Wallet App"
        subgraph "UI Layer"
            UI["Compose & Fragments"]:::appUI
        end
        subgraph "ViewModel & Managers"
            VM["MainViewModel & Managers"]:::viewModel
        end
        subgraph "Data Layer"
            PREF[(Protobuf Prefs)]:::database
            NET["Network / Backend"]:::dataLayer
            DBdep[(transaction-database)]:::database
        end
    end

    EXT((GNU Taler Backend)):::external

    subgraph "CI/CD & Deployment"
        GH1["GitHub Actions Workflow"]:::cicd
        GH2["CI Jobs"]:::cicd
        FL1["Fastlane Fastfile"]:::cicd
        FL2["Fastlane Appfile"]:::cicd
    end

    %% Relationships
    TK --> TD
    TK --> VM
    TK --> QR
    UI --> VM
    VM --> DBdep
    VM --> NET
    VM --> PREF
    NET --> EXT
    GH1 -.-> TK
    GH1 -.-> TD
    GH2 -.-> VM
    FL1 -.-> UI
    FL2 -.-> UI

    %% Click Events
    click TK "https://github.com/csc301-2025-f/project-9-orali-project-for-android/tree/main/taler-kotlin-android/src/main/java/net/taler/common"
    click QR "https://github.com/csc301-2025-f/project-9-orali-project-for-android/blob/main/taler-kotlin-android/src/main/java/net/taler/common/QrCodeManager.kt"
    click TD "https://github.com/csc301-2025-f/project-9-orali-project-for-android/tree/main/transaction-database/src/main/java/net/taler/database"
    click UI "https://github.com/csc301-2025-f/project-9-orali-project-for-android/tree/main/wallet/src/main/java/net/taler/wallet"
    click VM "https://github.com/csc301-2025-f/project-9-orali-project-for-android/tree/main/wallet/src/main/java/net/taler/wallet"
    click NET "https://github.com/csc301-2025-f/project-9-orali-project-for-android/tree/main/wallet/src/main/java/net/taler/wallet/backend"
    click PREF "https://github.com/csc301-2025-f/project-9-orali-project-for-android/blob/main/wallet/src/main/proto/user_prefs.proto"
    click GH1 "https://github.com/csc301-2025-f/project-9-orali-project-for-android/blob/main/.github/workflows/issue-reminder.yaml"
    click GH2 "https://github.com/csc301-2025-f/project-9-orali-project-for-android/tree/main/contrib/ci/jobs/0-taler-kotlin-android-test"
    click FL1 "https://github.com/csc301-2025-f/project-9-orali-project-for-android/tree/main/wallet/fastlane/Fastfile"
    click FL2 "https://github.com/csc301-2025-f/project-9-orali-project-for-android/tree/main/wallet/fastlane/Appfile"

    %% Styles
    classDef library fill:#D6EAF8,stroke:#1B4F72,color:#1B4F72;
    classDef database fill:#D5F5E3,stroke:#196F3D,color:#196F3D;
    classDef appUI fill:#FCF3CF,stroke:#7D6608,color:#7D6608;
    classDef viewModel fill:#FADBD8,stroke:#7B241C,color:#7B241C;
    classDef dataLayer fill:#E8DAEF,stroke:#4A235A,color:#4A235A;
    classDef external fill:#FDEDEC,stroke:#943126,color:#943126;
    classDef cicd fill:#EBF5FB,stroke:#1B4F72,color:#1B4F72;
```
