# iamdineshreddy/localcart-connect architecture

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

- Interactive diagram: https://gitdiagram.com/iamdineshreddy/localcart-connect
- Repository: https://github.com/iamdineshreddy/localcart-connect

## Overview

Local-Kart is a role-based marketplace for buyers, sellers, administrators, and delivery partners. Users enter through authenticated routes, then browse products, manage a cart, and place or track orders; sellers manage listings and submit KYC, while administrators review products, KYC, fraud reports, and analytics. React Query hooks implement the sampled marketplace operations against Supabase. The graph includes documented routes and source-indexed feature areas; unsampled feature implementations are represented by their exact page paths, without inferring their internal calls.

Main entry points: [`src/integrations/supabase/client.ts`](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/integrations/supabase/client.ts) (Supabase client), [`src/App.tsx`](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/App.tsx) (Role-based routes), [`src/pages/seller`](https://github.com/iamdineshreddy/localcart-connect/tree/main/src/pages/seller) (Seller listings and earnings), [`src/pages/buyer`](https://github.com/iamdineshreddy/localcart-connect/tree/main/src/pages/buyer) (Browse and product pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and routing"]
  node_app["Role-based routes<br/>[App.tsx]"]
  node_auth["Authentication<br/>[AuthContext.tsx]"]
end

subgraph group_buyer["Buyer marketplace"]
  node_buyerpages["Browse and product pages"]
  node_cartpage["Cart and checkout<br/>[CartPage.tsx]"]
  node_orderspage["Buyer order history<br/>[OrdersPage.tsx]"]
  node_wishlist["Wishlist<br/>[WishlistPage.tsx]"]
  node_buyerlayout["Buyer navigation<br/>[BuyerLayout.tsx]"]
  node_cart["Cart operations<br/>[useCart.ts]"]
end

subgraph group_seller["Seller operations"]
  node_sellerpages["Seller listings and earnings"]
  node_sellerorders["Seller order management"]
  node_sellerkyc["Seller KYC submission<br/>[KYCPage.tsx]"]
  node_kyc["KYC workflows<br/>[useKYC.ts]"]
  node_sellerlayout["Seller navigation<br/>[SellerLayout.tsx]"]
end

subgraph group_oversight["Administration and delivery"]
  node_adminpages["Admin oversight"]
  node_fraud["Fraud reports<br/>[useFraudReports.ts]"]
  node_delivery["Delivery dashboard"]
end

subgraph group_data["Shared data services"]
  node_products["Product catalog<br/>[useProducts.ts]"]
  node_orders["Order operations<br/>[useOrders.ts]"]
  node_supabase["Supabase client<br/>[client.ts]"]
  node_database[("Supabase backend")]
  node_seedproducts["Product seed data<br/>[products.ts]"]
  node_trust["Seller trust scoring<br/>[useTrustScore.ts]"]
  node_location["User location<br/>[useUserLocation.ts]"]
  node_notifications["Notifications"]
end

node_actors(("Marketplace users"))

node_actors -->|"navigate"| node_app
node_app -->|"provides session"| node_auth
node_app -->|"routes to"| node_buyerpages
node_app -->|"routes to"| node_sellerpages
node_app -->|"routes to"| node_adminpages
node_app -->|"routes to"| node_delivery
node_auth -->|"auth calls"| node_supabase
node_supabase -.->|"queries"| node_database
node_buyerpages -.->|"uses layout"| node_buyerlayout
node_cartpage -->|"reads cart"| node_cart
node_cartpage -->|"places orders"| node_orders
node_buyerpages -->|"loads products"| node_products
node_buyerpages -->|"adds items"| node_cart
node_buyerpages -.->|"manages wishlist"| node_wishlist
node_buyerlayout -->|"shows cart"| node_cart
node_buyerlayout -->|"loads alerts"| node_notifications
node_orderspage -.->|"loads history"| node_orders
node_sellerpages -.->|"manages listings"| node_products
node_sellerpages -->|"uses layout"| node_sellerlayout
node_sellerpages -->|"loads orders"| node_orders
node_sellerpages -->|"loads score"| node_trust
node_sellerpages -->|"checks KYC"| node_kyc
node_sellerkyc -->|"submits documents"| node_kyc
node_sellerorders -.->|"manages orders"| node_orders
node_adminpages -->|"reviews listings"| node_products
node_adminpages -->|"reviews reports"| node_fraud
node_adminpages -.->|"reviews KYC"| node_kyc
node_delivery -->|"loads assignments"| node_orders
node_cart -->|"reads and writes"| node_supabase
node_orders -->|"reads and writes"| node_supabase
node_products -->|"reads and writes"| node_supabase
node_kyc -->|"reads and writes"| node_supabase
node_seedproducts -.->|"supplies catalog"| node_buyerpages
node_trust -.->|"loads trust data"| node_supabase
node_location -->|"supports delivery"| node_cartpage

click node_app "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/App.tsx"
click node_auth "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/contexts/AuthContext.tsx"
click node_buyerpages "https://github.com/iamdineshreddy/localcart-connect/tree/main/src/pages/buyer"
click node_cartpage "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/pages/buyer/CartPage.tsx"
click node_orderspage "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/pages/buyer/OrdersPage.tsx"
click node_wishlist "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/pages/buyer/WishlistPage.tsx"
click node_buyerlayout "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/components/layout/BuyerLayout.tsx"
click node_cart "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useCart.ts"
click node_products "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useProducts.ts"
click node_sellerpages "https://github.com/iamdineshreddy/localcart-connect/tree/main/src/pages/seller"
click node_sellerorders "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/pages/seller/SellerOrdersPage.tsx"
click node_sellerkyc "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/pages/seller/KYCPage.tsx"
click node_kyc "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useKYC.ts"
click node_sellerlayout "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/components/layout/SellerLayout.tsx"
click node_orders "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useOrders.ts"
click node_adminpages "https://github.com/iamdineshreddy/localcart-connect/tree/main/src/pages/admin"
click node_fraud "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useFraudReports.ts"
click node_delivery "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/pages/delivery/DeliveryDashboard.tsx"
click node_supabase "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/integrations/supabase/client.ts"
click node_seedproducts "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/data/products.ts"
click node_trust "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useTrustScore.ts"
click node_location "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useUserLocation.ts"
click node_notifications "https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useNotifications.ts"

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_auth,node_actors toneBlue
class node_buyerpages,node_cartpage,node_orderspage,node_wishlist,node_buyerlayout,node_cart toneAmber
class node_sellerpages,node_sellerorders,node_sellerkyc,node_kyc,node_sellerlayout toneMint
class node_adminpages,node_fraud,node_delivery toneRose
class node_products,node_orders,node_supabase,node_database,node_seedproducts,node_trust,node_location,node_notifications toneIndigo
```

## Components

### Access and routing

- [Role-based routes](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`

### Buyer marketplace

- [Browse and product pages](https://github.com/iamdineshreddy/localcart-connect/tree/main/src/pages/buyer): `src/pages/buyer`
- [Cart and checkout](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/pages/buyer/CartPage.tsx): `src/pages/buyer/CartPage.tsx`
- [Buyer order history](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/pages/buyer/OrdersPage.tsx): `src/pages/buyer/OrdersPage.tsx`
- [Wishlist](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/pages/buyer/WishlistPage.tsx): `src/pages/buyer/WishlistPage.tsx`
- [Buyer navigation](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/components/layout/BuyerLayout.tsx): `src/components/layout/BuyerLayout.tsx`
- [Cart operations](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useCart.ts): `src/hooks/useCart.ts`

### Seller operations

- [Seller listings and earnings](https://github.com/iamdineshreddy/localcart-connect/tree/main/src/pages/seller): `src/pages/seller`
- [Seller order management](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/pages/seller/SellerOrdersPage.tsx): `src/pages/seller/SellerOrdersPage.tsx`
- [Seller KYC submission](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/pages/seller/KYCPage.tsx): `src/pages/seller/KYCPage.tsx`
- [KYC workflows](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useKYC.ts): `src/hooks/useKYC.ts`
- [Seller navigation](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/components/layout/SellerLayout.tsx): `src/components/layout/SellerLayout.tsx`

### Administration and delivery

- [Admin oversight](https://github.com/iamdineshreddy/localcart-connect/tree/main/src/pages/admin): `src/pages/admin`
- [Fraud reports](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useFraudReports.ts): `src/hooks/useFraudReports.ts`
- [Delivery dashboard](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/pages/delivery/DeliveryDashboard.tsx): `src/pages/delivery/DeliveryDashboard.tsx`

### Shared data services

- [Product catalog](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useProducts.ts): `src/hooks/useProducts.ts`
- [Order operations](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useOrders.ts): `src/hooks/useOrders.ts`
- [Supabase client](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- **Supabase backend**
- [Product seed data](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/data/products.ts): `src/data/products.ts`
- [Seller trust scoring](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useTrustScore.ts): `src/hooks/useTrustScore.ts`
- [User location](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useUserLocation.ts): `src/hooks/useUserLocation.ts`
- [Notifications](https://github.com/iamdineshreddy/localcart-connect/blob/main/src/hooks/useNotifications.ts): `src/hooks/useNotifications.ts`

### Other components

- **Marketplace users**

## Connections

- Marketplace users → Role-based routes: navigate (evidence: `src/App.tsx`)
- Role-based routes → Authentication: provides session (evidence: `src/App.tsx`)
- Role-based routes → Browse and product pages: routes to (evidence: `src/App.tsx`)
- Role-based routes → Seller listings and earnings: routes to (evidence: `src/App.tsx`)
- Role-based routes → Admin oversight: routes to (evidence: `src/App.tsx`)
- Role-based routes → Delivery dashboard: routes to (evidence: `src/App.tsx`)
- Authentication → Supabase client: auth calls (evidence: `src/contexts/AuthContext.tsx`)
- Supabase client → Supabase backend: queries
- Browse and product pages → Buyer navigation: uses layout (evidence: `src/pages/buyer/CartPage.tsx`)
- Cart and checkout → Cart operations: reads cart (evidence: `src/pages/buyer/CartPage.tsx`)
- Cart and checkout → Order operations: places orders (evidence: `src/pages/buyer/CartPage.tsx`)
- Browse and product pages → Product catalog: loads products (evidence: `src/pages/buyer/ProductDetailPage.tsx`)
- Browse and product pages → Cart operations: adds items (evidence: `src/pages/buyer/ProductDetailPage.tsx`)
- Browse and product pages → Wishlist: manages wishlist
- Buyer navigation → Cart operations: shows cart (evidence: `src/components/layout/BuyerLayout.tsx`)
- Buyer navigation → Notifications: loads alerts (evidence: `src/components/layout/BuyerLayout.tsx`)
- Buyer order history → Order operations: loads history
- Seller listings and earnings → Product catalog: manages listings (evidence: `src/pages/seller/SellerDashboard.tsx`)
- Seller listings and earnings → Seller navigation: uses layout (evidence: `src/pages/seller/SellerDashboard.tsx`)
- Seller listings and earnings → Order operations: loads orders (evidence: `src/pages/seller/SellerDashboard.tsx`)
- Seller listings and earnings → Seller trust scoring: loads score (evidence: `src/pages/seller/SellerDashboard.tsx`)
- Seller listings and earnings → KYC workflows: checks KYC (evidence: `src/pages/seller/SellerDashboard.tsx`)
- Seller KYC submission → KYC workflows: submits documents (evidence: `src/pages/seller/KYCPage.tsx`)
- Seller order management → Order operations: manages orders
- Admin oversight → Product catalog: reviews listings (evidence: `src/pages/admin/AdminProductsPage.tsx`)
- Admin oversight → Fraud reports: reviews reports (evidence: `src/pages/admin/AdminFraudPage.tsx`)
- Admin oversight → KYC workflows: reviews KYC
- Delivery dashboard → Order operations: loads assignments (evidence: `src/pages/delivery/DeliveryDashboard.tsx`)
- Cart operations → Supabase client: reads and writes (evidence: `src/hooks/useCart.ts`)
- Order operations → Supabase client: reads and writes (evidence: `src/hooks/useOrders.ts`)
- Product catalog → Supabase client: reads and writes (evidence: `src/hooks/useProducts.ts`)
- KYC workflows → Supabase client: reads and writes (evidence: `src/hooks/useKYC.ts`)
- Product seed data → Browse and product pages: supplies catalog
- Seller trust scoring → Supabase client: loads trust data
- User location → Cart and checkout: supports delivery (evidence: `src/pages/buyer/CartPage.tsx`)
