# rip-skillan/scrape-expectations architecture

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

- Interactive diagram: https://gitdiagram.com/rip-skillan/scrape-expectations
- Repository: https://github.com/rip-skillan/scrape-expectations

## Overview

#### Purpose and runtime topology
Scrape-Expectations is a product-search and price-comparison application. A React/Vite browser client submits product queries to a Node.js backend, which is responsible for Bright Data scraping/API calls; returned product data is displayed, sorted, and optionally organized into user-managed lists. Primary runtime entry points are `frontend/src/main.jsx` and `backend/server.js`.

#### Frontend application shell
`frontend/src/main.jsx` mounts the React application, while `frontend/src/App.jsx` owns top-level application composition and navigation between search and list-management views. Styling is centralized in `frontend/src/App.css` and `frontend/src/index.css`; the UI is a client-rendered Vite application, served during development through `frontend/vite.config.js`.

#### Search and aggregation flow
The search UI begins in `frontend/src/components/SearchBar.jsx`. Search state and result presentation converge in `frontend/src/components/Dashboard.jsx`, which renders product result cards through `frontend/src/components/ProductCard.jsx`. The intended control flow is: user query → frontend request to backend → backend Bright Data integration → normalized product results → dashboard/card display. Failure or unavailable-result states are represented by `frontend/src/components/NotFound.jsx`.

#### Backend scraping boundary
`backend/server.js` is the server-side integration boundary for Bright Data. It isolates external scraping/API traffic from the browser, likely handling query forwarding and response shaping before product data reaches the frontend. `backend/package.json` defines the Node runtime dependencies and scripts. Bright Data is the principal external service and should remain behind this backend boundary rather than be invoked directly by UI components.

#### Result sorting and display controls
Result ordering is separated from rendering in `frontend/src/hooks/sortProducts.js`, supporting price and source ordering. `frontend/src/components/SortDropdown.jsx` exposes the sorting controls, with a custom presentation option in `frontend/src/components/CustomSortDropdown.css`. `Dashboard.jsx` is the integration point that combines search results, selected sort mode, and card rendering.

#### Product-list management
Saved-product organization is a client-side feature centered on `frontend/src/hooks/useLists.js`, which encapsulates list CRUD and storage behavior. `frontend/src/components/SaveToListButton.jsx` attaches search-result products to lists. `frontend/src/pages/ListsPage.jsx` provides collection-level list management, and `frontend/src/pages/ListDetailPage.jsx` manages/view edits for products within a selected list. This is distinct from the scraping pipeline and appears to use frontend-managed persistence rather than a dedicated backend data store.

#### Navigation and user-facing boundaries
`frontend/src/components/Navbar.jsx` switches users between the search/dashboard experience and saved-list pages. The main architectural boundaries are: browser UI and local list state in `frontend/src`; server-side scraping orchestration in `backend/server.js`; and Bright Data as the external product-data acquisition service.

