# yash-petkar/agentcart-v2 architecture

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

- Interactive diagram: https://gitdiagram.com/yash-petkar/agentcart-v2
- Repository: https://github.com/yash-petkar/agentcart-v2

## Overview

AgentCart is an AI-assisted e-commerce platform for customers, sellers, and administrators. The customer journey runs from natural-language or conventional product discovery through recommendations and comparison, cart, checkout, payment, and order tracking. Seller tools and admin management form separate branches. The excerpts and README establish the principal routes and backend responsibilities; unsampled implementation details are represented only where documented, so some feature-level links are omitted.

Main entry points: [`server.ts`](https://github.com/yash-petkar/agentcart-v2/blob/main/server.ts) (REST API), [`src/App.tsx`](https://github.com/yash-petkar/agentcart-v2/blob/main/src/App.tsx) (Storefront app), [`src/lib/api.ts`](https://github.com/yash-petkar/agentcart-v2/blob/main/src/lib/api.ts) (API client), [`src/pages/ProductsPage.tsx`](https://github.com/yash-petkar/agentcart-v2/blob/main/src/pages/ProductsPage.tsx) (Product discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer shopping"]
  node_app["Storefront app<br/>[App.tsx]"]
  node_discovery["Product discovery<br/>[ProductsPage.tsx]"]
  node_product_detail["Product details"]
  node_comparison["Product comparison<br/>[CompareModal.tsx]"]
  node_ai_drawer["Shopping assistant"]
  node_cart["Cart<br/>[CartPage.tsx]"]
  node_checkout["Checkout<br/>[CheckoutPage.tsx]"]
  node_orders["Orders and tracking<br/>[OrdersPage.tsx]"]
end

subgraph group_commerce["Commerce backend"]
  node_catalog["Product catalog<br/>[catalogData.ts]"]
  node_more_catalog["Additional catalog data<br/>[moreCatalogData.ts]"]
  node_payment["Payment processing<br/>[razorpay.ts]"]
  node_tracking["Order tracking<br/>[tracking.ts]"]
end

subgraph group_intelligence["AI capabilities"]
  node_ai["Shopping agent<br/>[ai.ts]"]
  node_recommendation["Recommendations and comparison<br/>[recommendation.ts]"]
end

subgraph group_seller_admin["Seller and admin"]
  node_seller_page["Seller dashboard<br/>[SellerPage.tsx]"]
  node_seller_ai["Seller AI tools<br/>[sellerAi.ts]"]
  node_seller_components["Seller AI panels"]
  node_admin["Admin management<br/>[AdminPage.tsx]"]
end

subgraph group_platform["Platform services"]
  node_api["API client<br/>[api.ts]"]
  node_server["REST API<br/>[server.ts]"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_database[("Application database<br/>[db.ts]")]
end

node_customer(("Customer"))
node_razorpay["Razorpay"]

node_customer -->|"uses"| node_app
node_app -->|"routes to"| node_discovery
node_app -->|"routes to"| node_product_detail
node_app -->|"renders"| node_ai_drawer
node_app -->|"routes to"| node_seller_page
node_app -->|"routes to"| node_admin
node_discovery -->|"supports comparing"| node_comparison
node_product_detail -->|"supports comparing"| node_comparison
node_app -->|"manages cart"| node_cart
node_cart -->|"proceeds to"| node_checkout
node_checkout -->|"creates order"| node_orders
node_orders -->|"shows tracking"| node_tracking
node_discovery -.->|"requests products"| node_api
node_product_detail -.->|"requests product"| node_api
node_ai_drawer -->|"sends messages"| node_api
node_checkout -->|"requests checkout"| node_api
node_orders -->|"requests orders"| node_api
node_seller_page -->|"requests seller actions"| node_api
node_api -->|"calls REST API"| node_server
node_server -->|"uses authorization"| node_auth
node_server -->|"reads and writes"| node_database
node_database -->|"loads products"| node_catalog
node_catalog -->|"includes products"| node_more_catalog
node_server -->|"dispatches chat"| node_ai
node_server -->|"generates comparison"| node_recommendation
node_server -->|"dispatches listing tools"| node_seller_ai
node_server -->|"creates and verifies payment"| node_payment
node_payment -.->|"uses gateway"| node_razorpay
node_server -.->|"serves tracking"| node_tracking
node_seller_page -->|"renders panels"| node_seller_components
node_seller_components -.->|"requests AI tools"| node_api

click node_app "https://github.com/yash-petkar/agentcart-v2/blob/main/src/App.tsx"
click node_discovery "https://github.com/yash-petkar/agentcart-v2/blob/main/src/pages/ProductsPage.tsx"
click node_product_detail "https://github.com/yash-petkar/agentcart-v2/blob/main/src/pages/ProductDetailPage.tsx"
click node_comparison "https://github.com/yash-petkar/agentcart-v2/blob/main/src/components/CompareModal.tsx"
click node_ai_drawer "https://github.com/yash-petkar/agentcart-v2/blob/main/src/components/AIAssistantDrawer.tsx"
click node_cart "https://github.com/yash-petkar/agentcart-v2/blob/main/src/pages/CartPage.tsx"
click node_checkout "https://github.com/yash-petkar/agentcart-v2/blob/main/src/pages/CheckoutPage.tsx"
click node_orders "https://github.com/yash-petkar/agentcart-v2/blob/main/src/pages/OrdersPage.tsx"
click node_api "https://github.com/yash-petkar/agentcart-v2/blob/main/src/lib/api.ts"
click node_server "https://github.com/yash-petkar/agentcart-v2/blob/main/server.ts"
click node_auth "https://github.com/yash-petkar/agentcart-v2/blob/main/server/auth.ts"
click node_catalog "https://github.com/yash-petkar/agentcart-v2/blob/main/server/catalogData.ts"
click node_more_catalog "https://github.com/yash-petkar/agentcart-v2/blob/main/server/moreCatalogData.ts"
click node_database "https://github.com/yash-petkar/agentcart-v2/blob/main/server/db.ts"
click node_ai "https://github.com/yash-petkar/agentcart-v2/blob/main/server/ai.ts"
click node_recommendation "https://github.com/yash-petkar/agentcart-v2/blob/main/server/recommendation.ts"
click node_payment "https://github.com/yash-petkar/agentcart-v2/blob/main/server/razorpay.ts"
click node_tracking "https://github.com/yash-petkar/agentcart-v2/blob/main/server/tracking.ts"
click node_seller_page "https://github.com/yash-petkar/agentcart-v2/blob/main/src/pages/SellerPage.tsx"
click node_seller_ai "https://github.com/yash-petkar/agentcart-v2/blob/main/server/sellerAi.ts"
click node_seller_components "https://github.com/yash-petkar/agentcart-v2/tree/main/src/components/seller"
click node_admin "https://github.com/yash-petkar/agentcart-v2/blob/main/src/pages/AdminPage.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_app,node_discovery,node_product_detail,node_comparison,node_ai_drawer,node_cart,node_checkout,node_orders toneBlue
class node_catalog,node_more_catalog,node_payment,node_tracking toneAmber
class node_ai,node_recommendation toneMint
class node_seller_page,node_seller_ai,node_seller_components,node_admin toneRose
class node_api,node_server,node_auth,node_database,node_customer,node_razorpay toneIndigo
```

## Components

### Customer shopping

- [Storefront app](https://github.com/yash-petkar/agentcart-v2/blob/main/src/App.tsx): `src/App.tsx`
- [Product discovery](https://github.com/yash-petkar/agentcart-v2/blob/main/src/pages/ProductsPage.tsx): `src/pages/ProductsPage.tsx`
- [Product details](https://github.com/yash-petkar/agentcart-v2/blob/main/src/pages/ProductDetailPage.tsx): `src/pages/ProductDetailPage.tsx`
- [Product comparison](https://github.com/yash-petkar/agentcart-v2/blob/main/src/components/CompareModal.tsx): `src/components/CompareModal.tsx`
- [Shopping assistant](https://github.com/yash-petkar/agentcart-v2/blob/main/src/components/AIAssistantDrawer.tsx): `src/components/AIAssistantDrawer.tsx`
- [Cart](https://github.com/yash-petkar/agentcart-v2/blob/main/src/pages/CartPage.tsx): `src/pages/CartPage.tsx`
- [Checkout](https://github.com/yash-petkar/agentcart-v2/blob/main/src/pages/CheckoutPage.tsx): `src/pages/CheckoutPage.tsx`
- [Orders and tracking](https://github.com/yash-petkar/agentcart-v2/blob/main/src/pages/OrdersPage.tsx): `src/pages/OrdersPage.tsx`

### Commerce backend

- [Product catalog](https://github.com/yash-petkar/agentcart-v2/blob/main/server/catalogData.ts): `server/catalogData.ts`
- [Additional catalog data](https://github.com/yash-petkar/agentcart-v2/blob/main/server/moreCatalogData.ts): `server/moreCatalogData.ts`
- [Payment processing](https://github.com/yash-petkar/agentcart-v2/blob/main/server/razorpay.ts): `server/razorpay.ts`
- [Order tracking](https://github.com/yash-petkar/agentcart-v2/blob/main/server/tracking.ts): `server/tracking.ts`

### AI capabilities

- [Shopping agent](https://github.com/yash-petkar/agentcart-v2/blob/main/server/ai.ts): `server/ai.ts`
- [Recommendations and comparison](https://github.com/yash-petkar/agentcart-v2/blob/main/server/recommendation.ts): `server/recommendation.ts`

### Seller and admin

- [Seller dashboard](https://github.com/yash-petkar/agentcart-v2/blob/main/src/pages/SellerPage.tsx): `src/pages/SellerPage.tsx`
- [Seller AI tools](https://github.com/yash-petkar/agentcart-v2/blob/main/server/sellerAi.ts): `server/sellerAi.ts`
- [Seller AI panels](https://github.com/yash-petkar/agentcart-v2/tree/main/src/components/seller): `src/components/seller`
- [Admin management](https://github.com/yash-petkar/agentcart-v2/blob/main/src/pages/AdminPage.tsx): `src/pages/AdminPage.tsx`

### Platform services

- [API client](https://github.com/yash-petkar/agentcart-v2/blob/main/src/lib/api.ts): `src/lib/api.ts`
- [REST API](https://github.com/yash-petkar/agentcart-v2/blob/main/server.ts): `server.ts`
- [Authentication](https://github.com/yash-petkar/agentcart-v2/blob/main/server/auth.ts): `server/auth.ts`
- [Application database](https://github.com/yash-petkar/agentcart-v2/blob/main/server/db.ts): `server/db.ts`

### Other components

- **Customer**
- **Razorpay**

## Connections

- Customer → Storefront app: uses (evidence: `README.md`)
- Storefront app → Product discovery: routes to (evidence: `src/App.tsx`)
- Storefront app → Product details: routes to (evidence: `src/App.tsx`)
- Storefront app → Shopping assistant: renders (evidence: `src/App.tsx`)
- Storefront app → Seller dashboard: routes to (evidence: `src/App.tsx`)
- Storefront app → Admin management: routes to (evidence: `src/App.tsx`)
- Product discovery → Product comparison: supports comparing (evidence: `README.md`)
- Product details → Product comparison: supports comparing (evidence: `README.md`)
- Storefront app → Cart: manages cart (evidence: `README.md`)
- Cart → Checkout: proceeds to (evidence: `README.md`)
- Checkout → Orders and tracking: creates order (evidence: `README.md`)
- Orders and tracking → Order tracking: shows tracking (evidence: `README.md`)
- Product discovery → API client: requests products
- Product details → API client: requests product (evidence: `src/pages/ProductDetailPage.tsx`)
- Shopping assistant → API client: sends messages (evidence: `src/lib/api.ts`)
- Checkout → API client: requests checkout (evidence: `src/lib/api.ts`)
- Orders and tracking → API client: requests orders (evidence: `src/lib/api.ts`)
- Seller dashboard → API client: requests seller actions (evidence: `src/lib/api.ts`)
- API client → REST API: calls REST API (evidence: `src/lib/api.ts`)
- REST API → Authentication: uses authorization (evidence: `server.ts`)
- REST API → Application database: reads and writes (evidence: `server.ts`)
- Application database → Product catalog: loads products (evidence: `server/db.ts`)
- Product catalog → Additional catalog data: includes products (evidence: `server/catalogData.ts`)
- REST API → Shopping agent: dispatches chat (evidence: `server.ts`)
- REST API → Recommendations and comparison: generates comparison (evidence: `server.ts`)
- REST API → Seller AI tools: dispatches listing tools (evidence: `server.ts`)
- REST API → Payment processing: creates and verifies payment (evidence: `server.ts`)
- Payment processing → Razorpay: uses gateway
- REST API → Order tracking: serves tracking (evidence: `server.ts`)
- Seller dashboard → Seller AI panels: renders panels (evidence: `src/pages/SellerPage.tsx`)
- Seller AI panels → API client: requests AI tools (evidence: `src/components/seller/AiReviewIntelligence.tsx`)
