# zenithgn/isc301 architecture

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

- Interactive diagram: https://gitdiagram.com/zenithgn/isc301
- Repository: https://github.com/zenithgn/isc301

## Overview

This is a Vietnamese ecommerce web application: shoppers discover products, manage a cart, check out and follow orders; staff manage the catalog, promotions and order operations. The tree also shows account/auth flows, reviews, newsletter, policy content and PayOS payment handling. Sampled evidence is limited: several route and domain modules are indexed but not excerpted, and the README is empty, so uncertain connections are dashed rather than presented as verified calls.

Main entry points: [`web-app/lib/actions/admin/data.ts`](https://github.com/zenithgn/isc301/blob/main/web-app/lib/actions/admin/data.ts) (Admin Data Queries), [`web-app/components/admin`](https://github.com/zenithgn/isc301/tree/main/web-app/components/admin) (Admin Managers), [`web-app/app/(shop)/san-pham/[slug]/page.tsx`](https://github.com/zenithgn/isc301/blob/main/web-app/app/(shop)/san-pham/%5Bslug%5D/page.tsx) (Product Details), [`web-app/components/cart/CartView.tsx`](https://github.com/zenithgn/isc301/blob/main/web-app/components/cart/CartView.tsx) (Cart)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_catalog["Browse and Search"]
  node_product["Product Details<br/>[page.tsx]"]
  node_reviews["Product Reviews<br/>[ProductReviews.tsx]"]
  node_newsletter["Newsletter<br/>[newsletter.ts]"]
end

subgraph group_purchase["Purchase and Orders"]
  node_cart["Cart<br/>[CartView.tsx]"]
  node_checkout["Checkout<br/>[CheckoutForm.tsx]"]
  node_payment["PayOS Payments<br/>[payos.ts]"]
  node_payment_routes["Payment Callbacks"]
  node_orders["Customer Orders<br/>[customer-orders.ts]"]
end

subgraph group_identity["Identity and Accounts"]
  node_account["Account and Auth<br/>[auth.ts]"]
  node_auth_helpers["Session and Guards<br/>[auth.ts]"]
end

subgraph group_operations["Store Operations"]
  node_admin_ui["Admin Console"]
  node_admin_managers["Admin Managers"]
  node_admin_actions["Admin Actions"]
  node_admin_data["Admin Data Queries<br/>[data.ts]"]
  node_admin_helpers["Admin Query Helpers<br/>[shared.ts]"]
end

subgraph group_platform["Data and Integrations"]
  node_supabase_server["Server Supabase Client<br/>[server.ts]"]
  node_supabase_admin["Privileged Supabase Client<br/>[admin.ts]"]
  node_database[("Supabase Database")]
  node_session_middleware["Session Middleware<br/>[middleware.ts]"]
  node_middleware["Request Middleware<br/>[middleware.ts]"]
end

node_shopper(("Shopper"))
node_payos_service["PayOS"]

node_shopper -.->|"browses"| node_catalog
node_catalog -.->|"opens product"| node_product
node_product -.->|"adds items"| node_cart
node_product -.->|"shows reviews"| node_reviews
node_shopper -.->|"subscribes"| node_newsletter
node_shopper -.->|"manages cart"| node_cart
node_cart -.->|"continues to"| node_checkout
node_checkout -.->|"initiates payment"| node_payment
node_payment -.->|"uses gateway"| node_payos_service
node_payment_routes -.->|"handles callbacks"| node_payment
node_shopper -.->|"authenticates"| node_account
node_account -.->|"uses session"| node_auth_helpers
node_auth_helpers -->|"creates client"| node_supabase_server
node_middleware -->|"updates session"| node_session_middleware
node_admin_ui -.->|"renders"| node_admin_managers
node_admin_managers -.->|"submits changes"| node_admin_actions
node_admin_managers -->|"uses form helpers"| node_admin_managers
node_admin_ui -.->|"loads data"| node_admin_data
node_admin_actions -.->|"reads and writes"| node_admin_data
node_admin_data -->|"uses helpers"| node_admin_helpers
node_admin_data -->|"queries with"| node_supabase_server
node_admin_data -->|"queries with"| node_supabase_admin
node_supabase_server -.->|"reads and writes"| node_database
node_supabase_admin -.->|"reads and writes"| node_database
node_session_middleware -.->|"checks session"| node_database
node_shopper -.->|"tracks orders"| node_orders

click node_catalog "https://github.com/zenithgn/isc301/tree/main/web-app/app/(shop)"
click node_product "https://github.com/zenithgn/isc301/blob/main/web-app/app/(shop)/san-pham/%5Bslug%5D/page.tsx"
click node_reviews "https://github.com/zenithgn/isc301/blob/main/web-app/components/ProductReviews.tsx"
click node_newsletter "https://github.com/zenithgn/isc301/blob/main/web-app/lib/actions/newsletter.ts"
click node_cart "https://github.com/zenithgn/isc301/blob/main/web-app/components/cart/CartView.tsx"
click node_checkout "https://github.com/zenithgn/isc301/blob/main/web-app/components/checkout/CheckoutForm.tsx"
click node_payment "https://github.com/zenithgn/isc301/blob/main/web-app/lib/payos.ts"
click node_payment_routes "https://github.com/zenithgn/isc301/tree/main/web-app/app/api/payos"
click node_orders "https://github.com/zenithgn/isc301/blob/main/web-app/lib/actions/customer-orders.ts"
click node_account "https://github.com/zenithgn/isc301/blob/main/web-app/lib/actions/auth.ts"
click node_auth_helpers "https://github.com/zenithgn/isc301/blob/main/web-app/lib/auth.ts"
click node_admin_ui "https://github.com/zenithgn/isc301/tree/main/web-app/app/admin"
click node_admin_managers "https://github.com/zenithgn/isc301/tree/main/web-app/components/admin"
click node_admin_actions "https://github.com/zenithgn/isc301/tree/main/web-app/lib/actions/admin"
click node_admin_data "https://github.com/zenithgn/isc301/blob/main/web-app/lib/actions/admin/data.ts"
click node_admin_helpers "https://github.com/zenithgn/isc301/blob/main/web-app/lib/actions/admin/shared.ts"
click node_supabase_server "https://github.com/zenithgn/isc301/blob/main/web-app/lib/supabase/server.ts"
click node_supabase_admin "https://github.com/zenithgn/isc301/blob/main/web-app/lib/supabase/admin.ts"
click node_session_middleware "https://github.com/zenithgn/isc301/blob/main/web-app/lib/supabase/middleware.ts"
click node_middleware "https://github.com/zenithgn/isc301/blob/main/web-app/middleware.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_product,node_reviews,node_newsletter toneBlue
class node_cart,node_checkout,node_payment,node_payment_routes,node_orders toneAmber
class node_account,node_auth_helpers toneMint
class node_admin_ui,node_admin_managers,node_admin_actions,node_admin_data,node_admin_helpers toneRose
class node_supabase_server,node_supabase_admin,node_database,node_session_middleware,node_middleware,node_shopper,node_payos_service toneIndigo
```

## Components

### Storefront

- [Browse and Search](https://github.com/zenithgn/isc301/tree/main/web-app/app/(shop)): `web-app/app/(shop)`
- [Product Details](https://github.com/zenithgn/isc301/blob/main/web-app/app/(shop)/san-pham/%5Bslug%5D/page.tsx): `web-app/app/(shop)/san-pham/[slug]/page.tsx`
- [Product Reviews](https://github.com/zenithgn/isc301/blob/main/web-app/components/ProductReviews.tsx): `web-app/components/ProductReviews.tsx`
- [Newsletter](https://github.com/zenithgn/isc301/blob/main/web-app/lib/actions/newsletter.ts): `web-app/lib/actions/newsletter.ts`

### Purchase and Orders

- [Cart](https://github.com/zenithgn/isc301/blob/main/web-app/components/cart/CartView.tsx): `web-app/components/cart/CartView.tsx`
- [Checkout](https://github.com/zenithgn/isc301/blob/main/web-app/components/checkout/CheckoutForm.tsx): `web-app/components/checkout/CheckoutForm.tsx`
- [PayOS Payments](https://github.com/zenithgn/isc301/blob/main/web-app/lib/payos.ts): `web-app/lib/payos.ts`
- [Payment Callbacks](https://github.com/zenithgn/isc301/tree/main/web-app/app/api/payos): `web-app/app/api/payos`
- [Customer Orders](https://github.com/zenithgn/isc301/blob/main/web-app/lib/actions/customer-orders.ts): `web-app/lib/actions/customer-orders.ts`

### Identity and Accounts

- [Account and Auth](https://github.com/zenithgn/isc301/blob/main/web-app/lib/actions/auth.ts): `web-app/lib/actions/auth.ts`
- [Session and Guards](https://github.com/zenithgn/isc301/blob/main/web-app/lib/auth.ts): `web-app/lib/auth.ts`

### Store Operations

- [Admin Console](https://github.com/zenithgn/isc301/tree/main/web-app/app/admin): `web-app/app/admin`
- [Admin Managers](https://github.com/zenithgn/isc301/tree/main/web-app/components/admin): `web-app/components/admin`
- [Admin Actions](https://github.com/zenithgn/isc301/tree/main/web-app/lib/actions/admin): `web-app/lib/actions/admin`
- [Admin Data Queries](https://github.com/zenithgn/isc301/blob/main/web-app/lib/actions/admin/data.ts): `web-app/lib/actions/admin/data.ts`
- [Admin Query Helpers](https://github.com/zenithgn/isc301/blob/main/web-app/lib/actions/admin/shared.ts): `web-app/lib/actions/admin/shared.ts`

### Data and Integrations

- [Server Supabase Client](https://github.com/zenithgn/isc301/blob/main/web-app/lib/supabase/server.ts): `web-app/lib/supabase/server.ts`
- [Privileged Supabase Client](https://github.com/zenithgn/isc301/blob/main/web-app/lib/supabase/admin.ts): `web-app/lib/supabase/admin.ts`
- **Supabase Database**
- [Session Middleware](https://github.com/zenithgn/isc301/blob/main/web-app/lib/supabase/middleware.ts): `web-app/lib/supabase/middleware.ts`
- [Request Middleware](https://github.com/zenithgn/isc301/blob/main/web-app/middleware.ts): `web-app/middleware.ts`

### Other components

- **Shopper**
- **PayOS**

## Connections

- Shopper → Browse and Search: browses
- Browse and Search → Product Details: opens product
- Product Details → Cart: adds items
- Product Details → Product Reviews: shows reviews
- Shopper → Newsletter: subscribes
- Shopper → Cart: manages cart
- Cart → Checkout: continues to
- Checkout → PayOS Payments: initiates payment
- PayOS Payments → PayOS: uses gateway
- Payment Callbacks → PayOS Payments: handles callbacks
- Shopper → Account and Auth: authenticates
- Account and Auth → Session and Guards: uses session
- Session and Guards → Server Supabase Client: creates client (evidence: `web-app/lib/auth.ts`)
- Request Middleware → Session Middleware: updates session (evidence: `web-app/middleware.ts`)
- Admin Console → Admin Managers: renders
- Admin Managers → Admin Actions: submits changes
- Admin Managers → Admin Managers: uses form helpers (evidence: `web-app/components/admin/BannerManager.tsx`)
- Admin Console → Admin Data Queries: loads data
- Admin Actions → Admin Data Queries: reads and writes (evidence: `web-app/lib/actions/admin/data.ts`)
- Admin Data Queries → Admin Query Helpers: uses helpers (evidence: `web-app/lib/actions/admin/data.ts`)
- Admin Data Queries → Server Supabase Client: queries with (evidence: `web-app/lib/actions/admin/data.ts`)
- Admin Data Queries → Privileged Supabase Client: queries with (evidence: `web-app/lib/actions/admin/data.ts`)
- Server Supabase Client → Supabase Database: reads and writes
- Privileged Supabase Client → Supabase Database: reads and writes
- Session Middleware → Supabase Database: checks session
- Shopper → Customer Orders: tracks orders
