# abdullahgenc/shopping-app architecture

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

- Interactive diagram: https://gitdiagram.com/abdullahgenc/shopping-app
- Repository: https://github.com/abdullahgenc/shopping-app

## Overview

##### Project Type & Purpose
- It’s a native iOS application focused on shopping functionality – allowing users to explore products, authenticate (sign in/sign up), view product details, search, manage their basket, and view profiles.
- Key features like onboarding, product listings (fetched via a FakeStore API), and multi-screen navigation are highlighted. The README also lists 3rd party tools (e.g., SnapKit, Firebase Auth/Firestore, Moya, IQKeyboardManager, KingFisher) which integrate into various layers.

##### Key Components
a. App Lifecycle & System Entry:
- AppDelegate and SceneDelegate (inside the App/Delegates folder). These are the entry points and manage the application lifecycle.

b. Core Infrastructure:
- Constants/Configurations (e.g., UserDefaultConstants)
- Extensions (for Encodable, UIButton, etc.)
- Helper utilities (like AlertPresentable)
- Network layer: The FakeStore API is used to simulate product data fetching.
- SAKit components which include custom views (SAView, SAViewController, SATextView, etc.)

c. Screens / Feature Modules:
- Auth Module:
- Authentication Controllers (e.g., AuthViewController) and associated ViewModels & views (for sign in/sign up).
- Onboarding Module:
- Onboarding screens with both XIB/storyboard and programmatic views.
- Main Tab Bar Module:
- Contains submodules for Products, Basket, Profile, and Search.
- For example, the Products module has its Controller (ProductsViewController), Views (DetailView, ProductsCollectionViewCell), Model (Product.swift), and the corresponding ViewModel.
- Each module follows the MVVM structure: the Controller (UI layer) communicates with its ViewModel, which in turn interacts with the Core (networking, data layer) when needed.

d. UI & Presentation:
- That some screens use Storyboard (initial and auth screens) while others are built programmatically.
- Use of customized UI components from SAKit and external libraries (e.g., SnapKit for constraints, KingFisher for image loading).

e. External Services & Libraries:
- How these external services integrate with the internal network layer (e.g., in the Core/Network folder) or UI adjustments.

