# jnjt2935/cafe-website architecture

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

- Interactive diagram: https://gitdiagram.com/jnjt2935/cafe-website
- Repository: https://github.com/jnjt2935/cafe-website

## Overview

This is a PHP café storefront with product browsing, cart and checkout, account and review features, and administrative product/order management. The clearest user path is browsing products, adding them to the cart, then checking out and viewing an order confirmation; only some of those handoffs are visible in the sampled source, so unverified transitions are dashed. The README describes the broad feature set but provides little implementation detail; unsampled subsystems are represented only where the tree supports their paths.

Main entry points: [`backend/database/db.php`](https://github.com/jnjt2935/cafe-website/blob/main/backend/database/db.php) (Database Connection), [`pages/view_product.php`](https://github.com/jnjt2935/cafe-website/blob/main/pages/view_product.php) (Product Browse), [`backend/checkout/process_order.php`](https://github.com/jnjt2935/cafe-website/blob/main/backend/checkout/process_order.php) (Order Processing), [`pages/review.php`](https://github.com/jnjt2935/cafe-website/blob/main/pages/review.php) (Reviews)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_home["Home<br/>[home.php]"]
  node_menu["Full Menu<br/>[fullmenu.php]"]
  node_product_browse["Product Browse<br/>[view_product.php]"]
end

subgraph group_commerce["Cart and Orders"]
  node_cart["Cart<br/>[cart_page.php]"]
  node_checkout_form["Checkout Form<br/>[checkout_page.php]"]
  node_order_processing["Order Processing<br/>[process_order.php]"]
  node_confirmation["Order Confirmation"]
  node_order_history["Order History<br/>[order_history.php]"]
  node_cart_endpoint["Add to Cart Endpoint<br/>[addtocart.php]"]
  node_checkout_helpers["Checkout Helpers"]
end

subgraph group_accounts["Accounts and Reviews"]
  node_account_pages["Login and Registration<br/>[login.php]"]
  node_contact["Contact<br/>[contacts.php]"]
  node_review_page["Reviews<br/>[review.php]"]
  node_review_submission["Review Submission<br/>[submit_review.php]"]
end

subgraph group_admin["Administration"]
  node_admin_dashboard["Admin Dashboard<br/>[admin.php]"]
  node_product_admin["Product Management<br/>[addproducts.php]"]
  node_product_update["Product Updates<br/>[updateproduct.php]"]
  node_order_admin["Order Management<br/>[manage_orders.php]"]
  node_order_admin_api["Order Admin Endpoints"]
end

node_customer(("Customer"))
node_database[("Shop Database")]
node_db_config["Database Connection<br/>[db.php]"]
node_dbconnect_config["Cart DB Connection<br/>[dbconnect.php]"]

node_customer -->|"visits"| node_home
node_home -->|"links to shop"| node_product_browse
node_customer -->|"browses menu"| node_menu
node_menu -->|"posts item"| node_cart_endpoint
node_cart_endpoint -->|"requires"| node_dbconnect_config
node_customer -->|"browses products"| node_product_browse
node_customer -->|"views cart"| node_cart
node_customer -->|"starts checkout"| node_checkout_form
node_checkout_form -.->|"submits order"| node_order_processing
node_order_processing -.->|"redirects after order"| node_confirmation
node_customer -->|"views orders"| node_order_history
node_product_browse -.->|"offers reviews"| node_review_page
node_review_page -->|"posts review"| node_review_submission
node_product_browse -->|"loads connection"| node_db_config
node_review_page -->|"fetches reviews"| node_review_submission
node_review_submission -->|"reads and writes"| node_database
node_order_processing -->|"loads connection"| node_db_config
node_confirmation -->|"loads connection"| node_db_config
node_product_admin -->|"loads connection"| node_db_config
node_product_update -->|"loads connection"| node_db_config
node_customer -->|"authenticates"| node_account_pages
node_customer -->|"contacts café"| node_contact
node_customer -->|"admin access"| node_admin_dashboard
node_admin_dashboard -.->|"manages products"| node_product_admin
node_admin_dashboard -.->|"manages orders"| node_order_admin
node_order_admin -.->|"uses endpoints"| node_order_admin_api
node_checkout_helpers -.->|"supports checkout"| node_order_processing

click node_home "https://github.com/jnjt2935/cafe-website/blob/main/pages/home.php"
click node_menu "https://github.com/jnjt2935/cafe-website/blob/main/pages/fullmenu.php"
click node_product_browse "https://github.com/jnjt2935/cafe-website/blob/main/pages/view_product.php"
click node_cart "https://github.com/jnjt2935/cafe-website/blob/main/pages/cart_page.php"
click node_checkout_form "https://github.com/jnjt2935/cafe-website/blob/main/pages/checkout_page.php"
click node_order_processing "https://github.com/jnjt2935/cafe-website/blob/main/backend/checkout/process_order.php"
click node_confirmation "https://github.com/jnjt2935/cafe-website/blob/main/backend/checkout/confirmation_page.php"
click node_order_history "https://github.com/jnjt2935/cafe-website/blob/main/pages/order_history.php"
click node_cart_endpoint "https://github.com/jnjt2935/cafe-website/blob/main/backend/database/addtocart.php"
click node_checkout_helpers "https://github.com/jnjt2935/cafe-website/tree/main/backend/checkout"
click node_account_pages "https://github.com/jnjt2935/cafe-website/blob/main/pages/login.php"
click node_contact "https://github.com/jnjt2935/cafe-website/blob/main/pages/contacts.php"
click node_review_page "https://github.com/jnjt2935/cafe-website/blob/main/pages/review.php"
click node_review_submission "https://github.com/jnjt2935/cafe-website/blob/main/pages/submit_review.php"
click node_admin_dashboard "https://github.com/jnjt2935/cafe-website/blob/main/pages/admin.php"
click node_product_admin "https://github.com/jnjt2935/cafe-website/blob/main/Admin/addproducts.php"
click node_product_update "https://github.com/jnjt2935/cafe-website/blob/main/Admin/updateproduct.php"
click node_order_admin "https://github.com/jnjt2935/cafe-website/blob/main/Admin/manage_orders.php"
click node_order_admin_api "https://github.com/jnjt2935/cafe-website/tree/main/backend/manage_orders"
click node_db_config "https://github.com/jnjt2935/cafe-website/blob/main/backend/database/db.php"
click node_dbconnect_config "https://github.com/jnjt2935/cafe-website/blob/main/backend/database/dbconnect.php"

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_product_browse toneBlue
class node_cart,node_checkout_form,node_order_processing,node_confirmation,node_order_history,node_cart_endpoint,node_checkout_helpers,node_database,node_db_config toneAmber
class node_account_pages,node_contact,node_review_page,node_review_submission toneMint
class node_admin_dashboard,node_product_admin,node_product_update,node_order_admin,node_order_admin_api toneRose
class node_customer toneIndigo
class node_dbconnect_config toneTeal
```

## Components

### Storefront

- [Home](https://github.com/jnjt2935/cafe-website/blob/main/pages/home.php): `pages/home.php`
- [Full Menu](https://github.com/jnjt2935/cafe-website/blob/main/pages/fullmenu.php): `pages/fullmenu.php`
- [Product Browse](https://github.com/jnjt2935/cafe-website/blob/main/pages/view_product.php): `pages/view_product.php`

### Cart and Orders

- [Cart](https://github.com/jnjt2935/cafe-website/blob/main/pages/cart_page.php): `pages/cart_page.php`
- [Checkout Form](https://github.com/jnjt2935/cafe-website/blob/main/pages/checkout_page.php): `pages/checkout_page.php`
- [Order Processing](https://github.com/jnjt2935/cafe-website/blob/main/backend/checkout/process_order.php): `backend/checkout/process_order.php`
- [Order Confirmation](https://github.com/jnjt2935/cafe-website/blob/main/backend/checkout/confirmation_page.php): `backend/checkout/confirmation_page.php`
- [Order History](https://github.com/jnjt2935/cafe-website/blob/main/pages/order_history.php): `pages/order_history.php`
- [Add to Cart Endpoint](https://github.com/jnjt2935/cafe-website/blob/main/backend/database/addtocart.php): `backend/database/addtocart.php`
- [Checkout Helpers](https://github.com/jnjt2935/cafe-website/tree/main/backend/checkout): `backend/checkout`

### Accounts and Reviews

- [Login and Registration](https://github.com/jnjt2935/cafe-website/blob/main/pages/login.php): `pages/login.php`
- [Contact](https://github.com/jnjt2935/cafe-website/blob/main/pages/contacts.php): `pages/contacts.php`
- [Reviews](https://github.com/jnjt2935/cafe-website/blob/main/pages/review.php): `pages/review.php`
- [Review Submission](https://github.com/jnjt2935/cafe-website/blob/main/pages/submit_review.php): `pages/submit_review.php`

### Administration

- [Admin Dashboard](https://github.com/jnjt2935/cafe-website/blob/main/pages/admin.php): `pages/admin.php`
- [Product Management](https://github.com/jnjt2935/cafe-website/blob/main/Admin/addproducts.php): `Admin/addproducts.php`
- [Product Updates](https://github.com/jnjt2935/cafe-website/blob/main/Admin/updateproduct.php): `Admin/updateproduct.php`
- [Order Management](https://github.com/jnjt2935/cafe-website/blob/main/Admin/manage_orders.php): `Admin/manage_orders.php`
- [Order Admin Endpoints](https://github.com/jnjt2935/cafe-website/tree/main/backend/manage_orders): `backend/manage_orders`

### Other components

- **Customer**
- **Shop Database**
- [Database Connection](https://github.com/jnjt2935/cafe-website/blob/main/backend/database/db.php): `backend/database/db.php`
- [Cart DB Connection](https://github.com/jnjt2935/cafe-website/blob/main/backend/database/dbconnect.php): `backend/database/dbconnect.php`

## Connections

- Customer → Home: visits
- Home → Product Browse: links to shop (evidence: `pages/home.php`)
- Customer → Full Menu: browses menu
- Full Menu → Add to Cart Endpoint: posts item (evidence: `pages/fullmenu.php`)
- Add to Cart Endpoint → Cart DB Connection: requires (evidence: `backend/database/addtocart.php`)
- Customer → Product Browse: browses products
- Customer → Cart: views cart
- Customer → Checkout Form: starts checkout
- Checkout Form → Order Processing: submits order
- Order Processing → Order Confirmation: redirects after order
- Customer → Order History: views orders
- Product Browse → Reviews: offers reviews
- Reviews → Review Submission: posts review (evidence: `pages/review.php`)
- Product Browse → Database Connection: loads connection (evidence: `pages/view_product.php`)
- Reviews → Review Submission: fetches reviews (evidence: `pages/review.php`)
- Review Submission → Shop Database: reads and writes (evidence: `pages/submit_review.php`)
- Order Processing → Database Connection: loads connection (evidence: `backend/checkout/process_order.php`)
- Order Confirmation → Database Connection: loads connection (evidence: `backend/checkout/confirmation_page.php`)
- Product Management → Database Connection: loads connection (evidence: `Admin/addproducts.php`)
- Product Updates → Database Connection: loads connection (evidence: `Admin/updateproduct.php`)
- Customer → Login and Registration: authenticates
- Customer → Contact: contacts café
- Customer → Admin Dashboard: admin access
- Admin Dashboard → Product Management: manages products
- Admin Dashboard → Order Management: manages orders
- Order Management → Order Admin Endpoints: uses endpoints
- Checkout Helpers → Order Processing: supports checkout
