# vivek5130/virtual-assistant-frontend architecture

> Architecture diagram of the GitHub repository vivek5130/virtual-assistant-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vivek5130/virtual-assistant-frontend
- Repository: https://github.com/vivek5130/virtual-assistant-frontend

## Overview

ShopSmart is a React storefront with an AI shopping assistant. The main workflow is browsing the home page and product categories, optionally asking for recommendations by text or voice, then viewing and managing a cart. The README also describes search/filtering, detailed product views, and quick actions such as order tracking and returns; those capabilities are represented where the tree supports them, but their full implementation is not shown in the excerpts. Edges reflect shown imports, calls, and data access; unverified feature links are dashed.

Main entry points: [`src/App.tsx`](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/App.tsx) (Home & Assistant), [`src/main.tsx`](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/main.tsx) (Routes & Mount), [`src/components/CartPage.tsx`](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/CartPage.tsx) (Cart Page), [`src/components/Navbar.tsx`](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/Navbar.tsx) (Navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Storefront"]
  node_entry["Routes &amp; Mount<br/>[main.tsx]"]
  node_navbar["Navigation<br/>[Navbar.tsx]"]
  node_home["Home &amp; Assistant<br/>[App.tsx]"]
  node_hero["Hero Section<br/>[HeroSection.tsx]"]
end

subgraph group_catalog["Product Catalog"]
  node_featured["Featured Products"]
  node_category["Category Browse<br/>[shopByCategory.tsx]"]
  node_productcard["Product Cards<br/>[ProductCard.tsx]"]
  node_details["Product Details<br/>[ProductDetails.tsx]"]
  node_productapi["Product API"]
end

subgraph group_assistant["Shopping Assistant"]
  node_chat["Assistant Chat<br/>[App.tsx]"]
  node_gemini["Gemini API"]
  node_speech["Speech Recognition"]
end

subgraph group_cart["Cart"]
  node_cartpage["Cart Page<br/>[CartPage.tsx]"]
  node_cartstate["Assistant Cart State<br/>[App.tsx]"]
  node_storage[("Browser Storage")]
  node_cartcontext["Cart Context<br/>[CartContext.tsx]"]
end

node_shopper(("Shopper"))

node_shopper -.->|"opens store"| node_entry
node_entry -->|"routes home"| node_home
node_entry -->|"routes cart"| node_cartpage
node_entry -->|"renders"| node_navbar
node_home -->|"renders"| node_hero
node_home -->|"renders"| node_featured
node_home -->|"renders"| node_category
node_home -->|"renders"| node_chat
node_category -->|"fetches products"| node_productapi
node_home -->|"fetches products"| node_productapi
node_chat -->|"requests recommendations"| node_gemini
node_chat -->|"captures voice"| node_speech
node_chat -->|"updates cart"| node_cartstate
node_cartstate -->|"reads and writes"| node_storage
node_cartpage -->|"loads and updates"| node_storage
node_navbar -->|"links cart"| node_cartpage
node_home -.->|"shows product view"| node_details
node_home -.->|"uses product cards"| node_productcard
node_cartcontext -.->|"shares cart state"| node_cartstate

click node_entry "https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/main.tsx"
click node_navbar "https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/Navbar.tsx"
click node_home "https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/App.tsx"
click node_hero "https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/HeroSection.tsx"
click node_featured "https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/FeaturedProducts.tsx"
click node_category "https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/shopByCategory.tsx"
click node_productcard "https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/ProductCard.tsx"
click node_details "https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/ProductDetails.tsx"
click node_chat "https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/App.tsx"
click node_cartpage "https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/CartPage.tsx"
click node_cartstate "https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/App.tsx"
click node_cartcontext "https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/context/CartContext.tsx"

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_navbar,node_home,node_hero toneBlue
class node_featured,node_category,node_productcard,node_details,node_productapi toneAmber
class node_chat,node_gemini,node_speech toneMint
class node_cartpage,node_cartstate,node_storage,node_cartcontext toneRose
class node_shopper toneIndigo
```

## Components

### Storefront

- [Routes & Mount](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/main.tsx): `src/main.tsx`
- [Navigation](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/Navbar.tsx): `src/components/Navbar.tsx`
- [Home & Assistant](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/App.tsx): `src/App.tsx`
- [Hero Section](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/HeroSection.tsx): `src/components/HeroSection.tsx`

### Product Catalog

- [Featured Products](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/FeaturedProducts.tsx): `src/components/FeaturedProducts.tsx`
- [Category Browse](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/shopByCategory.tsx): `src/components/shopByCategory.tsx`
- [Product Cards](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/ProductCard.tsx): `src/components/ProductCard.tsx`
- [Product Details](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/ProductDetails.tsx): `src/components/ProductDetails.tsx`
- **Product API**

### Shopping Assistant

- [Assistant Chat](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/App.tsx): `src/App.tsx`
- **Gemini API**
- **Speech Recognition**

### Cart

- [Cart Page](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/components/CartPage.tsx): `src/components/CartPage.tsx`
- [Assistant Cart State](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/App.tsx): `src/App.tsx`
- **Browser Storage**
- [Cart Context](https://github.com/vivek5130/virtual-assistant-frontend/blob/main/src/context/CartContext.tsx): `src/context/CartContext.tsx`

### Other components

- **Shopper**

## Connections

- Shopper → Routes & Mount: opens store
- Routes & Mount → Home & Assistant: routes home (evidence: `src/main.tsx`)
- Routes & Mount → Cart Page: routes cart (evidence: `src/main.tsx`)
- Routes & Mount → Navigation: renders (evidence: `src/main.tsx`)
- Home & Assistant → Hero Section: renders (evidence: `src/App.tsx`)
- Home & Assistant → Featured Products: renders (evidence: `src/App.tsx`)
- Home & Assistant → Category Browse: renders (evidence: `src/App.tsx`)
- Home & Assistant → Assistant Chat: renders (evidence: `src/App.tsx`)
- Category Browse → Product API: fetches products (evidence: `src/components/shopByCategory.tsx`)
- Home & Assistant → Product API: fetches products (evidence: `src/App.tsx`)
- Assistant Chat → Gemini API: requests recommendations (evidence: `src/App.tsx`)
- Assistant Chat → Speech Recognition: captures voice (evidence: `src/App.tsx`)
- Assistant Chat → Assistant Cart State: updates cart (evidence: `src/App.tsx`)
- Assistant Cart State → Browser Storage: reads and writes (evidence: `src/App.tsx`)
- Cart Page → Browser Storage: loads and updates (evidence: `src/components/CartPage.tsx`)
- Navigation → Cart Page: links cart (evidence: `src/components/Navbar.tsx`)
- Home & Assistant → Product Details: shows product view (evidence: `readme.md`)
- Home & Assistant → Product Cards: uses product cards
- Cart Context → Assistant Cart State: shares cart state