Main entry points: [`frontend/src/components/Dashboard.jsx`](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/Dashboard.jsx) (Search dashboard), [`frontend/src/App.jsx`](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/App.jsx) (App shell), [`frontend/src/pages/ListsPage.jsx`](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/pages/ListsPage.jsx) (Lists page), [`frontend/src/components/Navbar.jsx`](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/Navbar.jsx) (Navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser client"]
  node_main["React entry<br/>entry point<br/>[main.jsx]"]
  node_app["App shell<br/>React composition<br/>[App.jsx]"]
  node_navbar["Navigation<br/>React component<br/>[Navbar.jsx]"]
  node_search["Search bar<br/>React component<br/>[SearchBar.jsx]"]
  node_dashboard["Search dashboard<br/>React component<br/>[Dashboard.jsx]"]
  node_sort["Product sorting<br/>client hook<br/>[sortProducts.js]"]
  node_sort_dropdown["Sort controls<br/>React component<br/>[SortDropdown.jsx]"]
  node_product_card["Product card<br/>React component<br/>[ProductCard.jsx]"]
  node_not_found["Empty/error state<br/>React component<br/>[NotFound.jsx]"]
  node_lists[("Saved lists state<br/>client hook<br/>[useLists.js]")]
  node_save_to_list["Save to list<br/>React component"]
  node_lists_page["Lists page<br/>React page<br/>[ListsPage.jsx]"]
  node_list_detail["List detail<br/>React page<br/>[ListDetailPage.jsx]"]
end

subgraph group_backend["Scraping backend"]
  node_server{{"Scraping server<br/>Node.js server<br/>[server.js]"}}
end

node_bright_data{{"Bright Data<br/>external scraping API"}}

node_main -->|"mounts"| node_app
node_app -->|"renders"| node_navbar
node_app -->|"shows search view"| node_dashboard
node_app -->|"shows list views"| node_lists_page
node_navbar -->|"navigates"| node_dashboard
node_navbar -->|"navigates"| node_lists_page
node_search -->|"submits query"| node_server
node_server -->|"scrapes / calls API"| node_bright_data
node_server -->|"normalized results"| node_dashboard
node_dashboard -->|"hosts query UI"| node_search
node_dashboard -->|"orders results"| node_sort
node_sort_dropdown -->|"selects mode"| node_sort
node_dashboard -->|"renders"| node_sort_dropdown
node_dashboard -->|"renders results"| node_product_card
node_dashboard -.->|"renders unavailable state"| node_not_found
node_product_card -->|"offers save action"| node_save_to_list
node_save_to_list -->|"adds product"| node_lists
node_lists_page -->|"manages collections"| node_lists
node_lists_page -->|"opens list"| node_list_detail
node_list_detail -->|"edits products"| node_lists

click node_main "https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/main.jsx"
click node_app "https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/App.jsx"
click node_navbar "https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/Navbar.jsx"
click node_search "https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/SearchBar.jsx"
click node_dashboard "https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/Dashboard.jsx"
click node_sort "https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/hooks/sortProducts.js"
click node_sort_dropdown "https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/SortDropdown.jsx"
click node_product_card "https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/ProductCard.jsx"
click node_not_found "https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/NotFound.jsx"
click node_lists "https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/hooks/useLists.js"
click node_save_to_list "https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/SaveToListButton.jsx"
click node_lists_page "https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/pages/ListsPage.jsx"
click node_list_detail "https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/pages/ListDetailPage.jsx"
click node_server "https://github.com/rip-skillan/scrape-expectations/blob/main/backend/server.js"

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_main,node_app,node_navbar,node_search,node_dashboard,node_sort,node_sort_dropdown,node_product_card,node_not_found,node_lists,node_save_to_list,node_lists_page,node_list_detail toneBlue
class node_server toneAmber
class node_bright_data toneNeutral
```

## Components

### Browser client

React/Vite UI and client-managed saved lists.

- [React entry](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/main.jsx): entry point · `frontend/src/main.jsx`
- [App shell](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/App.jsx): React composition · Owns top-level view composition and navigation. · `frontend/src/App.jsx`
- [Navigation](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/Navbar.jsx): React component · `frontend/src/components/Navbar.jsx`
- [Search bar](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/SearchBar.jsx): React component · `frontend/src/components/SearchBar.jsx`
- [Search dashboard](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/Dashboard.jsx): React component · Combines results, sorting, and product cards. · `frontend/src/components/Dashboard.jsx`
- [Product sorting](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/hooks/sortProducts.js): client hook · Orders results by price or source. · `frontend/src/hooks/sortProducts.js`
- [Sort controls](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/SortDropdown.jsx): React component · `frontend/src/components/SortDropdown.jsx`
- [Product card](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/ProductCard.jsx): React component · `frontend/src/components/ProductCard.jsx`
- [Empty/error state](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/NotFound.jsx): React component · `frontend/src/components/NotFound.jsx`
- [Saved lists state](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/hooks/useLists.js): client hook · Encapsulates list CRUD and client-side storage. · `frontend/src/hooks/useLists.js`
- [Save to list](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/components/SaveToListButton.jsx): React component · `frontend/src/components/SaveToListButton.jsx`
- [Lists page](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/pages/ListsPage.jsx): React page · `frontend/src/pages/ListsPage.jsx`
- [List detail](https://github.com/rip-skillan/scrape-expectations/blob/main/frontend/src/pages/ListDetailPage.jsx): React page · Views and edits products in a selected list. · `frontend/src/pages/ListDetailPage.jsx`

### Scraping backend

Node boundary for external product acquisition.

- [Scraping server](https://github.com/rip-skillan/scrape-expectations/blob/main/backend/server.js): Node.js server · Forwards queries, isolates Bright Data traffic, and shapes product results. · `backend/server.js`

### Other components

- **Bright Data**: external scraping API · External product-data acquisition service.

## Connections

- React entry → App shell: mounts
- App shell → Navigation: renders
- App shell → Search dashboard: shows search view
- App shell → Lists page: shows list views
- Navigation → Search dashboard: navigates
- Navigation → Lists page: navigates
- Search bar → Scraping server: submits query
- Scraping server → Bright Data: scrapes / calls API
- Scraping server → Search dashboard: normalized results
- Search dashboard → Search bar: hosts query UI
- Search dashboard → Product sorting: orders results
- Sort controls → Product sorting: selects mode
- Search dashboard → Sort controls: renders
- Search dashboard → Product card: renders results
- Search dashboard → Empty/error state: renders unavailable state
- Product card → Save to list: offers save action
- Save to list → Saved lists state: adds product
- Lists page → Saved lists state: manages collections
- Lists page → List detail: opens list
- List detail → Saved lists state: edits products
