# iyiu9akhan/pizzahub architecture

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

- Interactive diagram: https://gitdiagram.com/iyiu9akhan/pizzahub
- Repository: https://github.com/iyiu9akhan/pizzahub

## Overview

PizzaHub is a role-based pizza ordering platform. Customers browse and review items, place and track orders, and manage a profile; vendors manage menus and incoming orders, with Premium upgrades; admins moderate users and items and inspect transactions. The Next.js app uses Better Auth and server-side API helpers to connect the user experience to a separately maintained Express/MongoDB backend, plus Stripe and ImgBB. Backend request details and several dashboard implementations were not sampled, so those links are grounded in README descriptions rather than inspected handlers.

Main entry points: [`app/menu/page.tsx`](https://github.com/iyiu9akhan/pizzahub/blob/main/app/menu/page.tsx) (Menu browsing), [`app/dashboard`](https://github.com/iyiu9akhan/pizzahub/tree/main/app/dashboard) (Vendor dashboard), [`app/dashboard/customer/page.tsx`](https://github.com/iyiu9akhan/pizzahub/blob/main/app/dashboard/customer/page.tsx) (Customer dashboard), [`app/dashboard/admin/page.tsx`](https://github.com/iyiu9akhan/pizzahub/blob/main/app/dashboard/admin/page.tsx) (Admin dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public discovery"]
  node_home["Home and featured menu<br/>[page.tsx]"]
  node_menu["Menu browsing<br/>[page.tsx]"]
  node_menu_browser["Search and filters<br/>[MenuBrowser.tsx]"]
  node_item_detail["Item details"]
  node_reviews["Item reviews"]
end

subgraph group_identity["Identity and access"]
  node_auth_pages["Login and registration<br/>[AuthLayout.tsx]"]
  node_auth_client["Auth client<br/>[auth-client.ts]"]
  node_auth_server["Auth and sessions<br/>[auth.ts]"]
end

subgraph group_customer["Customer experience"]
  node_customer_dashboard["Customer dashboard<br/>[page.tsx]"]
  node_customer_orders["Order history<br/>[page.tsx]"]
  node_wishlist["Wishlist<br/>[wishlist.ts]"]
end

subgraph group_operations["Vendor and admin operations"]
  node_vendor_dashboard["Vendor dashboard"]
  node_item_management["Menu item management<br/>[ItemActions.ts]"]
  node_order_management["Incoming order management<br/>[ManageOrders.tsx]"]
  node_admin_dashboard["Admin dashboard<br/>[page.tsx]"]
  node_admin_controls["User and item moderation"]
  node_transactions["Platform transactions"]
end

subgraph group_services["Integrations and data access"]
  node_server_access["Role and API access<br/>[server.ts]"]
  node_order_api["Order data access<br/>[orders.ts]"]
  node_backend["PizzaHub API"]
  node_database[("MongoDB<br/>[mongodb.ts]")]
  node_checkout["Checkout session route<br/>[route.ts]"]
  node_stripe["Stripe"]
  node_webhook["Payment webhook<br/>[route.ts]"]
  node_image_upload["Image upload route<br/>[route.ts]"]
  node_imgbb["ImgBB hosting<br/>[imgbb.ts]"]
end

node_visitor(("Visitor or customer"))

node_visitor -->|"opens"| node_home
node_visitor -->|"browses"| node_menu
node_home -->|"features items"| node_menu
node_menu -->|"renders"| node_menu_browser
node_menu -.->|"opens item"| node_item_detail
node_menu -->|"fetches items"| node_backend
node_item_detail -->|"renders"| node_reviews
node_reviews -->|"submits reviews"| node_backend
node_visitor -->|"signs in"| node_auth_pages
node_auth_pages -->|"uses"| node_auth_client
node_auth_client -->|"configures client"| node_auth_server
node_auth_server -->|"persists auth"| node_database
node_customer_dashboard -->|"requires role"| node_server_access
node_customer_dashboard -->|"loads orders"| node_order_api
node_customer_dashboard -->|"loads statistics"| node_backend
node_customer_orders -->|"loads history"| node_order_api
node_visitor -.->|"places orders"| node_backend
node_visitor -.->|"manages wishlist"| node_wishlist
node_vendor_dashboard -->|"manages items"| node_item_management
node_vendor_dashboard -->|"handles orders"| node_order_management
node_vendor_dashboard -->|"starts upgrade"| node_checkout
node_checkout -->|"creates session"| node_stripe
node_stripe -->|"sends event"| node_webhook
node_webhook -->|"records payment"| node_database
node_vendor_dashboard -->|"uploads images"| node_image_upload
node_image_upload -->|"uploads image"| node_imgbb
node_admin_dashboard -->|"requires role"| node_server_access
node_admin_dashboard -->|"provides controls"| node_admin_controls
node_admin_dashboard -->|"views transactions"| node_transactions
node_item_management -.->|"manages catalog"| node_backend
node_order_management -.->|"updates orders"| node_backend
node_admin_controls -.->|"moderates platform"| node_backend
node_order_api -->|"fetches orders"| node_backend

click node_home "https://github.com/iyiu9akhan/pizzahub/blob/main/app/(home)/page.tsx"
click node_menu "https://github.com/iyiu9akhan/pizzahub/blob/main/app/menu/page.tsx"
click node_menu_browser "https://github.com/iyiu9akhan/pizzahub/blob/main/components/menu/browse/MenuBrowser.tsx"
click node_item_detail "https://github.com/iyiu9akhan/pizzahub/blob/main/components/menu/details/MenuItemDetails.tsx"
click node_reviews "https://github.com/iyiu9akhan/pizzahub/blob/main/components/menu/details/ItemReviewsSection.tsx"
click node_auth_pages "https://github.com/iyiu9akhan/pizzahub/blob/main/components/auth/AuthLayout.tsx"
click node_auth_client "https://github.com/iyiu9akhan/pizzahub/blob/main/lib/auth-client.ts"
click node_auth_server "https://github.com/iyiu9akhan/pizzahub/blob/main/lib/auth.ts"
click node_server_access "https://github.com/iyiu9akhan/pizzahub/blob/main/lib/core/server.ts"
click node_customer_dashboard "https://github.com/iyiu9akhan/pizzahub/blob/main/app/dashboard/customer/page.tsx"
click node_customer_orders "https://github.com/iyiu9akhan/pizzahub/blob/main/app/dashboard/customer/my-orders/page.tsx"
click node_wishlist "https://github.com/iyiu9akhan/pizzahub/blob/main/lib/api/wishlist.ts"
click node_order_api "https://github.com/iyiu9akhan/pizzahub/blob/main/lib/api/orders.ts"
click node_vendor_dashboard "https://github.com/iyiu9akhan/pizzahub/tree/main/app/dashboard"
click node_item_management "https://github.com/iyiu9akhan/pizzahub/blob/main/lib/actions/ItemActions.ts"
click node_order_management "https://github.com/iyiu9akhan/pizzahub/blob/main/components/dashboard/admin/orders/ManageOrders.tsx"
click node_admin_dashboard "https://github.com/iyiu9akhan/pizzahub/blob/main/app/dashboard/admin/page.tsx"
click node_admin_controls "https://github.com/iyiu9akhan/pizzahub/tree/main/app/dashboard/admin"
click node_transactions "https://github.com/iyiu9akhan/pizzahub/blob/main/components/dashboard/admin/transactions/ManageTransactions.tsx"
click node_database "https://github.com/iyiu9akhan/pizzahub/blob/main/lib/mongodb.ts"
click node_checkout "https://github.com/iyiu9akhan/pizzahub/blob/main/app/api/checkout_sessions/route.ts"
click node_webhook "https://github.com/iyiu9akhan/pizzahub/blob/main/app/api/webhook/route.ts"
click node_image_upload "https://github.com/iyiu9akhan/pizzahub/blob/main/app/api/upload/route.ts"
click node_imgbb "https://github.com/iyiu9akhan/pizzahub/blob/main/lib/core/imgbb.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_menu,node_menu_browser,node_item_detail,node_reviews toneBlue
class node_auth_pages,node_auth_client,node_auth_server toneAmber
class node_customer_dashboard,node_customer_orders,node_wishlist toneMint
class node_vendor_dashboard,node_item_management,node_order_management,node_admin_dashboard,node_admin_controls,node_transactions toneRose
class node_server_access,node_order_api,node_backend,node_database,node_checkout,node_stripe,node_webhook,node_image_upload,node_imgbb,node_visitor toneIndigo
```

## Components

### Public discovery

- [Home and featured menu](https://github.com/iyiu9akhan/pizzahub/blob/main/app/(home)/page.tsx): `app/(home)/page.tsx`
- [Menu browsing](https://github.com/iyiu9akhan/pizzahub/blob/main/app/menu/page.tsx): `app/menu/page.tsx`
- [Search and filters](https://github.com/iyiu9akhan/pizzahub/blob/main/components/menu/browse/MenuBrowser.tsx): `components/menu/browse/MenuBrowser.tsx`
- [Item details](https://github.com/iyiu9akhan/pizzahub/blob/main/components/menu/details/MenuItemDetails.tsx): `components/menu/details/MenuItemDetails.tsx`
- [Item reviews](https://github.com/iyiu9akhan/pizzahub/blob/main/components/menu/details/ItemReviewsSection.tsx): `components/menu/details/ItemReviewsSection.tsx`

### Identity and access

- [Login and registration](https://github.com/iyiu9akhan/pizzahub/blob/main/components/auth/AuthLayout.tsx): `components/auth/AuthLayout.tsx`
- [Auth client](https://github.com/iyiu9akhan/pizzahub/blob/main/lib/auth-client.ts): `lib/auth-client.ts`
- [Auth and sessions](https://github.com/iyiu9akhan/pizzahub/blob/main/lib/auth.ts): `lib/auth.ts`

### Customer experience

- [Customer dashboard](https://github.com/iyiu9akhan/pizzahub/blob/main/app/dashboard/customer/page.tsx): `app/dashboard/customer/page.tsx`
- [Order history](https://github.com/iyiu9akhan/pizzahub/blob/main/app/dashboard/customer/my-orders/page.tsx): `app/dashboard/customer/my-orders/page.tsx`
- [Wishlist](https://github.com/iyiu9akhan/pizzahub/blob/main/lib/api/wishlist.ts): `lib/api/wishlist.ts`

### Vendor and admin operations

- [Vendor dashboard](https://github.com/iyiu9akhan/pizzahub/tree/main/app/dashboard): `app/dashboard`
- [Menu item management](https://github.com/iyiu9akhan/pizzahub/blob/main/lib/actions/ItemActions.ts): `lib/actions/ItemActions.ts`
- [Incoming order management](https://github.com/iyiu9akhan/pizzahub/blob/main/components/dashboard/admin/orders/ManageOrders.tsx): `components/dashboard/admin/orders/ManageOrders.tsx`
- [Admin dashboard](https://github.com/iyiu9akhan/pizzahub/blob/main/app/dashboard/admin/page.tsx): `app/dashboard/admin/page.tsx`
- [User and item moderation](https://github.com/iyiu9akhan/pizzahub/tree/main/app/dashboard/admin): `app/dashboard/admin`
- [Platform transactions](https://github.com/iyiu9akhan/pizzahub/blob/main/components/dashboard/admin/transactions/ManageTransactions.tsx): `components/dashboard/admin/transactions/ManageTransactions.tsx`

### Integrations and data access

- [Role and API access](https://github.com/iyiu9akhan/pizzahub/blob/main/lib/core/server.ts): `lib/core/server.ts`
- [Order data access](https://github.com/iyiu9akhan/pizzahub/blob/main/lib/api/orders.ts): `lib/api/orders.ts`
- **PizzaHub API**
- [MongoDB](https://github.com/iyiu9akhan/pizzahub/blob/main/lib/mongodb.ts): `lib/mongodb.ts`
- [Checkout session route](https://github.com/iyiu9akhan/pizzahub/blob/main/app/api/checkout_sessions/route.ts): `app/api/checkout_sessions/route.ts`
- **Stripe**
- [Payment webhook](https://github.com/iyiu9akhan/pizzahub/blob/main/app/api/webhook/route.ts): `app/api/webhook/route.ts`
- [Image upload route](https://github.com/iyiu9akhan/pizzahub/blob/main/app/api/upload/route.ts): `app/api/upload/route.ts`
- [ImgBB hosting](https://github.com/iyiu9akhan/pizzahub/blob/main/lib/core/imgbb.ts): `lib/core/imgbb.ts`

### Other components

- **Visitor or customer**

## Connections

- Visitor or customer → Home and featured menu: opens (evidence: `app/(home)/page.tsx`)
- Visitor or customer → Menu browsing: browses (evidence: `app/menu/page.tsx`)
- Home and featured menu → Menu browsing: features items (evidence: `app/(home)/page.tsx`)
- Menu browsing → Search and filters: renders (evidence: `app/menu/page.tsx`)
- Menu browsing → Item details: opens item
- Menu browsing → PizzaHub API: fetches items (evidence: `app/menu/page.tsx`)
- Item details → Item reviews: renders (evidence: `components/menu/details/ItemReviewsSection.tsx`)
- Item reviews → PizzaHub API: submits reviews
- Visitor or customer → Login and registration: signs in
- Login and registration → Auth client: uses (evidence: `app/login/page.tsx`)
- Auth client → Auth and sessions: configures client (evidence: `lib/auth-client.ts`)
- Auth and sessions → MongoDB: persists auth (evidence: `lib/auth.ts`)
- Customer dashboard → Role and API access: requires role (evidence: `app/dashboard/customer/page.tsx`)
- Customer dashboard → Order data access: loads orders (evidence: `app/dashboard/customer/page.tsx`)
- Customer dashboard → PizzaHub API: loads statistics (evidence: `app/dashboard/customer/page.tsx`)
- Order history → Order data access: loads history (evidence: `app/dashboard/customer/my-orders/page.tsx`)
- Visitor or customer → PizzaHub API: places orders
- Visitor or customer → Wishlist: manages wishlist
- Vendor dashboard → Menu item management: manages items (evidence: `README.md`)
- Vendor dashboard → Incoming order management: handles orders (evidence: `README.md`)
- Vendor dashboard → Checkout session route: starts upgrade (evidence: `README.md`)
- Checkout session route → Stripe: creates session (evidence: `app/api/checkout_sessions/route.ts`)
- Stripe → Payment webhook: sends event (evidence: `README.md`)
- Payment webhook → MongoDB: records payment (evidence: `app/api/webhook/route.ts`)
- Vendor dashboard → Image upload route: uploads images (evidence: `README.md`)
- Image upload route → ImgBB hosting: uploads image (evidence: `app/api/upload/route.ts`)
- Admin dashboard → Role and API access: requires role (evidence: `app/dashboard/admin/page.tsx`)
- Admin dashboard → User and item moderation: provides controls (evidence: `README.md`)
- Admin dashboard → Platform transactions: views transactions (evidence: `README.md`)
- Menu item management → PizzaHub API: manages catalog
- Incoming order management → PizzaHub API: updates orders
- User and item moderation → PizzaHub API: moderates platform
- Order data access → PizzaHub API: fetches orders (evidence: `lib/api/orders.ts`)