##### Relationships & Data Flow
- The AppDelegate launches the initial onboarding/auth flow.
- Upon successful authentication, navigation shifts to the MainTabBar where each tab corresponds to a feature module.
- Within each module, controllers interact with their view models using delegate patterns and closures.
- ViewModels interact with the network layer (e.g., FakeStore API) to fetch data which is then presented by the controllers.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Lifecycle
    subgraph "Application Lifecycle"
        A1["AppDelegate & SceneDelegate"]:::entry
    end

    %% Core Infrastructure
    subgraph "Core Infrastructure"
        C1["Constants & Configurations"]:::core
        C2["Extensions"]:::core
        C3["Helpers"]:::core
        C4["Networking (FakeStore API)"]:::core
        C5["SAKit (Custom UI Components)"]:::core
    end

    %% Feature Modules
    subgraph "Feature Modules"
        %% Authentication Module
        subgraph "Authentication Module"
            A2["Auth Controller"]:::ui
            A3["Auth ViewModel"]:::vm
            A4["Auth View & XIBs"]:::ui
            A5["Auth Model"]:::model
        end

        %% Onboarding Module
        subgraph "Onboarding Module"
            O1["Onboarding Controller"]:::ui
            O2["Onboarding View/XIB"]:::ui
        end

        %% Main Tab Bar Module with Submodules
        subgraph "Main Tab Bar Module"
            M1["MainTabBar Controller"]:::ui
            %% Products Module
            subgraph "Products Module"
                P1["Products Controller"]:::ui
                P2["Products ViewModel"]:::vm
                P3["Products Views"]:::ui
                P4["Products Model"]:::model
            end
            %% Basket Module
            subgraph "Basket Module"
                B1["Basket Controller"]:::ui
                B2["Basket ViewModel"]:::vm
                B3["Basket Views"]:::ui
            end
            %% Profile Module
            subgraph "Profile Module"
                PR1["Profile Controller"]:::ui
                PR2["Profile ViewModel"]:::vm
                PR3["Profile Views"]:::ui
            end
            %% Search Module
            subgraph "Search Module"
                S1["Search Controller"]:::ui
                S2["Search ViewModel"]:::vm
                S3["Search Views"]:::ui
            end
        end
    end

    %% UI & Plist Configuration / External Services
    subgraph "UI & Plist Config"
        U1["Initial Storyboard"]:::ui
        U2["LaunchScreen Storyboard"]:::ui
        F1["Firebase Config"]:::external
    end

    %% Relationships & Data Flow
    %% Application Launch Flow
    A1 -->|"launches"| U1
    U1 -->|"triggersOnboarding"| O1
    U1 -->|"triggersAuth"| A2
    O1 -->|"afterOnboarding"| A2
    A2 -->|"bindsTo"| A3
    A3 -->|"fetchesData"| C4

    %% Feature Modules Interaction
    M1 -->|"navigatesTo"| P1
    M1 -->|"navigatesTo"| B1
    M1 -->|"navigatesTo"| PR1
    M1 -->|"navigatesTo"| S1

    %% MVVM Bindings in Modules
    P1 -->|"bindsTo"| P2
    P2 -->|"fetchesProducts"| C4
    B1 -->|"bindsTo"| B2
    PR1 -->|"bindsTo"| PR2
    S1 -->|"bindsTo"| S2

    %% UI Components using Core Infrastructure
    A2 -->|"uses"| C5
    O1 -->|"uses"| C5
    P1 -->|"uses"| C5
    B1 -->|"uses"| C5
    PR1 -->|"uses"| C5
    S1 -->|"uses"| C5

    %% Common Core utility usage
    A2 -->|"utilizes"| C1
    A2 -->|"utilizes"| C2
    A2 -->|"utilizes"| C3

    %% External Services Integration
    C4 -->|"integratesWith"| F1

    %% Click Events
    click A1 "https://github.com/abdullahgenc/shopping-app/tree/main/ShoppingApp/ShoppingApp/App/Delegates"
    click C1 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/App/Core/Constants/UserDefaultConstants.swift"
    click C2 "https://github.com/abdullahgenc/shopping-app/tree/main/ShoppingApp/ShoppingApp/App/Core/Extensions"
    click C3 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/App/Core/Helpers/AlertPresentable.swift"
    click C4 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/App/Core/Network/FakeStoreAPI.swift"
    click C5 "https://github.com/abdullahgenc/shopping-app/tree/main/ShoppingApp/ShoppingApp/App/Core/SAKit"
    click A2 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/Auth/Controller/AuthViewController.swift"
    click A3 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/Auth/ViewModel/AuthViewModel.swift"
    click A5 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/Auth/Model/User.swift"
    click A4 "https://github.com/abdullahgenc/shopping-app/tree/main/ShoppingApp/ShoppingApp/Screens/Auth/View"
    click O1 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/Onboarding/Controller/OnboardingViewController.swift"
    click O2 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/Onboarding/View/OnboardingView.xib"
    click M1 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/MainTabBar/MainTabBarController.swift"
    click P1 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/MainTabBar/Products/Controller/ProductsViewController.swift"
    click P2 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/MainTabBar/Products/ViewModel/ProductsViewModel.swift"
    click P4 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/MainTabBar/Products/Model/Product.swift"
    click P3 "https://github.com/abdullahgenc/shopping-app/tree/main/ShoppingApp/ShoppingApp/Screens/MainTabBar/Products/View"
    click B1 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/MainTabBar/Basket/Controller/BasketViewController.swift"
    click B2 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/MainTabBar/Basket/ViewModel/BasketViewModel.swift"
    click B3 "https://github.com/abdullahgenc/shopping-app/tree/main/ShoppingApp/ShoppingApp/Screens/MainTabBar/Basket/View"
    click PR1 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/MainTabBar/Profile/Controller/ProfileViewController.swift"
    click PR2 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/MainTabBar/Profile/ViewModel/ProfileViewModel.swift"
    click PR3 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/MainTabBar/Profile/View/ProfileView.swift"
    click S1 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/MainTabBar/Search/Controller/SearchViewController.swift"
    click S2 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/MainTabBar/Search/ViewModel/SearchViewModel.swift"
    click S3 "https://github.com/abdullahgenc/shopping-app/tree/main/ShoppingApp/ShoppingApp/Screens/MainTabBar/Search/View"
    click U1 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/Screens/Initial/Base.lproj/Main.storyboard"
    click U2 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/App/View/Base.lproj/LaunchScreen.storyboard"
    click F1 "https://github.com/abdullahgenc/shopping-app/blob/main/ShoppingApp/ShoppingApp/App/Plists/GoogleService-Info.plist"

    %% Styles
    classDef entry fill:#f9e79f,stroke:#D35400,stroke-width:2px;
    classDef core fill:#aed6f1,stroke:#1F618D,stroke-width:2px;
    classDef ui fill:#abebc6,stroke:#229954,stroke-width:2px;
    classDef vm fill:#f9c4d9,stroke:#C0392B,stroke-width:2px;
    classDef model fill:#fef9e7,stroke:#B7950B,stroke-width:2px;
    classDef external fill:#fadbd8,stroke:#922B21,stroke-width:2px;
```
