# t007rushi/gamekart-ecom architecture

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

- Interactive diagram: https://gitdiagram.com/t007rushi/gamekart-ecom
- Repository: https://github.com/t007rushi/gamekart-ecom

## Overview

##### Main System Components

a) Frontend Layer:
- React Application (Client-Side)
- Context Providers
- Component Structure
- Routing System

b) Backend Layer:
- Mockbee (Mock Backend)
- Controllers
- Database Collections
- Authentication System

##### Detailed Component Breakdown

Frontend Components:
- AuthContext
- CartContext
- FilterContext
- ProductsContext
- WishlistContext

- Authentication Components
- Product Management
- Cart Management
- Wishlist Management
- Filter/Sort Components

Backend Structure:
- Controllers section:
- AuthController
- CartController
- CategoryController
- ProductController
- WishlistController

- Database Collections:
- Users
- Products
- Categories

##### Interaction Flows

- User authentication flow
- Product browsing and filtering
- Cart operations
- Wishlist management
- API calls between frontend and backend

##### Specific Implementation Details

- React Router v6 routing system
- Context API state management
- Local storage integration
- Mockbee backend integration
- Authentication flow
- Cart and wishlist operations

##### Technical Stack Representation

A section showing:
- React ecosystem
- Spectre component library
- Axios for API calls
- Local storage
- Mock backend services

**[User Interface Layer]**
- ↓ ↑
**[Context Providers Layer]**
- ↓ ↑
**[Components Layer]**
- ↓ ↑
**[Services Layer]**
- ↓ ↑
**[Mock Backend Layer]**
- ↓ ↑
**[Data Storage Layer]**

Key Considerations:
##### Integration points with external services

Remember to maintain a balance between detail and clarity, focusing on the architectural decisions that make this e-commerce platform unique, such as the context-based state management and mock backend integration.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "User Interface"
        UI[User Interface]
        App["App Component"]:::frontend
        click App "https://github.com/t007rushi/GameKart-Ecom/blob/dev/src/App.js"
    end

    subgraph "Context Layer"
        AuthCtx["Auth Context"]:::context
        CartCtx["Cart Context"]:::context
        FilterCtx["Filter Context"]:::context
        ProductsCtx["Products Context"]:::context
        WishlistCtx["Wishlist Context"]:::context

        click AuthCtx "https://github.com/t007rushi/GameKart-Ecom/blob/dev/src/Context/auth-context.js"
        click CartCtx "https://github.com/t007rushi/GameKart-Ecom/blob/dev/src/Context/cart-context.js"
        click FilterCtx "https://github.com/t007rushi/GameKart-Ecom/blob/dev/src/Context/filter-context.js"
        click ProductsCtx "https://github.com/t007rushi/GameKart-Ecom/blob/dev/src/Context/products-context.js"
        click WishlistCtx "https://github.com/t007rushi/GameKart-Ecom/blob/dev/src/Context/wishlist-context.js"
    end

    subgraph "Component Layer"
        AuthComp["Authentication Components"]:::frontend
        ProductComp["Product Components"]:::frontend
        CartComp["Cart Components"]:::frontend
        WishlistComp["Wishlist Components"]:::frontend
        FilterComp["Filter Components"]:::frontend
        
        click AuthComp "https://github.com/t007rushi/GameKart-Ecom/tree/dev/src/components/AuthComp"
        click ProductComp "https://github.com/t007rushi/GameKart-Ecom/blob/dev/src/components/Product/Product.jsx"
        click CartComp "https://github.com/t007rushi/GameKart-Ecom/tree/dev/src/components/CartItems"
        click FilterComp "https://github.com/t007rushi/GameKart-Ecom/tree/dev/src/components/FilterNav"
    end

    subgraph "Services Layer"
        AuthService["Auth Service"]:::service
        CartService["Cart Service"]:::service
        WishlistService["Wishlist Service"]:::service
        
        click AuthService "https://github.com/t007rushi/GameKart-Ecom/tree/dev/src/services/Auth"
        click CartService "https://github.com/t007rushi/GameKart-Ecom/tree/dev/src/services/cart-service"
        click WishlistService "https://github.com/t007rushi/GameKart-Ecom/tree/dev/src/services/wishlist"
    end

    subgraph "Backend Controllers"
        AuthController["Auth Controller"]:::controller
        CartController["Cart Controller"]:::controller
        ProductController["Product Controller"]:::controller
        WishlistController["Wishlist Controller"]:::controller
        CategoryController["Category Controller"]:::controller

        click AuthController "https://github.com/t007rushi/GameKart-Ecom/blob/dev/src/backend/controllers/AuthController.js"
        click CartController "https://github.com/t007rushi/GameKart-Ecom/blob/dev/src/backend/controllers/CartController.js"
        click ProductController "https://github.com/t007rushi/GameKart-Ecom/blob/dev/src/backend/controllers/ProductController.js"
        click WishlistController "https://github.com/t007rushi/GameKart-Ecom/blob/dev/src/backend/controllers/WishlistController.js"
    end

    subgraph "Data Storage"
        Users[(Users)]:::database
        Products[(Products)]:::database
        Categories[(Categories)]:::database

        click Users "https://github.com/t007rushi/GameKart-Ecom/blob/dev/src/backend/db/users.js"
        click Products "https://github.com/t007rushi/GameKart-Ecom/blob/dev/src/backend/db/products.js"
        click Categories "https://github.com/t007rushi/GameKart-Ecom/blob/dev/src/backend/db/categories.js"
    end

    UI --> App
    App --> AuthCtx & CartCtx & FilterCtx & ProductsCtx & WishlistCtx

    AuthCtx --> AuthComp
    ProductsCtx --> ProductComp
    CartCtx --> CartComp
    WishlistCtx --> WishlistComp
    FilterCtx --> FilterComp

    AuthComp --> AuthService
    CartComp --> CartService
    WishlistComp --> WishlistService

    AuthService --> AuthController
    CartService --> CartController
    WishlistService --> WishlistController
    ProductComp --> ProductController
    FilterComp --> ProductController

    AuthController --> Users
    CartController --> Products
    ProductController --> Products
    WishlistController --> Products
    CategoryController --> Categories

    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef context fill:#f1c40f,stroke:#f39c12,color:black
    classDef service fill:#2ecc71,stroke:#27ae60,color:white
    classDef controller fill:#9b59b6,stroke:#8e44ad,color:white
    classDef database fill:#e74c3c,stroke:#c0392b,color:white

    %% Legend
    class Legend_Frontend frontend
    class Legend_Context context
    class Legend_Service service
    class Legend_Controller controller
    class Legend_Database database
```
