# jigneshsingh-growexxer/ecommerce-website architecture

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

- Interactive diagram: https://gitdiagram.com/jigneshsingh-growexxer/ecommerce-website
- Repository: https://github.com/jigneshsingh-growexxer/ecommerce-website

## Overview

##### Project type and purpose
- This is a full-stack e-commerce web application.
- Frontend: React.js + Vite + Tailwind CSS, responsive SPA.
- Backend: Node.js + Express.js REST API, MongoDB storage, JWT authentication, file uploads via Multer.

##### File structure
- Top level: two folders “frontend” and “backend” plus root README.
- Frontend:
- src/components (UI building blocks by feature: auth, products, orders, profile, layout, routing)
- src/context (AuthContext, CartContext, MessageContext)
- src/services (api.js + per-domain services: auth, product, order, user, admin)
- index.html, main.jsx – React entry point
- Backend:
- index.js – server entry, Express app setup
- Constants, Utils, Middlewares, Controllers, Routers, Models – classic MVC structure
- Databases/db.js – MongoDB connection
- public/uploads – static file store
- sample-config.env-file.txt – config template

##### README for additional insights
- RESTful API with JWT auth, file uploads, admin dashboard
- Postman collection for API documentation

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend (Browser)" 
        direction TB
        ReactSPA["React SPA"]:::frontend
        UI["UI Components"]:::frontend
        Routing["AdminRoute & Routing"]:::frontend
        Pages["Pages"]:::frontend
        Context["State & Context"]:::frontend
        APIConfig["HTTP Config (apiConfig.js)"]:::frontend
        Services["Domain Services"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend (API)" 
        direction TB
        ExpressApp["Express API Gateway"]:::backend
        Middlewares["Middleware Layer"]:::backend
        Routers["Router Layer"]:::backend
        Controllers["Controller Layer"]:::backend
        Utils["Business Logic & Utils"]:::backend
        Constants["Constants"]:::backend
        Models["Data Models"]:::backend
        DBConn["DB Connection"]:::backend
        FileStore["File Storage"]:::backend
        Seeds["Seed Scripts"]:::backend
        ConfigTemplate["Config Template"]:::backend
    end

    %% Database & Storage
    subgraph "Database & Storage"
        direction TB
        MongoDB["MongoDB"]:::database
        Uploads["Uploads Folder"]:::database
    end

    %% External Services
    subgraph "External Services"
        direction TB
        Email["Email Service (SMTP/SendGrid)"]:::external
    end

    %% Frontend Flow
    ReactSPA -->|"Renders"| UI
    UI -->|"Uses Context"| Context
    UI -->|"Navigates"| Pages
    UI -->|"Guards"| Routing
    UI -->|"Calls Services"| Services
    Services -->|"Uses HTTP Config"| APIConfig
    Services -->|"HTTP Requests"| ExpressApp

    %% Backend Flow
    ExpressApp -->|"applies"| Middlewares
    Middlewares -->|"routes to"| Routers
    Routers -->|"invokes"| Controllers
    Controllers -->|"uses"| Utils
    Controllers -->|"references"| Constants
    Controllers -->|"CRUD"| Models
    Models -->|"connects"| MongoDB
    Middlewares -->|"file upload"| Uploads
    Controllers -->|"email triggers"| Email
    ExpressApp -->|"connects"| DBConn
    Seeds -->|"initializes"| MongoDB
    ExpressApp -->|"loads"| ConfigTemplate

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#333,stroke-width:1px;
    classDef backend fill:#d4edda,stroke:#333,stroke-width:1px;
    classDef database fill:#ffe5b4,stroke:#333,stroke-width:1px;
    classDef external fill:#e2e3e5,stroke:#333,stroke-width:1px;

    %% Click Events
    click ReactSPA "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/frontend/src/main.jsx"
    click ReactSPA "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/frontend/index.html"
    click UI "https://github.com/jigneshsingh-growexxer/ecommerce-website/tree/main/frontend/src/components"
    click Routing "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/frontend/src/components/routing/AdminRoute.jsx"
    click Pages "https://github.com/jigneshsingh-growexxer/ecommerce-website/tree/main/frontend/src/pages"
    click Context "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/frontend/src/context/AuthContext.jsx"
    click Context "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/frontend/src/context/CartContext.jsx"
    click Context "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/frontend/src/context/MessageContext.jsx"
    click APIConfig "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/frontend/src/config/apiConfig.js"
    click Services "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/frontend/src/services/authService.js"
    click Services "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/frontend/src/services/productService.js"
    click Services "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/frontend/src/services/orderService.js"
    click Services "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/frontend/src/services/userService.js"
    click Services "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/frontend/src/services/adminService.js"
    click ExpressApp "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/index.js"
    click Middlewares "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Middlewares/authMiddleware.js"
    click Middlewares "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Middlewares/errorMiddleware.js"
    click Middlewares "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Middlewares/uploadMiddleware.js"
    click Routers "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Routers/authRoutes.js"
    click Routers "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Routers/productRoutes.js"
    click Routers "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Routers/orderRoutes.js"
    click Routers "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Routers/userRoutes.js"
    click Routers "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Routers/adminRoutes.js"
    click Controllers "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Controllers/authController.js"
    click Controllers "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Controllers/productController.js"
    click Controllers "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Controllers/orderController.js"
    click Controllers "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Controllers/userControllers.js"
    click Controllers "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Controllers/adminController.js"
    click Utils "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Utils/appError.js"
    click Utils "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Utils/catchAsync.js"
    click Utils "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Utils/email.js"
    click Constants "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Constants/httpStatusCode.js"
    click Constants "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Constants/responseMessage.js"
    click Models "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Models/userModel.js"
    click Models "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Models/productModel.js"
    click Models "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Models/orderModel.js"
    click Models "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Models/reviewModel.js"
    click DBConn "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/Databases/db.js"
    click FileStore "https://github.com/jigneshsingh-growexxer/ecommerce-website/tree/main/backend/public/uploads"
    click Seeds "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/seeds/productSeeder.js"
    click ConfigTemplate "https://github.com/jigneshsingh-growexxer/ecommerce-website/blob/main/backend/sample-config.env-file.txt"
```
