# nahidhassanofficial/groceryshop-ecommerce architecture

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

- Interactive diagram: https://gitdiagram.com/nahidhassanofficial/groceryshop-ecommerce
- Repository: https://github.com/nahidhassanofficial/groceryshop-ecommerce

## Overview

##### Main System Components

A. Client Layer
- Frontend (Vue.js + Inertia.js)
- Public Interface (Home, Products, Categories)
- User Dashboard (Profile, Orders, Wishlist)
- Admin Dashboard (Product/Category Management, Orders)

B. Application Layer
- Backend (Laravel 11)
- Authentication System
- API Controllers
- Business Logic
- Payment Integration

C. Data Layer
- MySQL Database
- Local Storage (for cart)
- File Storage (for images)

##### Key Relationships to Highlight

a) Frontend Architecture:
**[Vue.js Components] → [Inertia.js] → [Laravel Backend]**
- Show separation between public, user, and admin interfaces
- Highlight component hierarchy (Master layouts → Page components)

b) Backend Architecture:
**[HTTP Controllers] → [Models] → [Database]**
- Include middleware layers (Auth, Role-based access)
- Show Helper classes (JWT, SSLCOMMERZ)

c) Authentication Flow:
**[Login/Register] → [JWT Authentication] → [Email OTP Verification]**

d) Payment Processing:
**[Checkout] → [SSLCOMMERZ Integration] → [Transaction Processing]**

##### Specific Implementation Details

a) Frontend Structure:
**Pages/**
- Frontend/ (Public Interface)
- Auth/ (Authentication)
- Backend/ (Admin Panel)
- Profile/ (User Dashboard)

b) Backend Organization:
**app/**
- Http/Controllers/
- Models/
- Helper/
- Mail/

c) Data Flow:
- Product browsing flow
- Cart management (Local Storage ↔ Backend sync)
- Order processing pipeline
- Payment gateway integration

##### Important Connections

Crucial interactions:
- User authentication flow with JWT
- Product management workflow
- Order processing pipeline
- Payment gateway integration
- Email notification system

##### Additional Elements

Supporting components:
- External services (SSLCOMMERZ, Email)
- Storage systems (public/images)
- Caching mechanisms
- Security layers

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Layer"]
        FE["Frontend (Vue.js + Inertia.js)"]:::frontend
        
        subgraph PublicInterface["Public Interface"]
            Home["Home Page"]:::frontend
            Products["Product Page"]:::frontend
            Categories["Category Page"]:::frontend
        end
        
        subgraph UserDash["User Dashboard"]
            ProfileLayout["Profile Layout"]:::frontend
            Orders["Orders"]:::frontend
            Wishlist["Wishlist"]:::frontend
        end
        
        subgraph AdminDash["Admin Dashboard"]
            AdminLayout["Master Layout"]:::frontend
            ProductsMgmt["Products Management"]:::frontend
            CategoriesMgmt["Categories Management"]:::frontend
            OrdersMgmt["Orders Management"]:::frontend
        end
    end

    subgraph AppLayer["Application Layer"]
        Auth["Authentication System"]:::backend
        JWT["JWT Helper"]:::security
        AuthMiddleware["Auth Middleware"]:::security
        
        Controllers["API Controllers"]:::backend
        CartController["Cart Controller"]:::backend
        
        PaymentSystem["Payment Integration"]:::backend
        SSLCommerz["SSLCOMMERZ Helper"]:::backend
        
        EmailSystem["Email System"]:::backend
        OTPMail["OTP Mail"]:::backend
        ResetMail["Password Reset Mail"]:::backend
    end

    subgraph DataLayer["Data Layer"]
        DB[(MySQL Database)]:::database
        LocalStorage[(Local Storage)]:::storage
        
        subgraph FileStorage["File Storage"]
            ProductImages["Product Images"]:::storage
            CategoryImages["Category Images"]:::storage
            UserImages["User Images"]:::storage
        end
        
        Models["Data Models"]:::database
        Migrations["Database Migrations"]:::database
    end

    %% Relationships
    FE --> Auth
    Auth --> JWT
    Auth --> AuthMiddleware
    Auth --> EmailSystem
    EmailSystem --> OTPMail
    EmailSystem --> ResetMail
    Controllers --> Models
    Models --> DB
    PaymentSystem --> SSLCommerz
    CartController --> LocalStorage

    %% Click Events
    click Home "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/blob/main/resources/js/Pages/Frontend/Home.vue"
    click Products "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/blob/main/resources/js/Pages/Frontend/ProductPage.vue"
    click Categories "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/blob/main/resources/js/Pages/Frontend/CategoryPage.vue"
    click ProfileLayout "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/blob/main/resources/js/Pages/Frontend/Profile/Layout/MasterProfile.vue"
    click Orders "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/blob/main/resources/js/Pages/Frontend/Profile/ProfileOrders.vue"
    click Wishlist "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/blob/main/resources/js/Pages/Frontend/Profile/WishList.vue"
    click AdminLayout "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/blob/main/resources/js/Pages/Backend/Layout/MasterBackend.vue"
    click ProductsMgmt "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/blob/main/resources/js/Pages/Backend/Products.vue"
    click CategoriesMgmt "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/blob/main/resources/js/Pages/Backend/Categories.vue"
    click OrdersMgmt "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/blob/main/resources/js/Pages/Backend/Orders.vue"
    click JWT "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/blob/main/app/Helper/JWTToken.php"
    click AuthMiddleware "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/tree/main/app/Http/Middleware"
    click SSLCommerz "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/blob/main/app/Helper/SSLCOMMERZ.php"
    click OTPMail "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/blob/main/app/Mail/OTPMail.php"
    click ResetMail "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/blob/main/app/Mail/PasswordResetMail.php"
    click CartController "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/blob/main/app/Http/Controllers/CartController.php"
    click Models "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/tree/main/app/Models"
    click Migrations "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/tree/main/database/migrations"
    click ProductImages "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/tree/main/public/images/products"
    click CategoryImages "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/tree/main/public/images/categories"
    click UserImages "https://github.com/NahidHassanOfficial/GroceryShop-Ecommerce/tree/main/public/images/users"

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef storage fill:#95a5a6,stroke:#7f8c8d,color:white
```
