# swarabhalerao/bitcoin-ticker architecture

> Architecture diagram of the GitHub repository swarabhalerao/bitcoin-ticker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/swarabhalerao/bitcoin-ticker
- Repository: https://github.com/swarabhalerao/bitcoin-ticker

## Overview

##### Main Components
- Mobile UI Layer: Represented by the Flutter front end. Key files include lib/main.dart and lib/price_screen.dart where the UI logic is implemented.
- Business Logic / Services Layer: This layer includes files like lib/coin_data.dart, lib/currency_exchange.dart, and lib/networking.dart. They handle the processing of data, API interactions, and currency conversion logic.
- Platform-Specific Integration: The android and ios directories indicate that native build files and configurations exist to support the Flutter platform on both Android and iOS.

##### Depicting Relationships and Data Flow
- The UI (Price Screen) responds to user input (such as selecting a currency from a dropdown) and then triggers calls to the business logic layer.
- The business logic layer uses networking components to fetch data from external cryptocurrency APIs. This data is then processed (using coin_data and currency_exchange modules) and sent back to the UI to update the display.
- Additionally, the mobile app’s platform-specific configurations (in android/ and ios/) support the app's integration with native services such as permissions, display configuration, and possibly notifications for future features.

##### Architectural Patterns
- Separation of Concerns: The clear division between UI (presentation layer) and business logic (data fetching, processing, conversion) should be highlighted.
- Service-Oriented Communication: The networking components abstract away API calls, which allow for easier testing and future extensibility.
- Flutter’s Reactive UI: Emphasize how the UI layer might be updated reactively based on asynchronous API responses.

## Diagram (Mermaid)

```mermaid
graph TD
    User["User"]:::actor

    subgraph "Mobile UI Layer"
        UI_Main["App Main (Flutter)"]:::ui
        UI_P["Price Screen"]:::ui
    end

    subgraph "Business Logic / Services Layer"
        Coin_Data["Coin Data"]:::business
        Currency_Exchange["Currency Exchange"]:::business
        Networking["Networking"]:::business
    end

    subgraph "Platform-Specific Integration"
        Android["Android Integration"]:::platform
        IOS["iOS Integration"]:::platform
    end

    External_API["Crypto Price API"]:::external

    User -->|"selectsCurrency"| UI_P
    UI_P -->|"triggersCall"| Networking
    Networking -->|"fetchesData"| External_API
    External_API -->|"returnsData"| Networking
    Networking -->|"updates"| Coin_Data
    Networking -->|"updates"| Currency_Exchange
    Coin_Data -->|"updatesUI"| UI_P
    Currency_Exchange -->|"updatesUI"| UI_P
    UI_Main -->|"integratesWith"| Android
    UI_Main -->|"integratesWith"| IOS

    click UI_Main "https://github.com/swarabhalerao/bitcoin-ticker/blob/main/lib/main.dart"
    click UI_P "https://github.com/swarabhalerao/bitcoin-ticker/blob/main/lib/price_screen.dart"
    click Coin_Data "https://github.com/swarabhalerao/bitcoin-ticker/blob/main/lib/coin_data.dart"
    click Currency_Exchange "https://github.com/swarabhalerao/bitcoin-ticker/blob/main/lib/currency_exchange.dart"
    click Networking "https://github.com/swarabhalerao/bitcoin-ticker/blob/main/lib/networking.dart"
    click Android "https://github.com/swarabhalerao/bitcoin-ticker/tree/main/android/"
    click IOS "https://github.com/swarabhalerao/bitcoin-ticker/blob/main/ios/Runner/AppDelegate.swift"

    classDef ui fill:#FDE68A,stroke:#333,stroke-width:2px;
    classDef business fill:#C7F9CC,stroke:#333,stroke-width:2px;
    classDef platform fill:#A5D8FF,stroke:#333,stroke-width:2px;
    classDef external fill:#FECACA,stroke:#333,stroke-width:2px;
    classDef actor fill:#D1C4E9,stroke:#333,stroke-width:2px;
```
