# aditya7pandey/netr-part2 architecture

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

- Interactive diagram: https://gitdiagram.com/aditya7pandey/netr-part2
- Repository: https://github.com/aditya7pandey/netr-part2

## Overview

Peakfuel’s pipeline turns QuickShelf search results into a trusted analytics brief: the crawler collects resumable page data, validates responses, and runs dataset checks; the API serves dashboard metrics and a tool-using AI ask-box; the React page presents the brief and crawl history. The README documents the end-to-end pipeline and live crawl controls. Source excerpts confirm key API dispatch and metric/tool calls; some UI and crawler internals are indexed but not excerpted, so their finer relationships are omitted.

Main entry points: [`apps/web/src/App.tsx`](https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/App.tsx) (Dashboard shell), [`apps/api/src/server.ts`](https://github.com/aditya7pandey/netr-part2/blob/main/apps/api/src/server.ts) (HTTP API routes), [`apps/crawler/peakfuel_crawler/crawl.py`](https://github.com/aditya7pandey/netr-part2/blob/main/apps/crawler/peakfuel_crawler/crawl.py) (Resumable crawler), [`apps/api/src/metrics.ts`](https://github.com/aditya7pandey/netr-part2/blob/main/apps/api/src/metrics.ts) (Metrics and queries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Collection"]
  node_mock["QuickShelf platform<br/>[quickshelf_mock.py]"]
  node_crawler["Resumable crawler<br/>[crawl.py]"]
  node_crawler_config["Crawler config<br/>[config.py]"]
  node_agent["Crawl control agent<br/>[agent.py]"]
end

subgraph group_data["Data and checks"]
  node_validation["Response validation<br/>[validate.py]"]
  node_checks["Dataset checks<br/>[checks.py]"]
  node_postgres[("Postgres data store")]
  node_dbclient["Shared Prisma client<br/>[index.ts]"]
end

subgraph group_api["Analytics API"]
  node_server["HTTP API routes<br/>[server.ts]"]
  node_metrics["Metrics and queries<br/>[metrics.ts]"]
  node_overview["Brief assembly<br/>[overview.ts]"]
  node_crawlapi["Crawl history and control<br/>[crawl.ts]"]
  node_ask["AI ask agent<br/>[agent.ts]"]
  node_tools["Analytics tools<br/>[tools.ts]"]
  node_groq["Groq model"]
end

subgraph group_web["Dashboard"]
  node_app["Dashboard shell<br/>[App.tsx]"]
  node_coverage["Coverage heatmap<br/>[Coverage.tsx]"]
  node_quality["Quality view<br/>[Quality.tsx]"]
  node_shelf["Search shelf view<br/>[Shelf.tsx]"]
  node_player["Shelf playback<br/>[ShelfPlayer.tsx]"]
  node_shopper["Shopper comparison<br/>[ShopperSaw.tsx]"]
  node_stock["Stock view<br/>[Stock.tsx]"]
  node_crawler_view["Crawl history view<br/>[Crawler.tsx]"]
  node_live["Live crawl screen<br/>[LiveCrawl.tsx]"]
  node_askbox["Ask box<br/>[AskBox.tsx]"]
end

node_manager(("Brand manager"))

node_crawler -->|"fetches pages"| node_mock
node_crawler -->|"validates responses"| node_validation
node_crawler -->|"stores crawl data"| node_postgres
node_checks -->|"checks dataset"| node_postgres
node_crawler -->|"uses settings"| node_crawler_config
node_agent -.->|"runs crawl"| node_crawler
node_agent -->|"uses settings"| node_crawler_config
node_dbclient -->|"connects"| node_postgres
node_server -->|"routes brief"| node_overview
node_server -->|"routes queries"| node_metrics
node_server -->|"routes crawl"| node_crawlapi
node_server -->|"routes questions"| node_ask
node_overview -->|"reads metrics"| node_metrics
node_metrics -->|"queries data"| node_dbclient
node_crawlapi -->|"reads crawl records"| node_dbclient
node_ask -->|"dispatches tools"| node_tools
node_tools -->|"calls queries"| node_metrics
node_ask -->|"requests completion"| node_groq
node_manager -->|"uses dashboard"| node_app
node_app -->|"renders view"| node_coverage
node_app -->|"renders view"| node_quality
node_app -->|"renders view"| node_shelf
node_app -->|"renders view"| node_stock
node_app -->|"renders view"| node_crawler_view
node_app -->|"renders screen"| node_live
node_app -->|"opens ask box"| node_askbox
node_shelf -->|"renders player"| node_player
node_shelf -->|"renders comparison"| node_shopper
node_crawler_view -->|"loads crawl history"| node_crawlapi
node_live -.->|"controls crawl"| node_server
node_askbox -.->|"sends questions"| node_server

click node_mock "https://github.com/aditya7pandey/netr-part2/blob/main/apps/quickshelf/quickshelf_mock.py"
click node_crawler "https://github.com/aditya7pandey/netr-part2/blob/main/apps/crawler/peakfuel_crawler/crawl.py"
click node_crawler_config "https://github.com/aditya7pandey/netr-part2/blob/main/apps/crawler/peakfuel_crawler/config.py"
click node_validation "https://github.com/aditya7pandey/netr-part2/blob/main/apps/crawler/peakfuel_crawler/validate.py"
click node_checks "https://github.com/aditya7pandey/netr-part2/blob/main/apps/crawler/peakfuel_crawler/checks.py"
click node_agent "https://github.com/aditya7pandey/netr-part2/blob/main/apps/crawler/peakfuel_crawler/agent.py"
click node_dbclient "https://github.com/aditya7pandey/netr-part2/blob/main/packages/db/src/index.ts"
click node_server "https://github.com/aditya7pandey/netr-part2/blob/main/apps/api/src/server.ts"
click node_metrics "https://github.com/aditya7pandey/netr-part2/blob/main/apps/api/src/metrics.ts"
click node_overview "https://github.com/aditya7pandey/netr-part2/blob/main/apps/api/src/overview.ts"
click node_crawlapi "https://github.com/aditya7pandey/netr-part2/blob/main/apps/api/src/crawl.ts"
click node_ask "https://github.com/aditya7pandey/netr-part2/blob/main/apps/api/src/ask/agent.ts"
click node_tools "https://github.com/aditya7pandey/netr-part2/blob/main/apps/api/src/ask/tools.ts"
click node_app "https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/App.tsx"
click node_coverage "https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/Coverage.tsx"
click node_quality "https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/Quality.tsx"
click node_shelf "https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/Shelf.tsx"
click node_player "https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/ShelfPlayer.tsx"
click node_shopper "https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/ShopperSaw.tsx"
click node_stock "https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/Stock.tsx"
click node_crawler_view "https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/Crawler.tsx"
click node_live "https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/LiveCrawl.tsx"
click node_askbox "https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/AskBox.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_mock,node_crawler,node_crawler_config,node_agent toneBlue
class node_validation,node_checks,node_postgres,node_dbclient toneAmber
class node_server,node_metrics,node_overview,node_crawlapi,node_ask,node_tools,node_groq toneMint
class node_app,node_coverage,node_quality,node_shelf,node_player,node_shopper,node_stock,node_crawler_view,node_live,node_askbox toneRose
class node_manager toneIndigo
```

## Components

### Collection

- [QuickShelf platform](https://github.com/aditya7pandey/netr-part2/blob/main/apps/quickshelf/quickshelf_mock.py): `apps/quickshelf/quickshelf_mock.py`
- [Resumable crawler](https://github.com/aditya7pandey/netr-part2/blob/main/apps/crawler/peakfuel_crawler/crawl.py): `apps/crawler/peakfuel_crawler/crawl.py`
- [Crawler config](https://github.com/aditya7pandey/netr-part2/blob/main/apps/crawler/peakfuel_crawler/config.py): `apps/crawler/peakfuel_crawler/config.py`
- [Crawl control agent](https://github.com/aditya7pandey/netr-part2/blob/main/apps/crawler/peakfuel_crawler/agent.py): `apps/crawler/peakfuel_crawler/agent.py`

### Data and checks

- [Response validation](https://github.com/aditya7pandey/netr-part2/blob/main/apps/crawler/peakfuel_crawler/validate.py): `apps/crawler/peakfuel_crawler/validate.py`
- [Dataset checks](https://github.com/aditya7pandey/netr-part2/blob/main/apps/crawler/peakfuel_crawler/checks.py): `apps/crawler/peakfuel_crawler/checks.py`
- **Postgres data store**
- [Shared Prisma client](https://github.com/aditya7pandey/netr-part2/blob/main/packages/db/src/index.ts): `packages/db/src/index.ts`

### Analytics API

- [HTTP API routes](https://github.com/aditya7pandey/netr-part2/blob/main/apps/api/src/server.ts): `apps/api/src/server.ts`
- [Metrics and queries](https://github.com/aditya7pandey/netr-part2/blob/main/apps/api/src/metrics.ts): `apps/api/src/metrics.ts`
- [Brief assembly](https://github.com/aditya7pandey/netr-part2/blob/main/apps/api/src/overview.ts): `apps/api/src/overview.ts`
- [Crawl history and control](https://github.com/aditya7pandey/netr-part2/blob/main/apps/api/src/crawl.ts): `apps/api/src/crawl.ts`
- [AI ask agent](https://github.com/aditya7pandey/netr-part2/blob/main/apps/api/src/ask/agent.ts): `apps/api/src/ask/agent.ts`
- [Analytics tools](https://github.com/aditya7pandey/netr-part2/blob/main/apps/api/src/ask/tools.ts): `apps/api/src/ask/tools.ts`
- **Groq model**

### Dashboard

- [Dashboard shell](https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/App.tsx): `apps/web/src/App.tsx`
- [Coverage heatmap](https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/Coverage.tsx): `apps/web/src/Coverage.tsx`
- [Quality view](https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/Quality.tsx): `apps/web/src/Quality.tsx`
- [Search shelf view](https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/Shelf.tsx): `apps/web/src/Shelf.tsx`
- [Shelf playback](https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/ShelfPlayer.tsx): `apps/web/src/ShelfPlayer.tsx`
- [Shopper comparison](https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/ShopperSaw.tsx): `apps/web/src/ShopperSaw.tsx`
- [Stock view](https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/Stock.tsx): `apps/web/src/Stock.tsx`
- [Crawl history view](https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/Crawler.tsx): `apps/web/src/Crawler.tsx`
- [Live crawl screen](https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/LiveCrawl.tsx): `apps/web/src/LiveCrawl.tsx`
- [Ask box](https://github.com/aditya7pandey/netr-part2/blob/main/apps/web/src/AskBox.tsx): `apps/web/src/AskBox.tsx`

### Other components

- **Brand manager**

## Connections

- Resumable crawler → QuickShelf platform: fetches pages
- Resumable crawler → Response validation: validates responses (evidence: `apps/crawler/peakfuel_crawler/crawl.py`)
- Resumable crawler → Postgres data store: stores crawl data
- Dataset checks → Postgres data store: checks dataset
- Resumable crawler → Crawler config: uses settings (evidence: `apps/crawler/peakfuel_crawler/crawl.py`)
- Crawl control agent → Resumable crawler: runs crawl
- Crawl control agent → Crawler config: uses settings (evidence: `apps/crawler/peakfuel_crawler/agent.py`)
- Shared Prisma client → Postgres data store: connects
- HTTP API routes → Brief assembly: routes brief (evidence: `apps/api/src/server.ts`)
- HTTP API routes → Metrics and queries: routes queries (evidence: `apps/api/src/server.ts`)
- HTTP API routes → Crawl history and control: routes crawl (evidence: `apps/api/src/server.ts`)
- HTTP API routes → AI ask agent: routes questions (evidence: `apps/api/src/server.ts`)
- Brief assembly → Metrics and queries: reads metrics (evidence: `apps/api/src/overview.ts`)
- Metrics and queries → Shared Prisma client: queries data (evidence: `apps/api/src/metrics.ts`)
- Crawl history and control → Shared Prisma client: reads crawl records (evidence: `apps/api/src/crawl.ts`)
- AI ask agent → Analytics tools: dispatches tools (evidence: `apps/api/src/ask/agent.ts`)
- Analytics tools → Metrics and queries: calls queries (evidence: `apps/api/src/ask/tools.ts`)
- AI ask agent → Groq model: requests completion (evidence: `apps/api/src/ask/agent.ts`)
- Brand manager → Dashboard shell: uses dashboard
- Dashboard shell → Coverage heatmap: renders view (evidence: `apps/web/src/App.tsx`)
- Dashboard shell → Quality view: renders view (evidence: `apps/web/src/App.tsx`)
- Dashboard shell → Search shelf view: renders view (evidence: `apps/web/src/App.tsx`)
- Dashboard shell → Stock view: renders view (evidence: `apps/web/src/App.tsx`)
- Dashboard shell → Crawl history view: renders view (evidence: `apps/web/src/App.tsx`)
- Dashboard shell → Live crawl screen: renders screen (evidence: `apps/web/src/App.tsx`)
- Dashboard shell → Ask box: opens ask box (evidence: `apps/web/src/App.tsx`)
- Search shelf view → Shelf playback: renders player (evidence: `apps/web/src/Shelf.tsx`)
- Search shelf view → Shopper comparison: renders comparison (evidence: `apps/web/src/Shelf.tsx`)
- Crawl history view → Crawl history and control: loads crawl history (evidence: `apps/web/src/Crawler.tsx`)
- Live crawl screen → HTTP API routes: controls crawl
- Ask box → HTTP API routes: sends questions
