# denissimon/cryptocurrency-info architecture

> Architecture diagram of the GitHub repository denissimon/cryptocurrency-info, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/denissimon/cryptocurrency-info
- Repository: https://github.com/denissimon/cryptocurrency-info

## Overview

##### Project type and purpose
- This is a single-platform (iOS) mobile application built in Swift.
- It displays cryptocurrency data (prices, profiles, conversion rates) retrieved from external APIs (Messari API and a currency conversion service).
- Architectural style: Layered Architecture with MVVM-Coordinator (MVVM-C) pattern, dependency injection, data binding (Observable/Event), and configurable persistence (UserDefaults or SwiftData).

##### File structure
Top-level directories and their roles:
- Common: application scaffold (AppDelegate, configuration, shared utilities, data binding/events)
- Coordinator: flow controllers and DI container for wiring and navigation
- Data: abstraction interfaces, network interactors, API definitions, persistence adaptors, repository implementations
- Modules: feature modules (AssetsList, AssetDetails), each containing View, ViewModel, Models, and storyboards
- Services: cross-cutting service (currency conversion)
- Tests: unit and UI tests
Configuration files: Xcode project files, Info.plist, Package.resolved, etc.

##### README for insights
- Confirms use of MVVM-C, Layered Architecture, Swift Concurrency (async/await), URLSessionAdapter, SwiftEvents for data binding, Toast-Swift for UI feedback, UAObfuscatedString for string obfuscation.
- Two feature modules: AssetsList (paging list of cryptocurrencies) and AssetDetails (detailed view per asset).
- Repositories abstract data sources. DIContainer wires interfaces to concrete implementations (network vs persistence).

