# khusshhhhh/newsnt architecture

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

- Interactive diagram: https://gitdiagram.com/khusshhhhh/newsnt
- Repository: https://github.com/khusshhhhh/newsnt

## Overview

Flow is a two-department product-catalog storefront paired with an operational admin and sales CRM. Public visitors browse and search products, inspect details, and submit inquiries or reviews; customers can respond to quotes. Admins manage catalog content, media, and customer-facing submissions, then progress inquiries into quotes and orders. The README documents Supabase as the Postgres, Storage, and Auth backend plus email and daily operations. Some subsystem wiring is inferred only from documented capabilities because its implementation was not sampled.

Main entry points: [`src/lib/supabase/server.ts`](https://github.com/khusshhhhh/newsnt/blob/main/src/lib/supabase/server.ts) (Supabase Postgres), [`src/app/admin/page.tsx`](https://github.com/khusshhhhh/newsnt/blob/main/src/app/admin/page.tsx) (Admin workspace), [`src/app/(public)/[department]/product/[productSlug]/page.tsx`](https://github.com/khusshhhhh/newsnt/blob/main/src/app/(public)/%5Bdepartment%5D/product/%5BproductSlug%5D/page.tsx) (Product detail), [`src/lib/actions/inquiries.ts`](https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/inquiries.ts) (Inquiry submission)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Public storefront"]
  node_catalog["Catalog routes<br/>[page.tsx]"]
  node_browse["Browse listings<br/>[page.tsx]"]
  node_search["Product search<br/>[page.tsx]"]
  node_product["Product detail<br/>[page.tsx]"]
  node_reviews["Review submission"]
end

subgraph group_sales["Inquiry and sales"]
  node_inquiry["Inquiry submission<br/>[inquiries.ts]"]
  node_reviewaction["Review action<br/>[reviews.ts]"]
  node_quoteview["Customer quote<br/>[page.tsx]"]
  node_quoteresponse["Quote response<br/>[quote-response.ts]"]
end

subgraph group_admin["Admin operations"]
  node_adminroutes["Admin workspace<br/>[page.tsx]"]
  node_catalogactions["Catalog management<br/>[products.ts]"]
  node_mediaadmin["Media management"]
  node_pipeline["Inquiry pipeline<br/>[pipeline-board.tsx]"]
  node_quoteadmin["Quote management<br/>[quotes.tsx]"]
  node_orders["Order management<br/>[orders.tsx]"]
  node_moderation["Review moderation<br/>[moderation.ts]"]
end

subgraph group_platform["Backend services"]
  node_auth["Admin authentication<br/>[auth.ts]"]
  node_database[("Supabase Postgres<br/>[server.ts]")]
  node_storage[("Supabase Storage<br/>[storage.ts]")]
  node_email["Email service<br/>[email.ts]"]
  node_cron["Daily operations<br/>[route.ts]"]
end

node_visitor(("Visitor"))
node_adminuser(("Admin user"))

node_visitor -->|"browse"| node_catalog
node_catalog -->|"open listings"| node_browse
node_visitor -->|"search"| node_search
node_visitor -->|"view product"| node_product
node_product -->|"view and submit"| node_reviews
node_reviews -->|"submit review"| node_reviewaction
node_reviewaction -->|"insert pending review"| node_database
node_product -->|"submit inquiry"| node_inquiry
node_inquiry -->|"save inquiry"| node_database
node_inquiry -.->|"notify team"| node_email
node_visitor -->|"open quote token"| node_quoteview
node_quoteview -->|"accept or decline"| node_quoteresponse
node_quoteresponse -->|"update quote"| node_database
node_adminuser -->|"sign in"| node_auth
node_auth -->|"verify admin"| node_database
node_adminuser -->|"manage operations"| node_adminroutes
node_adminroutes -->|"manage catalog"| node_catalogactions
node_catalogactions -->|"read and write catalog"| node_database
node_adminroutes -->|"manage product images"| node_mediaadmin
node_mediaadmin -->|"upload and remove images"| node_storage
node_mediaadmin -->|"save image records"| node_catalogactions
node_adminroutes -->|"manage inquiries"| node_pipeline
node_pipeline -->|"update inquiry status"| node_database
node_adminroutes -->|"manage quotes"| node_quoteadmin
node_quoteadmin -->|"read and write quotes"| node_database
node_quoteadmin -.->|"send customer quote"| node_email
node_adminroutes -->|"manage orders"| node_orders
node_orders -->|"read and write orders"| node_database
node_adminroutes -->|"moderate reviews"| node_moderation
node_moderation -->|"update review status"| node_database
node_cron -->|"retry and prune records"| node_database
node_cron -->|"send daily digest"| node_email

click node_catalog "https://github.com/khusshhhhh/newsnt/blob/main/src/app/(public)/%5Bdepartment%5D/page.tsx"
click node_browse "https://github.com/khusshhhhh/newsnt/blob/main/src/app/(public)/%5Bdepartment%5D/category/%5BcategorySlug%5D/page.tsx"
click node_search "https://github.com/khusshhhhh/newsnt/blob/main/src/app/(public)/%5Bdepartment%5D/search/page.tsx"
click node_product "https://github.com/khusshhhhh/newsnt/blob/main/src/app/(public)/%5Bdepartment%5D/product/%5BproductSlug%5D/page.tsx"
click node_reviews "https://github.com/khusshhhhh/newsnt/blob/main/src/components/reviews-section.tsx"
click node_inquiry "https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/inquiries.ts"
click node_reviewaction "https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/reviews.ts"
click node_quoteview "https://github.com/khusshhhhh/newsnt/blob/main/src/app/quote/%5Btoken%5D/page.tsx"
click node_quoteresponse "https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/quote-response.ts"
click node_adminroutes "https://github.com/khusshhhhh/newsnt/blob/main/src/app/admin/page.tsx"
click node_catalogactions "https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/admin/products.ts"
click node_mediaadmin "https://github.com/khusshhhhh/newsnt/blob/main/src/components/admin/product-image-manager.tsx"
click node_pipeline "https://github.com/khusshhhhh/newsnt/blob/main/src/components/admin/pipeline-board.tsx"
click node_quoteadmin "https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/admin/quotes.tsx"
click node_orders "https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/admin/orders.tsx"
click node_moderation "https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/admin/moderation.ts"
click node_auth "https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/admin/auth.ts"
click node_database "https://github.com/khusshhhhh/newsnt/blob/main/src/lib/supabase/server.ts"
click node_storage "https://github.com/khusshhhhh/newsnt/blob/main/src/lib/supabase/storage.ts"
click node_email "https://github.com/khusshhhhh/newsnt/blob/main/src/lib/email.ts"
click node_cron "https://github.com/khusshhhhh/newsnt/blob/main/src/app/api/cron/daily/route.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_catalog,node_browse,node_search,node_product,node_reviews,node_adminuser toneBlue
class node_inquiry,node_reviewaction,node_quoteview,node_quoteresponse toneAmber
class node_adminroutes,node_catalogactions,node_mediaadmin,node_pipeline,node_quoteadmin,node_orders,node_moderation toneMint
class node_auth,node_database,node_storage,node_email,node_cron toneRose
class node_visitor toneIndigo
```

## Components

### Public storefront

- [Catalog routes](https://github.com/khusshhhhh/newsnt/blob/main/src/app/(public)/%5Bdepartment%5D/page.tsx): `src/app/(public)/[department]/page.tsx`
- [Browse listings](https://github.com/khusshhhhh/newsnt/blob/main/src/app/(public)/%5Bdepartment%5D/category/%5BcategorySlug%5D/page.tsx): `src/app/(public)/[department]/category/[categorySlug]/page.tsx`
- [Product search](https://github.com/khusshhhhh/newsnt/blob/main/src/app/(public)/%5Bdepartment%5D/search/page.tsx): `src/app/(public)/[department]/search/page.tsx`
- [Product detail](https://github.com/khusshhhhh/newsnt/blob/main/src/app/(public)/%5Bdepartment%5D/product/%5BproductSlug%5D/page.tsx): `src/app/(public)/[department]/product/[productSlug]/page.tsx`
- [Review submission](https://github.com/khusshhhhh/newsnt/blob/main/src/components/reviews-section.tsx): `src/components/reviews-section.tsx`

### Inquiry and sales

- [Inquiry submission](https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/inquiries.ts): `src/lib/actions/inquiries.ts`
- [Review action](https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/reviews.ts): `src/lib/actions/reviews.ts`
- [Customer quote](https://github.com/khusshhhhh/newsnt/blob/main/src/app/quote/%5Btoken%5D/page.tsx): `src/app/quote/[token]/page.tsx`
- [Quote response](https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/quote-response.ts): `src/lib/actions/quote-response.ts`

### Admin operations

- [Admin workspace](https://github.com/khusshhhhh/newsnt/blob/main/src/app/admin/page.tsx): `src/app/admin/page.tsx`
- [Catalog management](https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/admin/products.ts): `src/lib/actions/admin/products.ts`
- [Media management](https://github.com/khusshhhhh/newsnt/blob/main/src/components/admin/product-image-manager.tsx): `src/components/admin/product-image-manager.tsx`
- [Inquiry pipeline](https://github.com/khusshhhhh/newsnt/blob/main/src/components/admin/pipeline-board.tsx): `src/components/admin/pipeline-board.tsx`
- [Quote management](https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/admin/quotes.tsx): `src/lib/actions/admin/quotes.tsx`
- [Order management](https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/admin/orders.tsx): `src/lib/actions/admin/orders.tsx`
- [Review moderation](https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/admin/moderation.ts): `src/lib/actions/admin/moderation.ts`

### Backend services

- [Admin authentication](https://github.com/khusshhhhh/newsnt/blob/main/src/lib/actions/admin/auth.ts): `src/lib/actions/admin/auth.ts`
- [Supabase Postgres](https://github.com/khusshhhhh/newsnt/blob/main/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`
- [Supabase Storage](https://github.com/khusshhhhh/newsnt/blob/main/src/lib/supabase/storage.ts): `src/lib/supabase/storage.ts`
- [Email service](https://github.com/khusshhhhh/newsnt/blob/main/src/lib/email.ts): `src/lib/email.ts`
- [Daily operations](https://github.com/khusshhhhh/newsnt/blob/main/src/app/api/cron/daily/route.ts): `src/app/api/cron/daily/route.ts`

### Other components

- **Visitor**
- **Admin user**

## Connections

- Visitor → Catalog routes: browse
- Catalog routes → Browse listings: open listings
- Visitor → Product search: search
- Visitor → Product detail: view product
- Product detail → Review submission: view and submit
- Review submission → Review action: submit review
- Review action → Supabase Postgres: insert pending review
- Product detail → Inquiry submission: submit inquiry
- Inquiry submission → Supabase Postgres: save inquiry
- Inquiry submission → Email service: notify team
- Visitor → Customer quote: open quote token
- Customer quote → Quote response: accept or decline
- Quote response → Supabase Postgres: update quote
- Admin user → Admin authentication: sign in
- Admin authentication → Supabase Postgres: verify admin
- Admin user → Admin workspace: manage operations
- Admin workspace → Catalog management: manage catalog
- Catalog management → Supabase Postgres: read and write catalog
- Admin workspace → Media management: manage product images
- Media management → Supabase Storage: upload and remove images
- Media management → Catalog management: save image records
- Admin workspace → Inquiry pipeline: manage inquiries
- Inquiry pipeline → Supabase Postgres: update inquiry status
- Admin workspace → Quote management: manage quotes
- Quote management → Supabase Postgres: read and write quotes
- Quote management → Email service: send customer quote
- Admin workspace → Order management: manage orders
- Order management → Supabase Postgres: read and write orders
- Admin workspace → Review moderation: moderate reviews
- Review moderation → Supabase Postgres: update review status
- Daily operations → Supabase Postgres: retry and prune records
- Daily operations → Email service: send daily digest
