# duongwthuj/e-commerce-app architecture

> Architecture diagram of the GitHub repository duongwthuj/e-commerce-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/duongwthuj/e-commerce-app
- Repository: https://github.com/duongwthuj/e-commerce-app

## Overview

##### Main Components
- Frontend (Presentation Layer): Represented by the Flutter UI code in the lib folder.
- Primary entry point (lib/main.dart) and navigation components (lib/navigation_menu.dart).
- Break out feature-specific screens found in lib/features (e.g., authentication, shop). Within authentication, show separate screens for login, signup, onboarding, and password configuration.
- Business Logic / Controllers:
- Controllers (for example, the onboarding_controller.dart in lib/features/authentication/controllers_onboarding) and any state management that may be used to mediate between the UI and the services.
- Data Layer:
- Services and repositories in lib/data which manage data retrieval and local storage (lib/utlis/local_storage, lib/data/services, and lib/data/respositories). This layer interacts with external sources or APIs.
- Utilities and Themes:
- Common utilities (helpers, device utilities, logging, validators) that support the whole application.
- Native/Platform-Specific Layers:
- Platform modules (android, ios, macos, windows, linux, web) which serve as entry points and integrations for native functionalities. These typically house the native project configurations (AndroidManifest, Info.plist, Build files) which are wrapped by Flutter’s engine.

##### Relationships and Interactions
- From UI (screens/widgets) to business logic (controllers/state managers) when handling user actions.
- From business logic to data services/repositories for data retrieval and synchronization.
- From the data layer back to the UI as the state is updated.
- Native integration layer which bridges the Flutter engine to platform-specific functionality (for example, the Android and iOS project components).

##### Architectural Patterns & Design Principles
- Separation-of-concerns:
- UI components and screens are separated from controllers and business logic.
- Data management is handled in independent service classes and repositories.
- Modular Design:
- Different features (authentication, shop, etc.) are organized in separate directories, making the system easily extendable.
- Reusability:
- Common widgets and utilities are abstracted in the lib/common and lib/utlis directories.
- Additionally, any available Flutter state management approach (like Provider, Bloc, or GetX) can be annotated if used, although it is not explicitly detailed in this file tree.

##### Relevant Technologies & Frameworks
- Flutter Framework for UI.
- Dart language for application logic.
- Platform-specific component integration through native projects (Android, iOS, etc.).
- CMake is used for building desktop components (in directories like linux, windows, macos).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer (Flutter UI)"
        P_main("main.dart"):::frontend
        P_nav("navigation_menu.dart"):::frontend
        P_features("Features (Authentication & Shop)"):::frontend
        P_common("Common Widgets & Styles"):::frontend
    end

    subgraph "Business Logic / Controllers"
        BL_onboarding("Onboarding Controller"):::controller
    end

    subgraph "Data Layer (Repositories & Services)"
        DL_data("Data Services & Repositories"):::data
        DL_storage("Local Storage"):::data
        DL_api("API Constants"):::data
    end

    subgraph "Utilities & Themes"
        UT_theme("Theme Utilities"):::utility
        UT_validation("Validation"):::utility
        UT_helpers("Helpers & Pricing"):::utility
        UT_device("Device Utilities"):::utility
        UT_formatters("Formatters"):::utility
        UT_logger("Logging"):::utility
    end

    subgraph "Native / Platform-Specific Integration"
        NI_android("Android Native"):::native
        NI_ios("iOS Native"):::native
        NI_linux("Linux Desktop"):::native
        NI_macos("macOS Desktop"):::native
        NI_windows("Windows Desktop"):::native
        NI_web("Web Integration"):::native
    end

    P_main -->|"init"| P_nav
    P_main -->|"navigatesTo"| P_features
    P_features -->|"triggers"| BL_onboarding
    BL_onboarding -->|"fetchesData"| DL_data
    BL_onboarding -->|"updatesLocalStorage"| DL_storage
    DL_api -->|"definesConstants"| DL_data
    DL_data -->|"returnsData"| BL_onboarding
    BL_onboarding -->|"updatesUI"| P_common
    P_common -->|"usesTheme"| UT_theme
    P_common -->|"validatesInputs"| UT_validation
    P_common -->|"formatsData"| UT_formatters
    P_common -->|"logsEvents"| UT_logger
    P_features -->|"utilizesHelpers"| UT_helpers
    P_features -->|"detectsDevice"| UT_device
    P_main -->|"integratesNative"| NI_android
    P_main -->|"integratesNative"| NI_ios
    P_main -->|"integratesNative"| NI_linux
    P_main -->|"integratesNative"| NI_macos
    P_main -->|"integratesNative"| NI_windows
    P_main -->|"integratesNative"| NI_web

    click P_main "https://github.com/duongwthuj/e-commerce-app/blob/main/lib/main.dart"
    click P_nav "https://github.com/duongwthuj/e-commerce-app/blob/main/lib/navigation_menu.dart"
    click P_features "https://github.com/duongwthuj/e-commerce-app/tree/main/lib/features"
    click P_common "https://github.com/duongwthuj/e-commerce-app/tree/main/lib/common"
    click BL_onboarding "https://github.com/duongwthuj/e-commerce-app/blob/main/lib/features/authentication/controllers_onboarding/onboarding_controller.dart"
    click DL_data "https://github.com/duongwthuj/e-commerce-app/tree/main/lib/data"
    click DL_storage "https://github.com/duongwthuj/e-commerce-app/blob/main/lib/utlis/local_storage/storage_utility.dart"
    click DL_api "https://github.com/duongwthuj/e-commerce-app/blob/main/lib/utlis/constants/api_constants.dart"
    click UT_theme "https://github.com/duongwthuj/e-commerce-app/tree/main/lib/utlis/theme"
    click UT_validation "https://github.com/duongwthuj/e-commerce-app/blob/main/lib/utlis/validators/validation.dart"
    click UT_helpers "https://github.com/duongwthuj/e-commerce-app/tree/main/lib/utlis/helpers"
    click UT_device "https://github.com/duongwthuj/e-commerce-app/blob/main/lib/utlis/device/device_utility.dart"
    click UT_formatters "https://github.com/duongwthuj/e-commerce-app/blob/main/lib/utlis/formatters/formatters.dart"
    click UT_logger "https://github.com/duongwthuj/e-commerce-app/blob/main/lib/utlis/logging/logger.dart"
    click NI_android "https://github.com/duongwthuj/e-commerce-app/tree/main/android"
    click NI_ios "https://github.com/duongwthuj/e-commerce-app/tree/main/ios"
    click NI_linux "https://github.com/duongwthuj/e-commerce-app/tree/main/linux"
    click NI_macos "https://github.com/duongwthuj/e-commerce-app/tree/main/macos"
    click NI_windows "https://github.com/duongwthuj/e-commerce-app/tree/main/windows"
    click NI_web "https://github.com/duongwthuj/e-commerce-app/tree/main/web"

    classDef frontend fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef controller fill:#A9DFBF,stroke:#196F3D,stroke-width:2px;
    classDef data fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef utility fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef native fill:#D7BDE2,stroke:#6C3483,stroke-width:2px;
```
