# dhruval12098/admin-hod architecture

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

- Interactive diagram: https://gitdiagram.com/dhruval12098/admin-hod
- Repository: https://github.com/dhruval12098/admin-hod

## Overview

This is a Next.js jewelry-commerce administration application. Staff manage products against a configurable catalog, edit storefront content, and review orders and operational records. The principal workflow is product administration: staff use dashboard editors, API routes authenticate and validate changes, catalog-link helpers maintain related selections, and Supabase stores records. Separate branches cover CMS publishing and order-status updates. The tree documents broad capabilities, while sampled source confirms selected product, catalog, settings, media, and order interactions; unsampled route wiring is represented only at the documented subsystem level.

Main entry points: [`lib/admin-supabase.ts`](https://github.com/dhruval12098/admin-hod/blob/main/lib/admin-supabase.ts) (Supabase), [`app/api/catalog/bootstrap/route.ts`](https://github.com/dhruval12098/admin-hod/blob/main/app/api/catalog/bootstrap/route.ts) (Catalog API), [`lib/cms-auth.ts`](https://github.com/dhruval12098/admin-hod/blob/main/lib/cms-auth.ts) (Admin authorization), [`app/api/products/route.ts`](https://github.com/dhruval12098/admin-hod/blob/main/app/api/products/route.ts) (Product API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_admin["Admin workspace"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_orders_ui["Order dashboard<br/>[orders-client.tsx]"]
  node_orders_api["Order operations<br/>[route.ts]"]
end

subgraph group_product["Product operations"]
  node_product_editor["Product editors"]
  node_product_form["Product form<br/>[product-form.tsx]"]
  node_product_api["Product API<br/>[route.ts]"]
  node_product_detail_api["Product detail API<br/>[route.ts]"]
  node_product_slug_api["Slug editor API<br/>[route.ts]"]
  node_product_links["Catalog links"]
  node_product_editor_data["Editor data loader"]
  node_media_api["Product media<br/>[route.ts]"]
end

subgraph group_catalog["Catalog management"]
  node_catalog_ui["Catalog dashboard<br/>[catalog-client.tsx]"]
  node_catalog_detail["Category editor<br/>[page-client.tsx]"]
  node_catalog_api["Catalog API<br/>[route.ts]"]
  node_catalog_hierarchy["Hierarchy operations"]
  node_catalog_masters["Catalog masters"]
end

subgraph group_content["Storefront content"]
  node_cms_dashboard["CMS editors<br/>[page.tsx]"]
  node_cms_routes["CMS APIs<br/>[route.ts]"]
end

subgraph group_services["Persistence and integrations"]
  node_auth["Admin authorization<br/>[cms-auth.ts]"]
  node_supabase[("Supabase<br/>[admin-supabase.ts]")]
  node_r2[("R2 media storage<br/>[r2.ts]")]
  node_email["Email delivery<br/>[email.ts]"]
end

node_staff(("Admin staff"))

node_staff -->|"uses"| node_dashboard
node_dashboard -->|"opens"| node_product_editor
node_product_editor -->|"edits"| node_product_form
node_product_editor -->|"requests"| node_product_api
node_product_form -->|"submits"| node_product_api
node_product_api -->|"authorizes"| node_auth
node_product_detail_api -->|"authorizes"| node_auth
node_product_slug_api -->|"authorizes"| node_auth
node_product_api -->|"replaces links"| node_product_links
node_product_detail_api -->|"loads and replaces"| node_product_links
node_product_slug_api -->|"loads editor item"| node_product_editor_data
node_product_slug_api -->|"replaces links"| node_product_links
node_product_api -->|"reads and writes"| node_supabase
node_product_detail_api -->|"reads and writes"| node_supabase
node_product_slug_api -->|"reads and writes"| node_supabase
node_product_editor -->|"uploads"| node_media_api
node_media_api -->|"authorizes"| node_auth
node_media_api -->|"stores images"| node_supabase
node_media_api -->|"stores videos"| node_r2
node_staff -->|"manages catalog"| node_catalog_ui
node_catalog_ui -->|"loads catalog"| node_catalog_api
node_catalog_detail -->|"updates hierarchy"| node_catalog_api
node_catalog_api -->|"authorizes"| node_auth
node_catalog_api -->|"loads hierarchy"| node_catalog_hierarchy
node_catalog_api -->|"loads masters"| node_catalog_masters
node_catalog_api -->|"reads catalog"| node_supabase
node_staff -->|"edits content"| node_cms_dashboard
node_cms_dashboard -->|"requests content"| node_cms_routes
node_cms_routes -->|"reads and writes"| node_supabase
node_staff -->|"reviews orders"| node_orders_ui
node_orders_ui -->|"requests updates"| node_orders_api
node_orders_api -->|"authorizes"| node_auth
node_orders_api -->|"loads and updates"| node_supabase
node_orders_api -->|"sends status update"| node_email

click node_dashboard "https://github.com/dhruval12098/admin-hod/blob/main/app/dashboard/page.tsx"
click node_product_editor "https://github.com/dhruval12098/admin-hod/blob/main/app/dashboard/products/products-client.tsx"
click node_product_form "https://github.com/dhruval12098/admin-hod/blob/main/components/product-form.tsx"
click node_product_api "https://github.com/dhruval12098/admin-hod/blob/main/app/api/products/route.ts"
click node_product_detail_api "https://github.com/dhruval12098/admin-hod/blob/main/app/api/products/%5Bid%5D/route.ts"
click node_product_slug_api "https://github.com/dhruval12098/admin-hod/blob/main/app/api/products/by-slug/%5Bslug%5D/route.ts"
click node_product_links "https://github.com/dhruval12098/admin-hod/blob/main/lib/product-catalog-links.ts"
click node_product_editor_data "https://github.com/dhruval12098/admin-hod/blob/main/lib/product-editor-data.ts"
click node_media_api "https://github.com/dhruval12098/admin-hod/blob/main/app/api/products/media/route.ts"
click node_catalog_ui "https://github.com/dhruval12098/admin-hod/blob/main/app/dashboard/catalog/catalog-client.tsx"
click node_catalog_detail "https://github.com/dhruval12098/admin-hod/blob/main/app/dashboard/catalog/%5Bslug%5D/page-client.tsx"
click node_catalog_api "https://github.com/dhruval12098/admin-hod/blob/main/app/api/catalog/bootstrap/route.ts"
click node_catalog_hierarchy "https://github.com/dhruval12098/admin-hod/blob/main/lib/catalog-hierarchy-save.ts"
click node_catalog_masters "https://github.com/dhruval12098/admin-hod/blob/main/lib/catalog-master-save.ts"
click node_cms_dashboard "https://github.com/dhruval12098/admin-hod/blob/main/app/dashboard/cms/page.tsx"
click node_cms_routes "https://github.com/dhruval12098/admin-hod/blob/main/app/api/cms/home/hiphop/route.ts"
click node_orders_ui "https://github.com/dhruval12098/admin-hod/blob/main/app/dashboard/orders/orders-client.tsx"
click node_orders_api "https://github.com/dhruval12098/admin-hod/blob/main/app/api/orders/%5Bid%5D/route.ts"
click node_auth "https://github.com/dhruval12098/admin-hod/blob/main/lib/cms-auth.ts"
click node_supabase "https://github.com/dhruval12098/admin-hod/blob/main/lib/admin-supabase.ts"
click node_r2 "https://github.com/dhruval12098/admin-hod/blob/main/lib/r2.ts"
click node_email "https://github.com/dhruval12098/admin-hod/blob/main/lib/email.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_dashboard,node_orders_ui,node_orders_api toneBlue
class node_product_editor,node_product_form,node_product_api,node_product_detail_api,node_product_slug_api,node_product_links,node_product_editor_data,node_media_api toneAmber
class node_catalog_ui,node_catalog_detail,node_catalog_api,node_catalog_hierarchy,node_catalog_masters toneMint
class node_cms_dashboard,node_cms_routes toneRose
class node_auth,node_supabase,node_r2,node_email,node_staff toneIndigo
```

## Components

### Admin workspace

- [Dashboard](https://github.com/dhruval12098/admin-hod/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Order dashboard](https://github.com/dhruval12098/admin-hod/blob/main/app/dashboard/orders/orders-client.tsx): `app/dashboard/orders/orders-client.tsx`
- [Order operations](https://github.com/dhruval12098/admin-hod/blob/main/app/api/orders/%5Bid%5D/route.ts): `app/api/orders/[id]/route.ts`

### Product operations

- [Product editors](https://github.com/dhruval12098/admin-hod/blob/main/app/dashboard/products/products-client.tsx): `app/dashboard/products/products-client.tsx`
- [Product form](https://github.com/dhruval12098/admin-hod/blob/main/components/product-form.tsx): `components/product-form.tsx`
- [Product API](https://github.com/dhruval12098/admin-hod/blob/main/app/api/products/route.ts): `app/api/products/route.ts`
- [Product detail API](https://github.com/dhruval12098/admin-hod/blob/main/app/api/products/%5Bid%5D/route.ts): `app/api/products/[id]/route.ts`
- [Slug editor API](https://github.com/dhruval12098/admin-hod/blob/main/app/api/products/by-slug/%5Bslug%5D/route.ts): `app/api/products/by-slug/[slug]/route.ts`
- [Catalog links](https://github.com/dhruval12098/admin-hod/blob/main/lib/product-catalog-links.ts): `lib/product-catalog-links.ts`
- [Editor data loader](https://github.com/dhruval12098/admin-hod/blob/main/lib/product-editor-data.ts): `lib/product-editor-data.ts`
- [Product media](https://github.com/dhruval12098/admin-hod/blob/main/app/api/products/media/route.ts): `app/api/products/media/route.ts`

### Catalog management

- [Catalog dashboard](https://github.com/dhruval12098/admin-hod/blob/main/app/dashboard/catalog/catalog-client.tsx): `app/dashboard/catalog/catalog-client.tsx`
- [Category editor](https://github.com/dhruval12098/admin-hod/blob/main/app/dashboard/catalog/%5Bslug%5D/page-client.tsx): `app/dashboard/catalog/[slug]/page-client.tsx`
- [Catalog API](https://github.com/dhruval12098/admin-hod/blob/main/app/api/catalog/bootstrap/route.ts): `app/api/catalog/bootstrap/route.ts`
- [Hierarchy operations](https://github.com/dhruval12098/admin-hod/blob/main/lib/catalog-hierarchy-save.ts): `lib/catalog-hierarchy-save.ts`
- [Catalog masters](https://github.com/dhruval12098/admin-hod/blob/main/lib/catalog-master-save.ts): `lib/catalog-master-save.ts`

### Storefront content

- [CMS editors](https://github.com/dhruval12098/admin-hod/blob/main/app/dashboard/cms/page.tsx): `app/dashboard/cms/page.tsx`
- [CMS APIs](https://github.com/dhruval12098/admin-hod/blob/main/app/api/cms/home/hiphop/route.ts): `app/api/cms/home/hiphop/route.ts`

### Persistence and integrations

- [Admin authorization](https://github.com/dhruval12098/admin-hod/blob/main/lib/cms-auth.ts): `lib/cms-auth.ts`
- [Supabase](https://github.com/dhruval12098/admin-hod/blob/main/lib/admin-supabase.ts): `lib/admin-supabase.ts`
- [R2 media storage](https://github.com/dhruval12098/admin-hod/blob/main/lib/r2.ts): `lib/r2.ts`
- [Email delivery](https://github.com/dhruval12098/admin-hod/blob/main/lib/email.ts): `lib/email.ts`

### Other components

- **Admin staff**

## Connections

- Admin staff → Dashboard: uses
- Dashboard → Product editors: opens
- Product editors → Product form: edits
- Product editors → Product API: requests
- Product form → Product API: submits
- Product API → Admin authorization: authorizes
- Product detail API → Admin authorization: authorizes
- Slug editor API → Admin authorization: authorizes
- Product API → Catalog links: replaces links
- Product detail API → Catalog links: loads and replaces
- Slug editor API → Editor data loader: loads editor item
- Slug editor API → Catalog links: replaces links
- Product API → Supabase: reads and writes
- Product detail API → Supabase: reads and writes
- Slug editor API → Supabase: reads and writes
- Product editors → Product media: uploads
- Product media → Admin authorization: authorizes
- Product media → Supabase: stores images
- Product media → R2 media storage: stores videos
- Admin staff → Catalog dashboard: manages catalog
- Catalog dashboard → Catalog API: loads catalog
- Category editor → Catalog API: updates hierarchy
- Catalog API → Admin authorization: authorizes
- Catalog API → Hierarchy operations: loads hierarchy
- Catalog API → Catalog masters: loads masters
- Catalog API → Supabase: reads catalog
- Admin staff → CMS editors: edits content
- CMS editors → CMS APIs: requests content
- CMS APIs → Supabase: reads and writes
- Admin staff → Order dashboard: reviews orders
- Order dashboard → Order operations: requests updates
- Order operations → Admin authorization: authorizes
- Order operations → Supabase: loads and updates
- Order operations → Email delivery: sends status update
