# pustamrai/productstore architecture

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

- Interactive diagram: https://gitdiagram.com/pustamrai/productstore
- Repository: https://github.com/pustamrai/productstore

## Overview

##### Project type and purpose
- This is a full-stack MERN application (MongoDB, Express, React, Node) for product management with image uploads via Multer and Cloudinary.
- It provides CRUD operations on products (add, update, delete, list) and stores image assets in Cloudinary.

##### File structure
- Top level: two folders, **backend** and **frontend**
- Backend follows an MVC-style organization:
- src/controllers → request logic
- src/routes      → Express route definitions
- src/models      → Mongoose schemas
- src/db          → DB connection setup
- src/middleware  → Multer file-upload config
- src/utils       → Cloudinary helper
- server.js       → Entry point
- Frontend is a React/Vite app with:
- src/pages       → route-mapped page components
- src/components  → shared UI widgets
- src/api         → wrapper for HTTP calls to backend
- src/context     → React Context state for products
- public/index.html, assets, Tailwind/CSS, Vite config

##### README for additional insights
- Confirms tech stack: React, Tailwind, Express, MongoDB, Mongoose, Multer, Cloudinary
- Lists API endpoints (/addProduct, /allProducts, etc.)
- Describes features and future enhancements

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Frontend (React SPA)"
        direction TB
        AppEntry["main.jsx"]:::frontend
        AppRoot["App.jsx"]:::frontend
        Navbar["Navbar.jsx"]:::frontend
        AddProduct["AddProduct.jsx"]:::frontend
        ProductCard["ProductCard.jsx"]:::frontend
        LoadingSkeleton["LoadingSkeleton.jsx"]:::frontend
        ProductContext["productContext.jsx"]:::frontend
        API["API.js"]:::frontend
    end

    subgraph "Backend (Express API)"
        direction TB
        Server["server.js"]:::backend
        Routes["product.routes.js"]:::backend
        Multer["multer.middleware.js"]:::backend
        Controllers["product.controllers.js"]:::backend
        Models["products.models.js"]:::backend
        DBSetup["db.js"]:::backend
        CloudUtil["cloudinary.js"]:::backend
    end

    DB["MongoDB"]:::db
    Cloudinary["Cloudinary"]:::cloud

    AppEntry --> AppRoot
    AppRoot --> Navbar
    AppRoot --> AddProduct
    AppRoot --> ProductCard
    AppRoot --> ProductContext
    AddProduct --> API
    ProductCard --> API
    API -->|"HTTP Requests"| Server

    Server --> DBSetup
    Server --> Routes
    Routes --> Multer
    Routes --> Controllers
    Controllers --> Models
    Controllers --> CloudUtil
    DBSetup --> DB
    Models --> DB
    Controllers --> Cloudinary

    click AppEntry "https://github.com/pustamrai/productstore/blob/main/frontend/src/main.jsx"
    click AppRoot "https://github.com/pustamrai/productstore/blob/main/frontend/src/App.jsx"
    click AddProduct "https://github.com/pustamrai/productstore/blob/main/frontend/src/pages/AddProduct.jsx"
    click ProductCard "https://github.com/pustamrai/productstore/blob/main/frontend/src/pages/ProductCard.jsx"
    click Navbar "https://github.com/pustamrai/productstore/blob/main/frontend/src/components/Navbar.jsx"
    click LoadingSkeleton "https://github.com/pustamrai/productstore/blob/main/frontend/src/components/LoadingSkeleton.jsx"
    click ProductContext "https://github.com/pustamrai/productstore/blob/main/frontend/src/context/productContext.jsx"
    click API "https://github.com/pustamrai/productstore/blob/main/frontend/src/api/API.js"
    click Server "https://github.com/pustamrai/productstore/blob/main/backend/src/server.js"
    click Routes "https://github.com/pustamrai/productstore/blob/main/backend/src/routes/product.routes.js"
    click Controllers "https://github.com/pustamrai/productstore/blob/main/backend/src/controllers/product.controllers.js"
    click Models "https://github.com/pustamrai/productstore/blob/main/backend/src/models/products.models.js"
    click DBSetup "https://github.com/pustamrai/productstore/blob/main/backend/src/db/db.js"
    click Multer "https://github.com/pustamrai/productstore/blob/main/backend/src/middleware/multer.middleware.js"
    click CloudUtil "https://github.com/pustamrai/productstore/blob/main/backend/src/utils/cloudinary.js"

    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef db fill:#FFA500,stroke:#333,stroke-width:1px
    classDef cloud fill:#FFA500,stroke:#333,stroke-width:1px
```
