# abdulalim292/storefront architecture

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

- Interactive diagram: https://gitdiagram.com/abdulalim292/storefront
- Repository: https://github.com/abdulalim292/storefront

## Overview

Noor Alam Machineries is a Next.js equipment and parts storefront. Visitors browse categories or search/filter a paginated catalog, inspect product or equipment details, add items to an inquiry list, and contact the store by WhatsApp or inquiry form; there is no online checkout. A protected admin flow replaces product photos, with overrides stored in Supabase and served back to storefront images. The graph also preserves documented chat, analytics, and SEO capabilities. Relationships are based on README statements and SOURCE INDEX references; unsampled modules and integrations are not assumed to have additional connections.

Main entry points: [`app/page.tsx`](https://github.com/abdulalim292/storefront/blob/main/app/page.tsx) (Home page), [`data/equipment.ts`](https://github.com/abdulalim292/storefront/blob/main/data/equipment.ts) (Equipment catalog data), [`app/products/page.tsx`](https://github.com/abdulalim292/storefront/blob/main/app/products/page.tsx) (Product listing), [`app/products/[id]/page.tsx`](https://github.com/abdulalim292/storefront/blob/main/app/products/%5Bid%5D/page.tsx) (Product detail)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront browsing"]
  node_home["Home page<br/>[page.tsx]"]
  node_category_pages["Category pages<br/>[page.tsx]"]
  node_category_index["Category index<br/>[page.tsx]"]
  node_product_listing["Product listing<br/>[page.tsx]"]
  node_product_detail["Product detail<br/>[page.tsx]"]
  node_detail_client["Detail interactions"]
  node_catalog_ui["Catalog cards and images<br/>[ProductCard.tsx]"]
  node_equipment_carousel["Equipment carousel"]
end

subgraph group_catalog["Catalog domain"]
  node_product_data["Parts catalog data<br/>[products.ts]"]
  node_equipment_data["Equipment catalog data<br/>[equipment.ts]"]
  node_category_data["Category definitions<br/>[categories.ts]"]
  node_branch_data["Branch data<br/>[branches.ts]"]
end

subgraph group_inquiry["Inquiry and contact"]
  node_cart_state["Inquiry list state<br/>[CartContext.tsx]"]
  node_cart_drawer["Inquiry list drawer<br/>[CartDrawer.tsx]"]
  node_contact_form["Contact form<br/>[ContactForm.tsx]"]
  node_inquiry_api["Inquiry endpoint<br/>[route.ts]"]
  node_inquiry_service["Inquiry delivery<br/>[inquiries.ts]"]
  node_chatbot["Storefront chatbot"]
  node_chat_search["Chat search endpoint<br/>[route.ts]"]
end

subgraph group_admin["Photo administration"]
  node_admin_page["Admin product page<br/>[page.tsx]"]
  node_photo_manager["Photo manager"]
  node_admin_session["Admin session endpoint<br/>[route.ts]"]
  node_admin_image_api["Admin image endpoint<br/>[route.ts]"]
  node_image_api["Public image endpoint<br/>[route.ts]"]
  node_image_storage["Image override storage"]
end

subgraph group_shared["Shared runtime"]
  node_product_images["Product image context"]
  node_analytics["Analytics events<br/>[analytics.ts]"]
  node_seo["Structured data<br/>[structured-data.ts]"]
end

node_visitor(("Store visitor"))
node_supabase[("Supabase storage and database")]
node_inquiry_customer(("Inquiry recipient"))
node_webhook{{"Configured webhook"}}

node_visitor -->|"opens"| node_home
node_visitor -->|"browses"| node_category_index
node_visitor -->|"browses"| node_product_listing
node_visitor -->|"opens"| node_product_detail
node_home -->|"renders models"| node_equipment_data
node_home -->|"renders branches"| node_branch_data
node_home -->|"renders"| node_contact_form
node_home -->|"renders"| node_equipment_carousel
node_category_index -->|"reads"| node_category_data
node_category_pages -->|"selects category"| node_category_data
node_category_pages -->|"renders products"| node_catalog_ui
node_product_listing -->|"reads"| node_product_data
node_product_listing -->|"reads"| node_equipment_data
node_product_listing -->|"renders cards"| node_catalog_ui
node_product_detail -->|"loads item"| node_product_data
node_product_detail -->|"loads item"| node_equipment_data
node_product_detail -->|"renders"| node_detail_client
node_detail_client -->|"adds item"| node_cart_state
node_detail_client -->|"tracks views"| node_analytics
node_detail_client -->|"renders image"| node_product_images
node_catalog_ui -->|"adds item"| node_cart_state
node_catalog_ui -->|"resolves image"| node_product_images
node_equipment_carousel -->|"reads models"| node_equipment_data
node_cart_state -->|"tracks additions"| node_analytics
node_cart_drawer -->|"reads and updates"| node_cart_state
node_contact_form -->|"posts inquiry"| node_inquiry_api
node_inquiry_api -->|"delivers inquiry"| node_inquiry_service
node_inquiry_api -.->|"posts payload"| node_webhook
node_inquiry_api -.->|"stores inquiry"| node_inquiry_customer
node_chatbot -.->|"searches catalog"| node_chat_search
node_chat_search -->|"searches"| node_product_data
node_chat_search -->|"searches"| node_equipment_data
node_admin_page -->|"renders"| node_photo_manager
node_photo_manager -->|"authenticates"| node_admin_session
node_photo_manager -->|"uploads photo"| node_admin_image_api
node_photo_manager -->|"refreshes overrides"| node_product_images
node_admin_session -.->|"checks throttling"| node_supabase
node_admin_image_api -->|"saves image"| node_image_storage
node_image_api -->|"loads overrides"| node_image_storage
node_image_storage -->|"reads and writes"| node_supabase
node_product_images -->|"fetches overrides"| node_image_api
node_seo -.->|"builds metadata"| node_product_data

click node_home "https://github.com/abdulalim292/storefront/blob/main/app/page.tsx"
click node_category_pages "https://github.com/abdulalim292/storefront/blob/main/app/categories/%5Bslug%5D/page.tsx"
click node_category_index "https://github.com/abdulalim292/storefront/blob/main/app/categories/page.tsx"
click node_product_listing "https://github.com/abdulalim292/storefront/blob/main/app/products/page.tsx"
click node_product_detail "https://github.com/abdulalim292/storefront/blob/main/app/products/%5Bid%5D/page.tsx"
click node_detail_client "https://github.com/abdulalim292/storefront/blob/main/app/products/%5Bid%5D/ProductDetailClient.tsx"
click node_catalog_ui "https://github.com/abdulalim292/storefront/blob/main/components/ui/ProductCard.tsx"
click node_equipment_carousel "https://github.com/abdulalim292/storefront/blob/main/components/home/EquipmentCarousel.tsx"
click node_cart_state "https://github.com/abdulalim292/storefront/blob/main/context/CartContext.tsx"
click node_cart_drawer "https://github.com/abdulalim292/storefront/blob/main/components/cart/CartDrawer.tsx"
click node_contact_form "https://github.com/abdulalim292/storefront/blob/main/components/chat/ContactForm.tsx"
click node_inquiry_api "https://github.com/abdulalim292/storefront/blob/main/app/api/inquiries/route.ts"
click node_inquiry_service "https://github.com/abdulalim292/storefront/blob/main/lib/inquiries.ts"
click node_chatbot "https://github.com/abdulalim292/storefront/blob/main/components/chat/StorefrontChatbot.tsx"
click node_chat_search "https://github.com/abdulalim292/storefront/blob/main/app/api/chat/search/route.ts"
click node_admin_page "https://github.com/abdulalim292/storefront/blob/main/app/admin/products/page.tsx"
click node_photo_manager "https://github.com/abdulalim292/storefront/blob/main/components/admin/ProductPhotoManager.tsx"
click node_admin_session "https://github.com/abdulalim292/storefront/blob/main/app/api/admin/session/route.ts"
click node_admin_image_api "https://github.com/abdulalim292/storefront/blob/main/app/api/admin/product-images/route.ts"
click node_image_api "https://github.com/abdulalim292/storefront/blob/main/app/api/product-images/route.ts"
click node_image_storage "https://github.com/abdulalim292/storefront/blob/main/lib/product-image-storage.ts"
click node_product_data "https://github.com/abdulalim292/storefront/blob/main/data/products.ts"
click node_equipment_data "https://github.com/abdulalim292/storefront/blob/main/data/equipment.ts"
click node_category_data "https://github.com/abdulalim292/storefront/blob/main/data/categories.ts"
click node_branch_data "https://github.com/abdulalim292/storefront/blob/main/data/branches.ts"
click node_product_images "https://github.com/abdulalim292/storefront/blob/main/context/ProductImageContext.tsx"
click node_analytics "https://github.com/abdulalim292/storefront/blob/main/lib/analytics.ts"
click node_seo "https://github.com/abdulalim292/storefront/blob/main/lib/structured-data.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_home,node_category_pages,node_category_index,node_product_listing,node_product_detail,node_detail_client,node_catalog_ui,node_equipment_carousel toneBlue
class node_product_data,node_equipment_data,node_category_data,node_branch_data,node_supabase toneAmber
class node_cart_state,node_cart_drawer,node_contact_form,node_inquiry_api,node_inquiry_service,node_chatbot,node_chat_search,node_webhook toneMint
class node_admin_page,node_photo_manager,node_admin_session,node_admin_image_api,node_image_api,node_image_storage toneRose
class node_product_images,node_analytics,node_seo,node_visitor,node_inquiry_customer toneIndigo
```

## Components

### Storefront browsing

- [Home page](https://github.com/abdulalim292/storefront/blob/main/app/page.tsx): `app/page.tsx`
- [Category pages](https://github.com/abdulalim292/storefront/blob/main/app/categories/%5Bslug%5D/page.tsx): `app/categories/[slug]/page.tsx`
- [Category index](https://github.com/abdulalim292/storefront/blob/main/app/categories/page.tsx): `app/categories/page.tsx`
- [Product listing](https://github.com/abdulalim292/storefront/blob/main/app/products/page.tsx): `app/products/page.tsx`
- [Product detail](https://github.com/abdulalim292/storefront/blob/main/app/products/%5Bid%5D/page.tsx): `app/products/[id]/page.tsx`
- [Detail interactions](https://github.com/abdulalim292/storefront/blob/main/app/products/%5Bid%5D/ProductDetailClient.tsx): `app/products/[id]/ProductDetailClient.tsx`
- [Catalog cards and images](https://github.com/abdulalim292/storefront/blob/main/components/ui/ProductCard.tsx): `components/ui/ProductCard.tsx`
- [Equipment carousel](https://github.com/abdulalim292/storefront/blob/main/components/home/EquipmentCarousel.tsx): `components/home/EquipmentCarousel.tsx`

### Catalog domain

- [Parts catalog data](https://github.com/abdulalim292/storefront/blob/main/data/products.ts): `data/products.ts`
- [Equipment catalog data](https://github.com/abdulalim292/storefront/blob/main/data/equipment.ts): `data/equipment.ts`
- [Category definitions](https://github.com/abdulalim292/storefront/blob/main/data/categories.ts): `data/categories.ts`
- [Branch data](https://github.com/abdulalim292/storefront/blob/main/data/branches.ts): `data/branches.ts`

### Inquiry and contact

- [Inquiry list state](https://github.com/abdulalim292/storefront/blob/main/context/CartContext.tsx): `context/CartContext.tsx`
- [Inquiry list drawer](https://github.com/abdulalim292/storefront/blob/main/components/cart/CartDrawer.tsx): `components/cart/CartDrawer.tsx`
- [Contact form](https://github.com/abdulalim292/storefront/blob/main/components/chat/ContactForm.tsx): `components/chat/ContactForm.tsx`
- [Inquiry endpoint](https://github.com/abdulalim292/storefront/blob/main/app/api/inquiries/route.ts): `app/api/inquiries/route.ts`
- [Inquiry delivery](https://github.com/abdulalim292/storefront/blob/main/lib/inquiries.ts): `lib/inquiries.ts`
- [Storefront chatbot](https://github.com/abdulalim292/storefront/blob/main/components/chat/StorefrontChatbot.tsx): `components/chat/StorefrontChatbot.tsx`
- [Chat search endpoint](https://github.com/abdulalim292/storefront/blob/main/app/api/chat/search/route.ts): `app/api/chat/search/route.ts`

### Photo administration

- [Admin product page](https://github.com/abdulalim292/storefront/blob/main/app/admin/products/page.tsx): `app/admin/products/page.tsx`
- [Photo manager](https://github.com/abdulalim292/storefront/blob/main/components/admin/ProductPhotoManager.tsx): `components/admin/ProductPhotoManager.tsx`
- [Admin session endpoint](https://github.com/abdulalim292/storefront/blob/main/app/api/admin/session/route.ts): `app/api/admin/session/route.ts`
- [Admin image endpoint](https://github.com/abdulalim292/storefront/blob/main/app/api/admin/product-images/route.ts): `app/api/admin/product-images/route.ts`
- [Public image endpoint](https://github.com/abdulalim292/storefront/blob/main/app/api/product-images/route.ts): `app/api/product-images/route.ts`
- [Image override storage](https://github.com/abdulalim292/storefront/blob/main/lib/product-image-storage.ts): `lib/product-image-storage.ts`

### Shared runtime

- [Product image context](https://github.com/abdulalim292/storefront/blob/main/context/ProductImageContext.tsx): `context/ProductImageContext.tsx`
- [Analytics events](https://github.com/abdulalim292/storefront/blob/main/lib/analytics.ts): `lib/analytics.ts`
- [Structured data](https://github.com/abdulalim292/storefront/blob/main/lib/structured-data.ts): `lib/structured-data.ts`

### Other components

- **Store visitor**
- **Supabase storage and database**
- **Inquiry recipient**
- **Configured webhook**

## Connections

- Store visitor → Home page: opens (evidence: `app/page.tsx`)
- Store visitor → Category index: browses (evidence: `app/categories/page.tsx`)
- Store visitor → Product listing: browses (evidence: `app/products/page.tsx`)
- Store visitor → Product detail: opens (evidence: `app/products/[id]/page.tsx`)
- Home page → Equipment catalog data: renders models (evidence: `app/page.tsx`)
- Home page → Branch data: renders branches (evidence: `app/page.tsx`)
- Home page → Contact form: renders (evidence: `app/page.tsx`)
- Home page → Equipment carousel: renders (evidence: `app/page.tsx`)
- Category index → Category definitions: reads (evidence: `app/categories/page.tsx`)
- Category pages → Category definitions: selects category (evidence: `app/categories/[slug]/page.tsx`)
- Category pages → Catalog cards and images: renders products (evidence: `app/categories/[slug]/page.tsx`)
- Product listing → Parts catalog data: reads (evidence: `app/products/page.tsx`)
- Product listing → Equipment catalog data: reads (evidence: `app/products/page.tsx`)
- Product listing → Catalog cards and images: renders cards (evidence: `app/products/page.tsx`)
- Product detail → Parts catalog data: loads item (evidence: `app/products/[id]/page.tsx`)
- Product detail → Equipment catalog data: loads item (evidence: `app/products/[id]/page.tsx`)
- Product detail → Detail interactions: renders (evidence: `app/products/[id]/page.tsx`)
- Detail interactions → Inquiry list state: adds item (evidence: `app/products/[id]/ProductDetailClient.tsx`)
- Detail interactions → Analytics events: tracks views (evidence: `app/products/[id]/ProductDetailClient.tsx`)
- Detail interactions → Product image context: renders image
- Catalog cards and images → Inquiry list state: adds item (evidence: `components/ui/ProductCard.tsx`)
- Catalog cards and images → Product image context: resolves image
- Equipment carousel → Equipment catalog data: reads models (evidence: `components/home/EquipmentCarousel.tsx`)
- Inquiry list state → Analytics events: tracks additions (evidence: `context/CartContext.tsx`)
- Inquiry list drawer → Inquiry list state: reads and updates (evidence: `components/cart/CartDrawer.tsx`)
- Contact form → Inquiry endpoint: posts inquiry (evidence: `README.md`)
- Inquiry endpoint → Inquiry delivery: delivers inquiry (evidence: `app/api/inquiries/route.ts`)
- Inquiry endpoint → Configured webhook: posts payload (evidence: `README.md`)
- Inquiry endpoint → Inquiry recipient: stores inquiry (evidence: `README.md`)
- Storefront chatbot → Chat search endpoint: searches catalog (evidence: `README.md`)
- Chat search endpoint → Parts catalog data: searches (evidence: `app/api/chat/search/route.ts`)
- Chat search endpoint → Equipment catalog data: searches (evidence: `app/api/chat/search/route.ts`)
- Admin product page → Photo manager: renders (evidence: `app/admin/products/page.tsx`)
- Photo manager → Admin session endpoint: authenticates (evidence: `components/admin/ProductPhotoManager.tsx`)
- Photo manager → Admin image endpoint: uploads photo (evidence: `components/admin/ProductPhotoManager.tsx`)
- Photo manager → Product image context: refreshes overrides (evidence: `components/admin/ProductPhotoManager.tsx`)
- Admin session endpoint → Supabase storage and database: checks throttling (evidence: `README.md`)
- Admin image endpoint → Image override storage: saves image (evidence: `app/api/admin/product-images/route.ts`)
- Public image endpoint → Image override storage: loads overrides (evidence: `app/api/product-images/route.ts`)
- Image override storage → Supabase storage and database: reads and writes (evidence: `lib/product-image-storage.ts`)
- Product image context → Public image endpoint: fetches overrides (evidence: `context/ProductImageContext.tsx`)
- Structured data → Parts catalog data: builds metadata
