# fiazjutt/planetsbrand architecture

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

- Interactive diagram: https://gitdiagram.com/fiazjutt/planetsbrand
- Repository: https://github.com/fiazjutt/planetsbrand

## Overview

##### Project type and purpose
- This is a cross-platform Flutter front-end application (“planetbrand”) targeting mobile (Android, iOS), web, desktop (macOS, Linux, Windows).
- It integrates a custom Dart plugin (bank_alfalah_payment-main) for handling payments, uses Firebase, and consumes remote REST APIs for product/catalog data, user accounts, cart, orders, etc.

##### File structure
- Top-level “android”, “ios”, “web”, “linux”, “macos”, “windows”: platform embedder code, native configuration.
- “lib/”: the core Flutter code:
- components/: reusable widgets (buttons, text fields, loaders, sheets)
- pages/: feature modules (landing, auth, home, category, brands, cart, account, search, product_details, favorites, festivals, shop, other) each with UI screens, controllers, models
- firebase_options.dart: Firebase initialization
- main.dart: application entry point
- bank_alfalah_payment-main/: a packaged plugin with src/models, src/services (hash, payment), src/ui (payment screen), src/utils
- Configuration: pubspec.yaml, analysis_options.yaml, firebase.json, platform build files

##### Relationships and interactions
- User taps UI widget → Controller method
- Controller invokes Service (e.g., ApiHelper, PaymentService)
- Service → REST API / Payment gateway / Firebase → returns Model
- Controller updates state → UI rebuilt with new Model data
- Local storage used for caching tokens, preferences
- Plugin interacts with WebView or native SDKs for payments

##### Architectural patterns & design principles
- MVVM/DC (Widgets = View, Controllers = ViewModel/Presenter, Models = Data)
- Layered architecture: clear separation of concerns
- Modular structure: pages organized by feature, reusable components library
- Plugin/Package isolation: bank_alfalah_payment is a self-contained module

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Platform Runners"
        Android["Android"]:::platform
        iOS["iOS"]:::platform
        Web["Web"]:::platform
        Linux["Linux"]:::platform
        macOS["macOS"]:::platform
        Windows["Windows"]:::platform
    end

    Android --> FlutterEngine
    iOS --> FlutterEngine
    Web --> FlutterEngine
    Linux --> FlutterEngine
    macOS --> FlutterEngine
    Windows --> FlutterEngine

    FlutterEngine["Flutter Engine & Dart VM"]:::core

    subgraph "Within Engine"
        subgraph "Presentation Layer"
            Entry["App Entry\nlib/main.dart"]:::core
            UIWidgets["UI Widgets\nlib/components/"]:::ui
            FeaturePages["Feature Pages\nlib/pages/"]:::ui
        end

        subgraph "Controller Layer"
            Controllers["Controllers\nlib/pages/**/controller/*.dart"]:::controller
        end

        subgraph "Data & Model Layer"
            Models["Data Models\nlib/pages/**/model/*.dart"]:::model
            LocalStorage["Local Storage\nlib/utils/local_storage.dart"]:::model
        end

        subgraph "Services & Plugin Layer"
            APIService["API Helper\nlib/utils/api_helper.dart"]:::service
            PaymentPluginCore["Bank Alfalah Plugin Core\nbank_alfalah_payment-main/lib/bank_alfalah_payment.dart"]:::service
            PluginServices["Plugin Services\nbank_alfalah_payment-main/lib/src/services/*.dart"]:::service
        end
    end

    Entry --> UIWidgets
    Entry --> FeaturePages
    UIWidgets --> Controllers
    FeaturePages --> Controllers
    Controllers --> Models
    Controllers --> LocalStorage
    Controllers --> APIService
    Controllers --> PaymentPluginCore
    APIService --> ExternalREST
    PaymentPluginCore --> PaymentGateway
    APIService --> Firebase
    Firebase --> APIService
    ExternalREST --> APIService
    PaymentGateway --> PaymentPluginCore
    Models --> Controllers
    LocalStorage --> Controllers

    subgraph "External Systems"
        ExternalREST["REST API Backend"]:::external
        PaymentGateway["Payment Gateway"]:::external
        Firebase["Firebase\nlib/firebase_options.dart\nfirebase.json"]:::external
    end

    click Android "https://github.com/fiazjutt/planetsbrand/tree/master/android/"
    click iOS "https://github.com/fiazjutt/planetsbrand/tree/master/ios/"
    click Web "https://github.com/fiazjutt/planetsbrand/tree/master/web/"
    click Linux "https://github.com/fiazjutt/planetsbrand/tree/master/linux/"
    click macOS "https://github.com/fiazjutt/planetsbrand/tree/master/macos/"
    click Windows "https://github.com/fiazjutt/planetsbrand/tree/master/windows/"
    click Entry "https://github.com/fiazjutt/planetsbrand/blob/master/lib/main.dart"
    click UIWidgets "https://github.com/fiazjutt/planetsbrand/tree/master/lib/components/"
    click FeaturePages "https://github.com/fiazjutt/planetsbrand/tree/master/lib/pages/"
    click Controllers "https://github.com/fiazjutt/planetsbrand/blob/master/lib/pages/**/controller/*.dart"
    click Models "https://github.com/fiazjutt/planetsbrand/blob/master/lib/pages/**/model/*.dart"
    click APIService "https://github.com/fiazjutt/planetsbrand/blob/master/lib/utils/api_helper.dart"
    click LocalStorage "https://github.com/fiazjutt/planetsbrand/blob/master/lib/utils/local_storage.dart"
    click Firebase "https://github.com/fiazjutt/planetsbrand/blob/master/lib/firebase_options.dart"
    click PaymentPluginCore "https://github.com/fiazjutt/planetsbrand/blob/master/bank_alfalah_payment-main/lib/bank_alfalah_payment.dart"
    click PluginServices "https://github.com/fiazjutt/planetsbrand/blob/master/bank_alfalah_payment-main/lib/src/services/hash_service.dart"
    click PluginServices "https://github.com/fiazjutt/planetsbrand/blob/master/bank_alfalah_payment-main/lib/src/services/payment_service.dart"

    classDef platform fill:#F0F0F0,stroke:#333,stroke-width:1px
    classDef core fill:#D1C4E9,stroke:#333,stroke-width:1px
    classDef ui fill:#D0E8FF,stroke:#333,stroke-width:1px
    classDef controller fill:#D8F5D8,stroke:#333,stroke-width:1px
    classDef model fill:#FFE0B2,stroke:#333,stroke-width:1px
    classDef service fill:#FFF3C4,stroke:#333,stroke-width:1px
    classDef external fill:#E0E0E0,stroke:#333,stroke-width:1px
```
