# tomwyr/lol-champion-rotation-mobile architecture

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

- Interactive diagram: https://gitdiagram.com/tomwyr/lol-champion-rotation-mobile
- Repository: https://github.com/tomwyr/lol-champion-rotation-mobile

## Overview

##### Main Components
- Mobile Frontend (Flutter UI):
- Represented in the “lib/ui” directory. This includes various screens such as the champion rotation page, details page, notifications, search, settings, etc.
- Business Logic & State Management:
- Found in “lib/core” (models, state, stores) and “lib/dependencies”. This layer handles the app’s state via various “stores” (for app state, champion details, rotations, etc.) and enforces business rules.
- Using a pattern visual cue (e.g., MVC/MVVM-like separation) to emphasize its role.
- Data & Service Layer:
- In “lib/data” you have API client code and various “services” (authentication, FCM, permissions, app store service). This layer is responsible for communicating with external services, likely including the related backend service.
- How this layer interfaces with the business logic to update state and supply data.
- Assets & Resources:
- Includes the “assets” folder (images) and platform resource configurations (Android’s resources and iOS’ Assets, storyboards).
- Platform Specific Layers:
- Android and iOS directories encapsulate native configuration and build scripts. They are the entry points for native build and deployment.
- CI/CD Pipelines:
- The “.github/workflows” directory with deployment workflows (deploy-android.yml and deploy-ios.yml) indicates that deployments for both platforms are automated and integrated with the main codebase.

##### Relationships and Interactions
- The UI layer interacts with the Business Logic layer (the “stores” and “state” modules) by triggering events and observing changes.
- The Business Logic layer communicates with the Data & Service layer to fetch champion rotations, notifications, and other data; this service layer in turn may communicate with a backend through REST APIs.
- Assets (graphics and configurations) are used by both UI and native modules.
- Platform-specific code in the Android and iOS directories encapsulates the native entry points while calling into the Flutter portions of the app.
- CI/CD pipelines trigger build, test, and deployment processes for both platforms.

##### Important Architectural Patterns
- State Management and Observer Pattern:
- The use of “stores” in the lib/core/stores and the well-organized UI components suggests an architecture where UI elements subscribe to state updates.
- Separation of Concerns:
- Clear division between UI presentation (lib/ui), business logic (lib/core), and data access (lib/data) promotes a modular and maintainable design.
- Platform Abstraction:
- Utilizing Flutter allows the core logic and UI to be code-shared while still providing native build/configuration (Android and iOS directories).
- Dependency Injection:
- The “lib/dependencies” folder may point to patterns where services are centrally registered and injected where needed.

- “Mobile Frontend (Flutter)”, “Business Logic & State Management”, “Data & Service Layer”, “Native Platform Integrations (Android / iOS)”, “CI/CD and Deployment Pipelines”, and “External Services (Backend API)”.
- User actions flowing from the UI to the State layer.
- Asynchronous API calls from the Business Logic to the Data services.
- Configuration flow from the CI/CD pipelines to the mobile build pipelines.
- Use annotations to highlight key technologies or frameworks:
- Mention Flutter/Dart, usage of Firebase Cloud Messaging (FCM), and any dependency injection patterns indicated by the “dependencies” folder.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CI/CD Pipelines
    subgraph "CI/CD Pipelines"
        CICD["CI/CD Pipelines"]
    end

    %% Platform Specific Layers
    subgraph "Platform Specific Layers"
        Android_Node["Android Native (android)"]
        iOS_Node["iOS Native (ios)"]
    end

    %% Assets & Resources
    subgraph "Assets & Resources"
        Assets_Node["Assets (assets)"]
        Android_Res["Android Resources (android/app/src/main/res)"]
        iOS_Res["iOS Assets (ios/Runner/Assets.xcassets)"]
    end

    %% Mobile Frontend
    UI["Mobile Frontend (Flutter UI)"]

    %% Business Logic & State Management
    subgraph "Business Logic & State Management"
        BLL_Core["Core (lib/core)"]
        BLL_Dep["Dependencies (lib/dependencies)"]
    end

    %% Data & Service Layer
    subgraph "Data & Service Layer"
        Data_Main["API Client (lib/data)"]
        Data_Services["Services (lib/data/services)"]
    end

    %% External Services
    External["Backend API"]

    %% Connections
    CICD -->|"builds_deploys"| Android_Node
    CICD -->|"builds_deploys"| iOS_Node

    Android_Node -->|"launches"| UI
    iOS_Node -->|"launches"| UI

    Assets_Node -->|"resources"| UI
    Android_Res -->|"resources"| Android_Node
    iOS_Res -->|"resources"| iOS_Node

    UI -->|"triggers_state"| BLL_Core

    BLL_Core -->|"uses_dependency"| BLL_Dep

    BLL_Core -->|"requests_data"| Data_Main
    BLL_Dep -->|"calls_services"| Data_Services

    Data_Main -->|"fetches_from"| External
    Data_Services -->|"fetches_from"| External

    %% Styles
    class CICD cicd
    class Android_Node,iOS_Node native
    class UI ui
    class BLL_Core,BLL_Dep logic
    class Data_Main,Data_Services data
    class Assets_Node,Android_Res,iOS_Res assets
    class External external

click CICD "https://github.com/tomwyr/lol-champion-rotation-mobile/tree/main/.github/workflows"
click Android_Node "https://github.com/tomwyr/lol-champion-rotation-mobile/tree/main/android"
click iOS_Node "https://github.com/tomwyr/lol-champion-rotation-mobile/tree/main/ios"
click UI "https://github.com/tomwyr/lol-champion-rotation-mobile/tree/main/lib/ui"
click BLL_Core "https://github.com/tomwyr/lol-champion-rotation-mobile/tree/main/lib/core"
click BLL_Dep "https://github.com/tomwyr/lol-champion-rotation-mobile/tree/main/lib/dependencies"
click Data_Main "https://github.com/tomwyr/lol-champion-rotation-mobile/tree/main/lib/data"
click Data_Services "https://github.com/tomwyr/lol-champion-rotation-mobile/tree/main/lib/data/services"
click Assets_Node "https://github.com/tomwyr/lol-champion-rotation-mobile/tree/main/assets"
click Android_Res "https://github.com/tomwyr/lol-champion-rotation-mobile/tree/main/android/app/src/main/res"
click iOS_Res "https://github.com/tomwyr/lol-champion-rotation-mobile/blob/main/ios/Runner/Assets.xcassets"
```
