# anand-nayak-git/price-comparision-system architecture

> Architecture diagram of the GitHub repository anand-nayak-git/price-comparision-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anand-nayak-git/price-comparision-system
- Repository: https://github.com/anand-nayak-git/price-comparision-system

## Overview

PriceCompare is a product-price comparison app: shoppers browse or search products, inspect vendor offers and lowest prices, and can view comparisons and recommendations. The React client has home and comparison pages; the Express API serves product, search, vendor, and recommendation features. Server-side pricing generates offers for five named retailers, while product/search data can come from MongoDB or local JSON. The sampled code shows generated price estimates, not retailer price scraping. Some client and route implementations were not sampled, so uncertain wiring is omitted.

Main entry points: [`server/controllers/searchController.js`](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/controllers/searchController.js) (Search handling), [`server/utils/universalPriceEngine.js`](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/utils/universalPriceEngine.js) (Offer generation), [`client/src/pages/HomePage.jsx`](https://github.com/anand-nayak-git/price-comparision-system/blob/main/client/src/pages/HomePage.jsx) (Home page), [`server/app.js`](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/app.js) (Express app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Shopper interface"]
  node_app["React app<br/>[App.jsx]"]
  node_home["Home page<br/>[HomePage.jsx]"]
  node_comparison["Comparison page<br/>[ComparisonPage.jsx]"]
  node_filter["Category filter<br/>[CategoryFilter.jsx]"]
  node_productcard["Product card<br/>[ProductCard.jsx]"]
  node_recommendationcard["Recommendation card"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["API workflows"]
  node_express["Express app<br/>[app.js]"]
  node_product_routes["Product routes<br/>[productRoutes.js]"]
  node_search_routes["Search routes<br/>[searchRoutes.js]"]
  node_recommendation_routes["Recommendation routes"]
  node_vendor_routes["Vendor routes<br/>[vendorRoutes.js]"]
  node_product_controller["Product handling"]
  node_search_controller["Search handling"]
  node_vendor_controller["Vendor handling"]
end

subgraph group_pricing["Offer and discovery logic"]
  node_search_engine["Smart search<br/>[searchEngine.js]"]
  node_live_search["Live query offers"]
  node_price_engine["Offer generation"]
  node_recommend_engine["Recommendations"]
  node_vendor_catalog["Vendor catalog<br/>[vendorCatalog.js]"]
  node_price_catalog["Reference prices<br/>[priceCatalog.js]"]
  node_image_resolver["Image resolver<br/>[imageResolver.js]"]
end

subgraph group_state["Product data"]
  node_product_model[("Product model<br/>[Product.js]")]
  node_vendor_model[("Vendor model<br/>[Vendor.js]")]
  node_local_data["Product fallback<br/>[data.json]"]
end

node_shopper(("Shopper"))
node_mongodb[("MongoDB")]

node_shopper -->|"uses"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_comparison
node_home -->|"offers filtering"| node_filter
node_home -->|"shows products"| node_productcard
node_home -->|"shows suggestions"| node_recommendationcard
node_home -->|"requests data"| node_api_client
node_comparison -->|"requests comparison"| node_api_client
node_api_client -->|"calls API"| node_express
node_express -->|"dispatches"| node_product_routes
node_express -->|"dispatches"| node_search_routes
node_express -->|"dispatches"| node_recommendation_routes
node_express -->|"dispatches"| node_vendor_routes
node_product_routes -->|"dispatches"| node_product_controller
node_search_routes -->|"dispatches"| node_search_controller
node_recommendation_routes -->|"dispatches"| node_search_controller
node_vendor_routes -->|"dispatches"| node_vendor_controller
node_product_controller -->|"queries"| node_product_model
node_product_controller -->|"fallback reads"| node_local_data
node_product_controller -->|"generates offers"| node_price_engine
node_search_controller -->|"loads products"| node_product_model
node_search_controller -->|"fallback reads"| node_local_data
node_search_controller -->|"searches products"| node_search_engine
node_search_controller -->|"falls back to"| node_live_search
node_search_controller -->|"requests suggestions"| node_recommend_engine
node_live_search -->|"generates offers"| node_price_engine
node_live_search -->|"caches offers"| node_product_model
node_recommend_engine -->|"groups products"| node_search_engine
node_recommend_engine -->|"refreshes offers"| node_price_engine
node_price_engine -->|"looks up prices"| node_price_catalog
node_price_engine -->|"selects vendors"| node_vendor_catalog
node_price_engine -->|"resolves image"| node_image_resolver
node_vendor_controller -->|"queries vendors"| node_vendor_model

click node_app "https://github.com/anand-nayak-git/price-comparision-system/blob/main/client/src/App.jsx"
click node_home "https://github.com/anand-nayak-git/price-comparision-system/blob/main/client/src/pages/HomePage.jsx"
click node_comparison "https://github.com/anand-nayak-git/price-comparision-system/blob/main/client/src/pages/ComparisonPage.jsx"
click node_filter "https://github.com/anand-nayak-git/price-comparision-system/blob/main/client/src/components/CategoryFilter.jsx"
click node_productcard "https://github.com/anand-nayak-git/price-comparision-system/blob/main/client/src/components/ProductCard.jsx"
click node_recommendationcard "https://github.com/anand-nayak-git/price-comparision-system/blob/main/client/src/components/RecommendationCard.jsx"
click node_api_client "https://github.com/anand-nayak-git/price-comparision-system/blob/main/client/src/services/api.js"
click node_express "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/app.js"
click node_product_routes "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/routes/productRoutes.js"
click node_search_routes "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/routes/searchRoutes.js"
click node_recommendation_routes "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/routes/recommendationRoutes.js"
click node_vendor_routes "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/routes/vendorRoutes.js"
click node_product_controller "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/controllers/productController.js"
click node_search_controller "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/controllers/searchController.js"
click node_vendor_controller "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/controllers/vendorController.js"
click node_search_engine "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/utils/searchEngine.js"
click node_live_search "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/services/liveSearchService.js"
click node_price_engine "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/utils/universalPriceEngine.js"
click node_recommend_engine "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/utils/recommendationEngine.js"
click node_vendor_catalog "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/utils/vendorCatalog.js"
click node_price_catalog "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/utils/priceCatalog.js"
click node_image_resolver "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/utils/imageResolver.js"
click node_product_model "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/models/Product.js"
click node_vendor_model "https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/models/Vendor.js"
click node_local_data "https://github.com/anand-nayak-git/price-comparision-system/blob/main/data.json"

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_app,node_home,node_comparison,node_filter,node_productcard,node_recommendationcard,node_api_client toneBlue
class node_express,node_product_routes,node_search_routes,node_recommendation_routes,node_vendor_routes,node_product_controller,node_search_controller,node_vendor_controller,node_mongodb toneAmber
class node_search_engine,node_live_search,node_price_engine,node_recommend_engine,node_vendor_catalog,node_price_catalog,node_image_resolver toneMint
class node_product_model,node_vendor_model,node_local_data toneRose
class node_shopper toneIndigo
```

## Components

### Shopper interface

- [React app](https://github.com/anand-nayak-git/price-comparision-system/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Home page](https://github.com/anand-nayak-git/price-comparision-system/blob/main/client/src/pages/HomePage.jsx): `client/src/pages/HomePage.jsx`
- [Comparison page](https://github.com/anand-nayak-git/price-comparision-system/blob/main/client/src/pages/ComparisonPage.jsx): `client/src/pages/ComparisonPage.jsx`
- [Category filter](https://github.com/anand-nayak-git/price-comparision-system/blob/main/client/src/components/CategoryFilter.jsx): `client/src/components/CategoryFilter.jsx`
- [Product card](https://github.com/anand-nayak-git/price-comparision-system/blob/main/client/src/components/ProductCard.jsx): `client/src/components/ProductCard.jsx`
- [Recommendation card](https://github.com/anand-nayak-git/price-comparision-system/blob/main/client/src/components/RecommendationCard.jsx): `client/src/components/RecommendationCard.jsx`
- [API client](https://github.com/anand-nayak-git/price-comparision-system/blob/main/client/src/services/api.js): `client/src/services/api.js`

### API workflows

- [Express app](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/app.js): `server/app.js`
- [Product routes](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/routes/productRoutes.js): `server/routes/productRoutes.js`
- [Search routes](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/routes/searchRoutes.js): `server/routes/searchRoutes.js`
- [Recommendation routes](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/routes/recommendationRoutes.js): `server/routes/recommendationRoutes.js`
- [Vendor routes](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/routes/vendorRoutes.js): `server/routes/vendorRoutes.js`
- [Product handling](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/controllers/productController.js): `server/controllers/productController.js`
- [Search handling](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/controllers/searchController.js): `server/controllers/searchController.js`
- [Vendor handling](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/controllers/vendorController.js): `server/controllers/vendorController.js`

### Offer and discovery logic

- [Smart search](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/utils/searchEngine.js): `server/utils/searchEngine.js`
- [Live query offers](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/services/liveSearchService.js): `server/services/liveSearchService.js`
- [Offer generation](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/utils/universalPriceEngine.js): `server/utils/universalPriceEngine.js`
- [Recommendations](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/utils/recommendationEngine.js): `server/utils/recommendationEngine.js`
- [Vendor catalog](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/utils/vendorCatalog.js): `server/utils/vendorCatalog.js`
- [Reference prices](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/utils/priceCatalog.js): `server/utils/priceCatalog.js`
- [Image resolver](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/utils/imageResolver.js): `server/utils/imageResolver.js`

### Product data

- [Product model](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/models/Product.js): `server/models/Product.js`
- [Vendor model](https://github.com/anand-nayak-git/price-comparision-system/blob/main/server/models/Vendor.js): `server/models/Vendor.js`
- [Product fallback](https://github.com/anand-nayak-git/price-comparision-system/blob/main/data.json): `data.json`

### Other components

- **Shopper**
- **MongoDB**

## Connections

- Shopper → React app: uses
- React app → Home page: routes to
- React app → Comparison page: routes to
- Home page → Category filter: offers filtering
- Home page → Product card: shows products
- Home page → Recommendation card: shows suggestions
- Home page → API client: requests data
- Comparison page → API client: requests comparison
- API client → Express app: calls API
- Express app → Product routes: dispatches
- Express app → Search routes: dispatches
- Express app → Recommendation routes: dispatches
- Express app → Vendor routes: dispatches
- Product routes → Product handling: dispatches
- Search routes → Search handling: dispatches
- Recommendation routes → Search handling: dispatches
- Vendor routes → Vendor handling: dispatches
- Product handling → Product model: queries
- Product handling → Product fallback: fallback reads
- Product handling → Offer generation: generates offers
- Search handling → Product model: loads products
- Search handling → Product fallback: fallback reads
- Search handling → Smart search: searches products
- Search handling → Live query offers: falls back to
- Search handling → Recommendations: requests suggestions
- Live query offers → Offer generation: generates offers
- Live query offers → Product model: caches offers
- Recommendations → Smart search: groups products
- Recommendations → Offer generation: refreshes offers
- Offer generation → Reference prices: looks up prices
- Offer generation → Vendor catalog: selects vendors
- Offer generation → Image resolver: resolves image
- Vendor handling → Vendor model: queries vendors
