# slightfoot/wow_shopping architecture

> Architecture diagram of the GitHub repository slightfoot/wow_shopping, 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/slightfoot/wow_shopping
- Repository: https://github.com/slightfoot/wow_shopping

## Overview

##### Main Components
- Mobile Application Frontend:
- The “app” directory contains a complete Flutter project with its “lib/app” code and feature modules (e.g., Account, Cart, Home, Login, Wishlist, Product Details, etc.).
- Separate modules are used to build various pages and UI widgets, along with dedicated backend service calls (inside app/lib/backend) that handle API interactions.
- There are two entry points (main_dev.dart, main_prod.dart) to support different environments.
- Backend Server:
- The “server” directory holds the backend application written in Dart. It includes API endpoints for authentication, products, and other services.
- The server uses middleware for exception handling (exception_middleware.dart) and has dedicated API segments (e.g., auth, products) to process mobile client requests.
- There are distinct entry points (main_dev.dart, main_prod.dart) in the server's “bin” directory.
- Shared/Common Library:
- The “common” folder contains shared code—API models, request/response DTOs, and possibly utility functions—that both the mobile app and server can use, ensuring consistency in data definitions.

##### Relationships and Interactions
- The “common” module acts as a shared dependency. Represent this with a central component that both the mobile app and server link to for data models and API requests/responses.
- In the mobile client, components such as the “features” modules call methods in “backend” services to obtain data (e.g., product listings, authentication results). Represent these internal flows by grouping them under “Frontend – Presentation Layer”, “Business Logic”, and “API Service”.
- The server’s API endpoints and middleware (for authentication, exception handling, etc.) should also display how they process incoming requests and send responses back to the client.

##### Architectural Patterns and Design Principles
- The project follows a modular pattern – with a clear separation of concerns between feature UI components, business logic (using repository classes), and API services.
- The mobile code uses a widget-based UI and likely an MV* or BLoC-like pattern (even if not explicit, best practices are often followed in Flutter projects).
- The server code illustrates a layered architecture using middleware for cross-cutting concerns (authentication, exception-handing, etc.).
- Environmental configurations (development vs. production) for both the mobile app and server components.

##### Relevant Technologies
- Flutter framework for cross-platform mobile development.
- Dart language for both mobile and backend (server and common modules).
- Gradle and Xcode configuration files indicate that the application is built to run on Android and iOS respectively.
- Docker support in the “server” folder (Dockerfile) for containerized deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Mobile App Subgraph
    subgraph "Mobile App"
        UIFeatures["UI/Features Modules\n(Account, Home, Cart, Login, Wishlist, Product Details)"]:::frontend
        BLS["Business Logic/API Service Layer"]:::frontend
        MobileDev["Mobile Entry Point Dev\n(main_dev.dart)"]:::frontend
        MobileProd["Mobile Entry Point Prod\n(main_prod.dart)"]:::frontend
        UIFeatures -->|"calls"| BLS
        BLS -->|"initialized_by"| MobileDev
        BLS -->|"initialized_by"| MobileProd
    end

    %% Backend Server Subgraph
    subgraph "Backend Server"
        BackendAPI["API Endpoints\n(Auth, Products)"]:::backend
        Middleware["Middleware\n(Exception Handling, Auth)"]:::backend
        ServerDev["Server Entry Point Dev\n(main_dev.dart)"]:::backend
        ServerProd["Server Entry Point Prod\n(main_prod.dart)"]:::backend
        BackendAPI -->|"processes_via"| Middleware
        Middleware -->|"supports"| BackendAPI
        BackendAPI -->|"bootstraps"| ServerDev
        BackendAPI -->|"bootstraps"| ServerProd
    end

    %% Shared/Common Library Subgraph
    subgraph "Shared/Common Library"
        Common["Shared API Models & DTOs"]:::common
    end

    %% Inter-component Relationships
    BLS -->|"API_call"| BackendAPI
    BLS -->|"uses_shared"| Common
    BackendAPI -->|"uses_shared"| Common

    %% Click Events for Mobile App Components
    click UIFeatures "https://github.com/slightfoot/wow_shopping/tree/main/app/lib/features"
    click BLS "https://github.com/slightfoot/wow_shopping/tree/main/app/lib/backend"
    click MobileDev "https://github.com/slightfoot/wow_shopping/blob/main/app/lib/main_dev.dart"
    click MobileProd "https://github.com/slightfoot/wow_shopping/blob/main/app/lib/main_prod.dart"

    %% Click Events for Backend Server Components
    click BackendAPI "https://github.com/slightfoot/wow_shopping/tree/main/server/lib/api"
    click Middleware "https://github.com/slightfoot/wow_shopping/blob/main/server/lib/api/exception_middleware.dart"
    click ServerDev "https://github.com/slightfoot/wow_shopping/blob/main/server/bin/main_dev.dart"
    click ServerProd "https://github.com/slightfoot/wow_shopping/blob/main/server/bin/main_prod.dart"

    %% Click Event for Shared/Common Library Component
    click Common "https://github.com/slightfoot/wow_shopping/tree/main/common/lib"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef common fill:#FFD700,stroke:#000,stroke-width:2px;
```