##### Detail
- Every major class or component group (View, ViewModel, Coordinator, Repositories, Interactors, DIContainer).
- Explicitly show the two persistence options (SwiftDataAdapter vs UserDefaultsAdapter) converging on SettingsRepository.
- Shared events mechanism between modules if used.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        ALVC["AssetsListViewController"]:::presentation
        ALVM["AssetsListViewModel"]:::presentation
        ADVC["AssetDetailsViewController"]:::presentation
        ADVM["AssetDetailsViewModel"]:::presentation
        ALDS["AssetsListDataSource"]:::presentation
        ADDS["AssetDetailsDataSource"]:::presentation
        AC["AssetCell"]:::presentation
        ADC["AssetDetailsCells"]:::presentation
    end

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        AR["AssetRepository"]:::domain
        PR["PriceRepository"]:::domain
        ProR["ProfileRepository"]:::domain
        SR["SettingsRepository"]:::domain
        CCS["CurrencyConversionService"]:::domain
        SE["SharedEvents"]:::domain
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        APIInt["APIInteractor"]:::data
        URLAPI["URLSessionAPIInteractor"]:::data
        MA["MessariAPI"]:::data
        CCA["CurrencyConversionAPI"]:::data
        SBI["SettingsDBInteractor"]:::data
        SDI["SwiftDataSettingsDBInteractor"]:::data
        UDI["UserDefaultsSettingsDBInteractor"]:::data
        SDA["SwiftDataAdapter"]:::data
        SDC["SwiftDataConfiguration"]:::data
        UDA["UserDefaultsAdapter"]:::data
        UDK["UserDefaultsKeys"]:::data
        DAR["DefaultAssetRepository"]:::data
        DPR["DefaultPriceRepository"]:::data
        DProR["DefaultProfileRepository"]:::data
        DSR["DefaultSettingsRepository"]:::data
    end

    %% Infrastructure Layer
    subgraph "Infrastructure"
        direction TB
        ACfg["AppConfiguration"]:::infra
        AD["AppDelegate"]:::infra
        EXT["Extensions & Protocols"]:::infra
        AP["Alertable & Storyboarded"]:::infra
        DC["DIContainer"]:::infra
        APC["AppCoordinator"]:::infra
        FC["FlowCoordinator"]:::infra
        MC["AssetsFeature MainCoordinator"]:::infra
    end

    %% External Systems
    subgraph "External Systems"
        direction TB
        MessariAPIExt[(Messari REST API)]:::external
        ConvAPIExt[(Currency Conversion API)]:::external
        SwiftDataStore[(SwiftData Store)]:::external
        UserDefaultsStore[(UserDefaults Store)]:::external
    end

    %% Connections
    ALVC -->|binds to| ALVM
    ADVC -->|binds to| ADVM
    ALVM -->|uses| AR
    ALVM -->|uses| PR
    ADVM -->|uses| ProR
    ALVM -->|uses| CCS
    AR -->|implemented by| DAR
    PR -->|implemented by| DPR
    ProR -->|implemented by| DProR
    SR -->|implemented by| DSR
    DAR -->|calls| APIInt
    DPR -->|calls| APIInt
    DProR -->|calls| APIInt
    DSR -->|calls| SBI
    APIInt -->|concrete| URLAPI
    URLAPI -->|requests| MA
    URLAPI -->|requests| CCA
    SBI -->|concrete| SDI
    SBI -->|concrete| UDI
    SDI -->|uses| SDA
    SDI -->|uses| SDC
    UDI -->|uses| UDA
    UDI -->|uses| UDK
    MA -->|external| MessariAPIExt
    CCA -->|external| ConvAPIExt
    SDA -->|store in| SwiftDataStore
    UDA -->|store in| UserDefaultsStore

    %% Coordinator wiring
    APC -.->|initializes| DC
    DC -->|injects into| APC
    DC -->|injects into| FC
    DC -->|injects repositories| DAR
    APC -->|coordinates| ALVC
    APC -->|coordinates| ADVC
    FC -->|base for| MC
    MC -->|starts| ALVC
    MC -->|starts| ADVC

    %% Utilities and Events
    EXT -->|provides| APIInt
    AP -->|provides protocols| ALVC
    SE -->|broadcasts| ALVM
    SE -->|broadcasts| ADVM

    %% Click Events
    click ALVC "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Modules/AssetsFeature/AssetsList/View/AssetsListViewController.swift"
    click ADVC "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Modules/AssetsFeature/AssetDetails/View/AssetDetailsViewController.swift"
    click ALVM "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Modules/AssetsFeature/AssetsList/ViewModel/AssetsListViewModel.swift"
    click ADVM "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Modules/AssetsFeature/AssetDetails/ViewModel/AssetDetailsViewModel.swift"
    click AC "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Modules/AssetsFeature/AssetsList/View/Cells/AssetCell.swift"
    click ADC "https://github.com/denissimon/cryptocurrency-info/tree/master/CryptocurrencyInfo/Modules/AssetsFeature/AssetDetails/View/Cells"
    click ALDS "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Modules/AssetsFeature/AssetsList/View/AssetsListDataSource.swift"
    click ADDS "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Modules/AssetsFeature/AssetDetails/View/AssetDetailsDataSource.swift"
    click APC "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Coordinator/AppCoordinator.swift"
    click FC "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Coordinator/FlowCoordinator.swift"
    click DC "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Coordinator/DIContainer/DIContainer.swift"
    click AD "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Common/AppDelegate.swift"
    click ACfg "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Common/AppConfiguration.swift"
    click SE "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Common/SharedEvents.swift"
    click EXT "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Common/Utils/Extensions.swift"
    click AP "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Common/Utils/Protocols/Alertable.swift"
    click AP "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Common/Utils/Protocols/Storyboarded.swift"
    click AR "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Interfaces/AssetRepository.swift"
    click PR "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Interfaces/PriceRepository.swift"
    click ProR "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Interfaces/ProfileRepository.swift"
    click SR "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Interfaces/SettingsRepository.swift"
    click APIInt "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Network/APIInteractor/APIInteractor.swift"
    click URLAPI "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Network/APIInteractor/URLSessionAPIInteractor.swift"
    click MA "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Network/APIs/MessariAPI.swift"
    click CCA "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Network/APIs/CurrencyConversionAPI.swift"
    click SBI "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Persistence/DBInteractor/Settings/SettingsDBInteractor.swift"
    click SDI "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Persistence/DBInteractor/Settings/SwiftDataSettingsDBInteractor.swift"
    click UDI "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Persistence/DBInteractor/Settings/UserDefaultsSettingsDBInteractor.swift"
    click SDA "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Persistence/SwiftData/SwiftDataAdapter.swift"
    click SDC "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Persistence/SwiftData/SwiftDataConfiguration.swift"
    click UDA "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Persistence/UserDefaults/UserDefaultsAdapter.swift"
    click UDK "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Persistence/UserDefaults/UserDefaultsKeys.swift"
    click DAR "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Repositories/DefaultAssetRepository.swift"
    click DPR "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Repositories/DefaultPriceRepository.swift"
    click DProR "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Repositories/DefaultProfileRepository.swift"
    click DSR "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Data/Repositories/DefaultSettingsRepository.swift"
    click CCS "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Services/CurrencyConversionService.swift"
    click MC "https://github.com/denissimon/cryptocurrency-info/blob/master/CryptocurrencyInfo/Modules/AssetsFeature/MainCoordinator.swift"

    %% Styles
    classDef presentation fill:#cce5ff,stroke:#6395ed
    classDef domain fill:#d4edda,stroke:#4fae44
    classDef data fill:#ffe5b4,stroke:#f0a93b
    classDef infra fill:#e2e3e5,stroke:#b1b1b5
    classDef external fill:#f8d7da,stroke:#dc3545
```
