# golubovicluka/e-commerce architecture

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

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

## Overview

##### Main Components Structure

a) Frontend Layer (Angular Application)
- Divide it into three main sections:
- Core Module
- Feature Modules
- Shared Module

b) External Services Layer
- Hasura GraphQL Server
- Apollo Client (as middleware)
- Local Storage

##### Feature Modules Breakdown
Inside the Feature Modules section, represent these key modules:
- Products Module
- Cart Module
- Home Module
- Wishlist Module
- Main Layout Module

##### Component Relationships

a) Data Flow
- Apollo Client → Hasura GraphQL
- Services → Components
- Components → Local Storage

b) Module Dependencies
- Feature Modules → Shared Module
- Feature Modules → Core Module

##### Specific Implementation Details

- Rectangles: Modules
- Rounded Rectangles: Components
- Hexagons: Services
- Diamonds: Guards/Interceptors

- Blue: Core functionality
- Green: Feature modules
- Yellow: Services
- Gray: External systems
- Orange: Storage solutions

##### Data Flow Patterns

Key flows:
- User Interactions → Components
- Components → Services
- Services → Apollo Client
- Apollo Client → Hasura GraphQL
- Services → Local Storage

##### Important Notes

- Routing structure between components
- Lazy-loaded modules
- Test coverage boundaries
- Integration points with PrimeNG and PrimeFlex

##### Architecture Patterns to Highlight

- Feature-based module organization
- Component-based architecture
- Service layer abstraction
- State management through services
- Local storage persistence
- GraphQL data fetching

Remember to indicate:
- Module boundaries
- Lazy loading points
- Service injection hierarchies
- Data persistence flows
- Testing coverage

This will provide a clear understanding of both the structure and the behavior of the application, making it valuable for both development and documentation purposes.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Frontend Layer"
        AngularApp["Angular Frontend"]
        
        subgraph "Core"
            CoreModule["Core Module"]:::core
            ApolloClient["Apollo Client"]:::core
        end
        
        subgraph "Feature Modules"
            ProductsMod["Products Module"]:::feature
            CartMod["Cart Module"]:::feature
            HomeMod["Home Module"]:::feature
            WishlistMod["Wishlist Module"]:::feature
            MainLayoutMod["Main Layout Module"]:::feature
        end
        
        subgraph "Components"
            ProductView["Product View"]:::component
            ProductDetails["Product Details"]:::component
            CategoriesView["Categories View"]:::component
            CartView["Cart View"]:::component
            CartItem["Cart Item"]:::component
            CartOverview["Cart Overview"]:::component
            CartShipping["Cart Shipping"]:::component
            CartPayment["Cart Payment"]:::component
            HomeView["Home View"]:::component
            WishlistView["Wishlist View"]:::component
        end
        
        subgraph "Shared"
            Header["Header"]:::shared
            Footer["Footer"]:::shared
            NotFound["Not Found"]:::shared
        end
        
        subgraph "Services"
            ProductsService["Products Service"]:::service
            CartService["Cart Service"]:::service
            WishlistService["Wishlist Service"]:::service
        end
        
        subgraph "Testing"
            E2ETests["Cypress E2E Tests"]:::testing
            ProductTests["Product Tests"]:::testing
            HomeTests["Home Tests"]:::testing
        end
    end
    
    subgraph "External Layer"
        HasuraGraphQL["Hasura GraphQL Server"]:::external
        LocalStorage["Local Storage"]:::storage
    end
    
    %% Relationships
    ApolloClient --> HasuraGraphQL
    ProductsService --> ApolloClient
    CartService --> LocalStorage
    WishlistService --> LocalStorage
    
    ProductView --> ProductsService
    CartView --> CartService
    WishlistView --> WishlistService
    
    ProductsMod --> CoreModule
    CartMod --> CoreModule
    HomeMod --> CoreModule
    WishlistMod --> CoreModule
    
    E2ETests --> ProductView
    E2ETests --> HomeView
    
    %% Click Events
    click CoreModule "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/core/core.module.ts"
    click ProductsMod "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/features/products/products.module.ts"
    click HomeMod "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/features/home/home.module.ts"
    click CartView "https://github.com/golubovicluka/e-Commerce/tree/master/src/app/features/cart-view"
    click WishlistView "https://github.com/golubovicluka/e-Commerce/tree/master/src/app/features/wishlist"
    click MainLayoutMod "https://github.com/golubovicluka/e-Commerce/tree/master/src/app/features/main-layout"
    click ProductsService "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/features/products/products.service.ts"
    click CartService "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/shared/cart.service.ts"
    click WishlistService "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/shared/wishlist.service.ts"
    click Header "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/features/main-layout/header/header.component.ts"
    click Footer "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/features/main-layout/footer/footer.component.ts"
    click NotFound "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/shared/not-found/not-found.component.ts"
    click ProductView "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/features/products/products-view.component.ts"
    click ProductDetails "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/features/products/product/product-details/product-details.component.ts"
    click CategoriesView "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/features/products/categories-view/categories-view.component.ts"
    click CartItem "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/features/cart-view/cart-item/cart-item.component.ts"
    click CartOverview "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/features/cart-view/overview/overview.component.ts"
    click CartShipping "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/features/cart-view/shipping/shipping.component.ts"
    click CartPayment "https://github.com/golubovicluka/e-Commerce/blob/master/src/app/features/cart-view/payment/payment.component.ts"
    click E2ETests "https://github.com/golubovicluka/e-Commerce/tree/master/cypress/e2e"
    click ProductTests "https://github.com/golubovicluka/e-Commerce/blob/master/cypress/e2e/products.cy.ts"
    click HomeTests "https://github.com/golubovicluka/e-Commerce/blob/master/cypress/e2e/home.cy.ts"
    
    %% Styling
    classDef core fill:#2196F3,color:white
    classDef feature fill:#4CAF50,color:white
    classDef component fill:#9C27B0,color:white
    classDef shared fill:#FF9800,color:white
    classDef service fill:#FFEB3B,color:black
    classDef testing fill:#795548,color:white
    classDef external fill:#9E9E9E,color:white
    classDef storage fill:#FF5722,color:white
```
