# sashourav/flutter-e-commerce architecture

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

- Interactive diagram: https://gitdiagram.com/sashourav/flutter-e-commerce
- Repository: https://github.com/sashourav/flutter-e-commerce

## Overview

##### Project type and purpose
- This is a cross-platform mobile e-commerce app (“t_store”) built in Flutter, targeting Android and iOS.
- The app provides user onboarding, authentication, personalized settings, shopping, and wishlist features.

##### File structure and architecture patterns
- Top-level platform folders:
- android/ – Native Android shell and configuration
- ios/     – Native iOS shell and configuration
- web/     – PWA/web stub (index.html, manifest.json)
- Dart code under lib/:
- lib/app.dart & lib/main.dart – Application entry point, root widget initialization
- lib/navigation_menu.dart – Central navigation/routing
- lib/common/ – Reusable widgets, styles, themes
- lib/features/ – Feature modules: authentication, personalization, shop
- lib/utils/ – Services and helpers: HTTP client, local storage, logging, formatting, exceptions, validators, theme configurations
- Testing under test/: widget/unit tests

Architectural choices:
- Feature-based modularization: each major feature in its own folder with controllers and screens
- Layered separation:
– Presentation (screens, widgets)
– Controllers (business logic/state management)
– Data/services (HTTP client, local storage, cloud helper functions)
- Utility layers for cross-cutting concerns (logging, theming, validation)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Native Hosts
    subgraph "Native Shells"
        direction TB
        AND["Android Host"]:::external
        AND -->|"Platform Channels"| FL_Engine
        IOS["iOS Host"]:::external
        IOS -->|"Platform Channels"| FL_Engine
    end

    %% Flutter Engine
    FL_Engine["Flutter Engine"]

    %% Flutter Mobile App
    subgraph "Flutter Mobile App"
        direction TB
        %% Entry Points
        MainEntry["lib/main.dart\nApplication Entry"]:::presentation
        AppEntry["lib/app.dart\nRoot Widget"]:::presentation

        %% Navigation
        NavRouter["lib/navigation_menu.dart\nRouter"]:::presentation

        %% Presentation Layer
        subgraph "Presentation Layer" 
            direction TB
            CommonWidgets["Common Widgets"]:::presentation
            AuthScreens["Authentication Screens"]:::presentation
            PersScreens["Personalization Screens"]:::presentation
            ShopScreens["Shop Screens"]:::presentation
        end

        %% Controllers Layer
        subgraph "Controllers Layer"
            direction TB
            OnboardingCtrl["OnboardingController"]:::business
            HomeCtrl["HomeController"]:::business
        end

        %% Data Layer
        subgraph "Data Layer"
            direction TB
            HttpClient["HTTP Client"]:::data
            StorageUtility["Local Storage Utility"]:::data
            CloudHelpers["Cloud Helper Functions"]:::data
        end

        %% Utility Layer
        subgraph "Utility Layer"
            direction TB
            Logger["Logger"]:::utility
            Validation["Validation"]:::utility
            Formatter["Formatter"]:::utility
            ThemeConfig["Theme Config"]:::utility
            WidgetThemes["Widget Themes"]:::utility
            FirebaseAuthEx["Firebase Auth Exceptions"]:::utility
            PlatformEx["Platform Exceptions"]:::utility
        end

        %% Connections inside app
        MainEntry --> AppEntry
        AppEntry --> NavRouter
        NavRouter --> CommonWidgets
        CommonWidgets --> AuthScreens
        CommonWidgets --> PersScreens
        CommonWidgets --> ShopScreens

        AuthScreens --> OnboardingCtrl
        ShopScreens --> HomeCtrl

        OnboardingCtrl --> HttpClient
        HomeCtrl --> HttpClient

        OnboardingCtrl --> StorageUtility
        HomeCtrl --> StorageUtility

        OnboardingCtrl --> CloudHelpers
        HomeCtrl --> CloudHelpers

        OnboardingCtrl --> Logger
        HomeCtrl --> Logger

        OnboardingCtrl --> Validation
        HomeCtrl --> Validation

        OnboardingCtrl --> Formatter
        HomeCtrl --> Formatter

        OnboardingCtrl --> ThemeConfig
        OnboardingCtrl --> WidgetThemes

        OnboardingCtrl --> FirebaseAuthEx
        OnboardingCtrl --> PlatformEx
    end

    %% External Services & Storage
    subgraph "External Services"
        direction TB
        RESTAPI["External REST API"]:::external
        FirebaseService["Firebase Auth Service"]:::external
    end

    %% Local Storage
    StorageUtility --> LocalStorage["Device Storage"]:::external
    HttpClient -->|"/api calls"| RESTAPI
    CloudHelpers --> FirebaseService

    %% User Interaction
    User["User"]:::external
    User -->|taps UI| CommonWidgets

    %% Flutter Engine Connection
    FL_Engine -->|"renders UI"| AppEntry

    %% Assets & Resources
    subgraph "Assets & Resources"
        direction TB
        Fonts["assets/fonts"]:::assets
        Icons["assets/icons"]:::assets
        Images["assets/images"]:::assets
        WebStub["web/index.html\nweb/manifest.json"]:::assets
    end

    %% Class Definitions
    classDef presentation fill:#cce5ff,stroke:#004085;
    classDef business fill:#d4edda,stroke:#155724;
    classDef data fill:#fff3cd,stroke:#856404;
    classDef utility fill:#e2e3e5,stroke:#6c757d;
    classDef external fill:#f8d7da,stroke:#721c24;
    classDef assets fill:#f0f0f0,stroke:#333333;

    %% Click Events
    click MainEntry "https://github.com/sashourav/flutter-e-commerce/blob/main/lib/main.dart"
    click AppEntry "https://github.com/sashourav/flutter-e-commerce/blob/main/lib/app.dart"
    click NavRouter "https://github.com/sashourav/flutter-e-commerce/blob/main/lib/navigation_menu.dart"
    click CommonWidgets "https://github.com/sashourav/flutter-e-commerce/tree/main/lib/common/widgets"
    click AuthScreens "https://github.com/sashourav/flutter-e-commerce/tree/main/lib/features/authentication/screens"
    click PersScreens "https://github.com/sashourav/flutter-e-commerce/tree/main/lib/features/personalization/screens"
    click ShopScreens "https://github.com/sashourav/flutter-e-commerce/tree/main/lib/features/shop/screens"
    click OnboardingCtrl "https://github.com/sashourav/flutter-e-commerce/blob/main/lib/features/authentication/controllers/onboarding_controller.dart"
    click HomeCtrl "https://github.com/sashourav/flutter-e-commerce/blob/main/lib/features/shop/controllers/home_controller.dart"
    click HttpClient "https://github.com/sashourav/flutter-e-commerce/blob/main/lib/utils/http/http_client.dart"
    click StorageUtility "https://github.com/sashourav/flutter-e-commerce/blob/main/lib/utils/local_storage/storage_utility.dart"
    click CloudHelpers "https://github.com/sashourav/flutter-e-commerce/blob/main/lib/utils/helpers/cloud_helper_functions.dart"
    click Logger "https://github.com/sashourav/flutter-e-commerce/blob/main/lib/utils/logging/logger.dart"
    click Validation "https://github.com/sashourav/flutter-e-commerce/blob/main/lib/utils/validators/validation.dart"
    click Formatter "https://github.com/sashourav/flutter-e-commerce/blob/main/lib/utils/formatters/formatter.dart"
    click ThemeConfig "https://github.com/sashourav/flutter-e-commerce/blob/main/lib/utils/theme/theme.dart"
    click WidgetThemes "https://github.com/sashourav/flutter-e-commerce/tree/main/lib/utils/theme/widget_themes"
    click FirebaseAuthEx "https://github.com/sashourav/flutter-e-commerce/blob/main/lib/utils/exceptions/firebase_auth_exceptions.dart"
    click PlatformEx "https://github.com/sashourav/flutter-e-commerce/blob/main/lib/utils/exceptions/platform_exceptions.dart"
    click AND "https://github.com/sashourav/flutter-e-commerce/blob/main/android/app/src/main/kotlin/com/example/t_store/MainActivity.kt"
    click AND "https://github.com/sashourav/flutter-e-commerce/blob/main/android/app/build.gradle.kts"
    click IOS "https://github.com/sashourav/flutter-e-commerce/blob/main/ios/Runner/AppDelegate.swift"
    click IOS "https://github.com/sashourav/flutter-e-commerce/blob/main/ios/Runner.xcodeproj"
    click Fonts "https://github.com/sashourav/flutter-e-commerce/tree/main/assets/fonts"
    click Icons "https://github.com/sashourav/flutter-e-commerce/tree/main/assets/icons"
    click Images "https://github.com/sashourav/flutter-e-commerce/tree/main/assets/images"
    click WebStub "https://github.com/sashourav/flutter-e-commerce/blob/main/web/index.html"
```
