# sivakalyanb/shopverse architecture

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

- Interactive diagram: https://gitdiagram.com/sivakalyanb/shopverse
- Repository: https://github.com/sivakalyanb/shopverse

## Overview

ShopVerse is a React storefront backed by a Go/Fiber API and MySQL. Shoppers browse products, authenticate, manage a cart and wishlist, then place and review orders. The frontend application owns shared session/cart state and API requests; the backend routes those requests to domain handlers, which use the database layer. The README documents the three-tier deployment and API capabilities; unsampled frontend pages and handlers are represented at their tree paths, without assuming unshown call details.

Main entry points: [`frontend/src/App.jsx`](https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/App.jsx) (App state and routes), [`backend/cmd/main.go`](https://github.com/sivakalyanb/shopverse/blob/main/backend/cmd/main.go) (HTTP API routes), [`backend/internal/database/db.go`](https://github.com/sivakalyanb/shopverse/blob/main/backend/internal/database/db.go) (Database access), [`frontend/src/pages/HomePage.jsx`](https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/pages/HomePage.jsx) (Home catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_entry["React bootstrap<br/>[main.jsx]"]
  node_app["App state and routes<br/>[App.jsx]"]
  node_authpage["Authentication page<br/>[AuthPage.jsx]"]
  node_home["Home catalog<br/>[HomePage.jsx]"]
  node_products["Product browsing<br/>[ProductsPage.jsx]"]
  node_productcard["Product card<br/>[ProductCard.jsx]"]
  node_cartpage["Cart checkout<br/>[CartPage.jsx]"]
  node_orderspage["Order history<br/>[OrdersPage.jsx]"]
  node_wishlist["Wishlist page<br/>[WishlistPage.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
  node_cartsidebar["Cart sidebar<br/>[CartSidebar.jsx]"]
end

subgraph group_commerce["Commerce API"]
  node_api["HTTP API routes<br/>[main.go]"]
  node_auth["Authentication handlers<br/>[auth.go]"]
  node_catalog["Product handlers<br/>[products.go]"]
  node_cart["Cart handlers<br/>[cart.go]"]
  node_orders["Order handlers<br/>[orders.go]"]
  node_middleware["JWT middleware<br/>[auth.go]"]
end

subgraph group_persistence["Persistence"]
  node_db["Database access<br/>[db.go]"]
  node_mysql[("MySQL store")]
end

node_shopper(("Shopper"))

node_shopper -->|"uses"| node_entry
node_entry -->|"renders"| node_app
node_app -->|"routes"| node_authpage
node_app -->|"routes"| node_home
node_app -->|"routes"| node_products
node_app -->|"routes"| node_cartpage
node_app -->|"routes"| node_orderspage
node_app -->|"routes"| node_wishlist
node_app -->|"renders"| node_navbar
node_app -->|"renders"| node_cartsidebar
node_home -->|"renders"| node_productcard
node_products -->|"renders"| node_productcard
node_wishlist -->|"renders"| node_productcard
node_authpage -->|"uses context"| node_app
node_cartpage -->|"uses context"| node_app
node_home -->|"requests products"| node_api
node_app -->|"requests commerce"| node_api
node_api -->|"routes auth"| node_auth
node_api -->|"routes products"| node_catalog
node_api -->|"routes cart"| node_cart
node_api -->|"routes orders"| node_orders
node_api -->|"protects routes"| node_middleware
node_auth -->|"creates tokens"| node_middleware
node_auth -->|"reads and writes"| node_db
node_catalog -->|"reads and writes"| node_db
node_cart -->|"reads and writes"| node_db
node_orders -->|"reads and writes"| node_db
node_db -->|"persists data"| node_mysql

click node_entry "https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/main.jsx"
click node_app "https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/App.jsx"
click node_authpage "https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/pages/AuthPage.jsx"
click node_home "https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/pages/HomePage.jsx"
click node_products "https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/pages/ProductsPage.jsx"
click node_productcard "https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/components/ProductCard.jsx"
click node_cartpage "https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/pages/CartPage.jsx"
click node_orderspage "https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/pages/OrdersPage.jsx"
click node_wishlist "https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/pages/WishlistPage.jsx"
click node_navbar "https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/components/Navbar.jsx"
click node_cartsidebar "https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/components/CartSidebar.jsx"
click node_api "https://github.com/sivakalyanb/shopverse/blob/main/backend/cmd/main.go"
click node_auth "https://github.com/sivakalyanb/shopverse/blob/main/backend/internal/handlers/auth.go"
click node_catalog "https://github.com/sivakalyanb/shopverse/blob/main/backend/internal/handlers/products.go"
click node_cart "https://github.com/sivakalyanb/shopverse/blob/main/backend/internal/handlers/cart.go"
click node_orders "https://github.com/sivakalyanb/shopverse/blob/main/backend/internal/handlers/orders.go"
click node_middleware "https://github.com/sivakalyanb/shopverse/blob/main/backend/internal/middleware/auth.go"
click node_db "https://github.com/sivakalyanb/shopverse/blob/main/backend/internal/database/db.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_app,node_authpage,node_home,node_products,node_productcard,node_cartpage,node_orderspage,node_wishlist,node_navbar,node_cartsidebar toneBlue
class node_api,node_auth,node_catalog,node_cart,node_orders,node_middleware toneAmber
class node_db,node_mysql toneMint
class node_shopper toneIndigo
```

## Components

### Storefront

- [React bootstrap](https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [App state and routes](https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Authentication page](https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/pages/AuthPage.jsx): `frontend/src/pages/AuthPage.jsx`
- [Home catalog](https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/pages/HomePage.jsx): `frontend/src/pages/HomePage.jsx`
- [Product browsing](https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/pages/ProductsPage.jsx): `frontend/src/pages/ProductsPage.jsx`
- [Product card](https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/components/ProductCard.jsx): `frontend/src/components/ProductCard.jsx`
- [Cart checkout](https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/pages/CartPage.jsx): `frontend/src/pages/CartPage.jsx`
- [Order history](https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/pages/OrdersPage.jsx): `frontend/src/pages/OrdersPage.jsx`
- [Wishlist page](https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/pages/WishlistPage.jsx): `frontend/src/pages/WishlistPage.jsx`
- [Navigation](https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/components/Navbar.jsx): `frontend/src/components/Navbar.jsx`
- [Cart sidebar](https://github.com/sivakalyanb/shopverse/blob/main/frontend/src/components/CartSidebar.jsx): `frontend/src/components/CartSidebar.jsx`

### Commerce API

- [HTTP API routes](https://github.com/sivakalyanb/shopverse/blob/main/backend/cmd/main.go): `backend/cmd/main.go`
- [Authentication handlers](https://github.com/sivakalyanb/shopverse/blob/main/backend/internal/handlers/auth.go): `backend/internal/handlers/auth.go`
- [Product handlers](https://github.com/sivakalyanb/shopverse/blob/main/backend/internal/handlers/products.go): `backend/internal/handlers/products.go`
- [Cart handlers](https://github.com/sivakalyanb/shopverse/blob/main/backend/internal/handlers/cart.go): `backend/internal/handlers/cart.go`
- [Order handlers](https://github.com/sivakalyanb/shopverse/blob/main/backend/internal/handlers/orders.go): `backend/internal/handlers/orders.go`
- [JWT middleware](https://github.com/sivakalyanb/shopverse/blob/main/backend/internal/middleware/auth.go): `backend/internal/middleware/auth.go`

### Persistence

- [Database access](https://github.com/sivakalyanb/shopverse/blob/main/backend/internal/database/db.go): `backend/internal/database/db.go`
- **MySQL store**

### Other components

- **Shopper**

## Connections

- Shopper → React bootstrap: uses (evidence: `README.md`)
- React bootstrap → App state and routes: renders (evidence: `frontend/src/main.jsx`)
- App state and routes → Authentication page: routes (evidence: `frontend/src/App.jsx`)
- App state and routes → Home catalog: routes (evidence: `frontend/src/App.jsx`)
- App state and routes → Product browsing: routes (evidence: `frontend/src/App.jsx`)
- App state and routes → Cart checkout: routes (evidence: `frontend/src/App.jsx`)
- App state and routes → Order history: routes (evidence: `frontend/src/App.jsx`)
- App state and routes → Wishlist page: routes (evidence: `frontend/src/App.jsx`)
- App state and routes → Navigation: renders (evidence: `frontend/src/App.jsx`)
- App state and routes → Cart sidebar: renders (evidence: `frontend/src/App.jsx`)
- Home catalog → Product card: renders (evidence: `frontend/src/pages/HomePage.jsx`)
- Product browsing → Product card: renders (evidence: `frontend/src/pages/ProductsPage.jsx`)
- Wishlist page → Product card: renders (evidence: `frontend/src/pages/WishlistPage.jsx`)
- Authentication page → App state and routes: uses context (evidence: `frontend/src/pages/AuthPage.jsx`)
- Cart checkout → App state and routes: uses context (evidence: `frontend/src/pages/CartPage.jsx`)
- Home catalog → HTTP API routes: requests products (evidence: `frontend/src/pages/HomePage.jsx`)
- App state and routes → HTTP API routes: requests commerce (evidence: `frontend/src/App.jsx`)
- HTTP API routes → Authentication handlers: routes auth (evidence: `backend/cmd/main.go`)
- HTTP API routes → Product handlers: routes products (evidence: `backend/cmd/main.go`)
- HTTP API routes → Cart handlers: routes cart (evidence: `backend/cmd/main.go`)
- HTTP API routes → Order handlers: routes orders (evidence: `backend/cmd/main.go`)
- HTTP API routes → JWT middleware: protects routes (evidence: `backend/cmd/main.go`)
- Authentication handlers → JWT middleware: creates tokens (evidence: `backend/internal/handlers/auth.go`)
- Authentication handlers → Database access: reads and writes (evidence: `backend/internal/handlers/auth.go`)
- Product handlers → Database access: reads and writes (evidence: `backend/internal/handlers/products.go`)
- Cart handlers → Database access: reads and writes (evidence: `backend/internal/handlers/cart.go`)
- Order handlers → Database access: reads and writes (evidence: `backend/internal/handlers/orders.go`)
- Database access → MySQL store: persists data (evidence: `README.md`)
