# daewu14/my-base-getx-flutter architecture

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

- Interactive diagram: https://gitdiagram.com/daewu14/my-base-getx-flutter
- Repository: https://github.com/daewu14/my-base-getx-flutter

## Overview

##### Project Type and Purpose
- This project is a Flutter application meant to serve as a starting point with a focus on performance and code cleanliness.
- It implements a custom MVVM pattern and leverages GetX to merge controllers with viewmodels, along with a reliable repository for API data handling.
- The app is designed to work on both Android and iOS, as seen by the separate platform directories.

##### Main Components
a. Mobile Platforms:
- Android Module: Represented by the "android" directory including native build scripts and resources.
- iOS Module: Represented by the "ios" directory containing Xcode project files and necessary configuration.
b. Flutter Application Core (lib):
- UI Layer: Under "lib/views" which houses the screens (e.g., home_screen.dart, test_screen.dart) and bindings.
- ViewModel/Controller Layer: Located in "lib/view_models" and "lib/base" (with shared controllers and common widgets). This layer implements the MVVM pattern and integrates the GetX controllers.
- Repository & Data Layer: The "lib/repository" and "lib/base/networking" directories implement API calls and data fetching logic.
- Models: In "lib/models" containing data representations (e.g., member.dart).
- Utility & Resources: "lib/x_res" (themes, configuration, translations) and "lib/x_utils" provide shared logic and custom widgets.
- Routing: "lib/x_routes" holds routing definitions and navigation structures.

##### Relationships and Interactions
- The UI Layer interacts with the ViewModel/Controller layer (via GetX) to trigger business logic and respond to user inputs.
- The ViewModel/Controller communicates with the Repository (and, indirectly, the Networking API code) to fetch or persist data.
- Data is modeled in the Models directory and then passed between layers.
- Utility and resource components support the UI and business logic with configuration settings, custom formatting, and asset access.
- The assets directory (with fonts, images, JSON data, etc.) is referenced by the app to provide static resources.

##### Architectural Patterns and Design Principles
- MVVM Architecture: Clearly separating view, viewmodel (logic), and model (data) components.
- Use of GetX: Simplifies state management, dependency injection, and routing between the UI and the business logic layers.
- Modularization: The code is organized in a way that each folder represents a distinct responsibility (for example, “lib/base” for common logic, “lib/view_models” for screen-specific controllers).

##### Specific Elements
- Clear labels:
- Data flow and interactions (e.g., UI triggers events in the ViewModel; ViewModel calls the Repository; Repository fetches data from the API).
- Visual Distinction:
- Connection between Platforms and Shared Core:
- The mobile platform components (Android and iOS) should connect to a single Flutter engine representing the core app, which then follows the MVVM pattern internally.

- UI (views and bindings)
- Business Logic (controllers and viewmodels)
- Data Layer (repositories, networking, models)
- Supporting utilities and resources (configuration, translations, theming) as auxiliary components that interface with the UI and business logic.
- Clearly denote external dependencies (e.g., GetX for state management) near the relevant components (ViewModel/Controller layer).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Mobile Platforms
    subgraph "Mobile Platforms"
        A["Android Module"]:::mobile
        I["iOS Module"]:::mobile
    end

    %% Flutter Application Core with MVVM Layers
    subgraph "Flutter Application Core"
        %% Presentation Layer
        subgraph "Presentation Layer"
            UI["UI Layer (Views)"]:::ui
            R["Routing"]:::aux
        end

        %% Business Logic Layer
        subgraph "Business Logic Layer"
            VM["ViewModel/Controller Layer"]:::logic
            B["Base (Common MVVM)"]:::logic
            G["GetX Dependency"]:::external
        end

        %% Data Layer
        subgraph "Data Layer"
            REP["Repository & Data Layer"]:::data
            NET["Networking Module"]:::data
            MOD["Models"]:::data
        end
    end

    %% Supporting Utilities and Assets
    U["Utilities & Resources"]:::aux
    W["Custom Widgets"]:::aux
    ARes["Assets & Resources"]:::aux

    %% Connections between Mobile Platforms and Flutter Core
    A -->|"launches"| UI
    I -->|"launches"| UI

    %% Interactions within Flutter Core
    UI -->|"triggers"| VM
    UI -->|"navigates via"| R
    VM -->|"calls"| REP
    REP -->|"uses"| NET
    REP -->|"formats data with"| MOD
    VM -->|"inherits from"| B
    VM -.->|"managed by"| G

    %% Supporting Utilities interactions
    U -->|"supports"| UI
    U -->|"supports"| VM
    W -->|"enhances"| UI
    ARes -->|"supplies"| U

    %% Click Events
    click A "https://github.com/daewu14/my-base-getx-flutter/tree/master/android"
    click I "https://github.com/daewu14/my-base-getx-flutter/tree/master/ios"
    click UI "https://github.com/daewu14/my-base-getx-flutter/tree/master/lib/views"
    click R "https://github.com/daewu14/my-base-getx-flutter/tree/master/lib/x_routes"
    click VM "https://github.com/daewu14/my-base-getx-flutter/tree/master/lib/view_models"
    click B "https://github.com/daewu14/my-base-getx-flutter/tree/master/lib/base"
    click REP "https://github.com/daewu14/my-base-getx-flutter/tree/master/lib/repository"
    click NET "https://github.com/daewu14/my-base-getx-flutter/tree/master/lib/base/networking"
    click MOD "https://github.com/daewu14/my-base-getx-flutter/tree/master/lib/models"
    click U "https://github.com/daewu14/my-base-getx-flutter/tree/master/lib/x_res"
    click W "https://github.com/daewu14/my-base-getx-flutter/tree/master/lib/x_utils/widgets"
    click ARes "https://github.com/daewu14/my-base-getx-flutter/tree/master/assets"

    %% Styling
    classDef mobile fill:#FFCC00,stroke:#000,stroke-width:2px;
    classDef ui fill:#66CCFF,stroke
```
