# abk-00/grocery_delivery architecture

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

- Interactive diagram: https://gitdiagram.com/abk-00/grocery_delivery
- Repository: https://github.com/abk-00/grocery_delivery

## Overview

GroceryGo is a multi-company grocery ordering and delivery app. Customers browse company-scoped groceries, manage a cart, place an order, pay, and track delivery; staff and administrators manage orders and delivery assignment, while delivery partners update GPS locations. Super administrators manage companies and subscriptions. The README documents tenant isolation and these capabilities; sampled source confirms role/company access checks and delivery GPS updates. Several page-to-page interactions are documented rather than sampled, so those links cite the README; unverified integrations are shown as optional.

Main entry points: [`staff/order_details.php`](https://github.com/abk-00/grocery_delivery/blob/main/staff/order_details.php) (Staff order handling), [`config/db.php`](https://github.com/abk-00/grocery_delivery/blob/main/config/db.php) (MySQL database), [`includes/auth.php`](https://github.com/abk-00/grocery_delivery/blob/main/includes/auth.php) (Role and tenant access), [`products.php`](https://github.com/abk-00/grocery_delivery/blob/main/products.php) (Product catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shopping["Customer shopping"]
  node_catalog["Product catalog<br/>[products.php]"]
  node_product["Product details<br/>[product.php]"]
  node_cart["Shopping cart<br/>[cart.php]"]
  node_checkout["Checkout<br/>[checkout.php]"]
  node_order_api["Order placement<br/>[place_order.php]"]
  node_customer_orders["Customer orders<br/>[orders.php]"]
  node_payment_api["Payment APIs"]
  node_tracking["Customer tracking<br/>[track_order.php]"]
end

subgraph group_fulfillment["Order fulfillment"]
  node_staff["Staff order handling<br/>[order_details.php]"]
  node_admin_ops["Admin operations<br/>[order_details.php]"]
  node_delivery_ops["Delivery operations<br/>[track_delivery.php]"]
  node_gps_api["GPS location API"]
end

subgraph group_platform["Tenant platform"]
  node_super_admin["Company management<br/>[companies.php]"]
end

subgraph group_shared["Shared services"]
  node_tenant_auth["Role and tenant access<br/>[auth.php]"]
  node_shared_functions["Shared helpers<br/>[functions.php]"]
  node_mysql[("MySQL database<br/>[db.php]")]
  node_payment_config["Payment configuration<br/>[paystack.php]"]
  node_role_navigation["Role navigation<br/>[admin_sidebar.php]"]
  node_page_loader["Page loader<br/>[loader.php]"]
end

node_customer(("Customer"))
node_paystack["Paystack"]

node_customer -->|"browses"| node_catalog
node_catalog -->|"opens details"| node_product
node_customer -->|"manages items"| node_cart
node_cart -->|"checks out"| node_checkout
node_checkout -->|"submits order"| node_order_api
node_order_api -->|"creates order"| node_customer_orders
node_customer -->|"views orders"| node_customer_orders
node_checkout -->|"starts payment"| node_payment_api
node_payment_api -.->|"requests payment"| node_paystack
node_customer_orders -->|"tracks delivery"| node_tracking
node_staff -->|"reads and updates"| node_mysql
node_admin_ops -->|"reads and updates"| node_mysql
node_staff -.->|"assigns delivery"| node_delivery_ops
node_delivery_ops -->|"posts locations"| node_gps_api
node_gps_api -->|"stores locations"| node_mysql
node_super_admin -->|"manages companies"| node_mysql
node_catalog -.->|"queries products"| node_mysql
node_order_api -->|"stores orders"| node_mysql
node_payment_api -->|"checks order ownership"| node_mysql
node_payment_api -->|"loads configuration"| node_payment_config
node_catalog -.->|"enforces company scope"| node_tenant_auth
node_staff -->|"checks access"| node_tenant_auth
node_admin_ops -->|"checks access"| node_tenant_auth
node_delivery_ops -->|"checks access"| node_tenant_auth
node_super_admin -->|"checks role"| node_tenant_auth
node_staff -->|"uses helpers"| node_shared_functions
node_admin_ops -->|"uses helpers"| node_shared_functions
node_delivery_ops -->|"uses helpers"| node_shared_functions
node_staff -.->|"includes navigation"| node_role_navigation
node_staff -->|"includes loader"| node_page_loader

click node_catalog "https://github.com/abk-00/grocery_delivery/blob/main/products.php"
click node_product "https://github.com/abk-00/grocery_delivery/blob/main/product.php"
click node_cart "https://github.com/abk-00/grocery_delivery/blob/main/cart.php"
click node_checkout "https://github.com/abk-00/grocery_delivery/blob/main/checkout.php"
click node_order_api "https://github.com/abk-00/grocery_delivery/blob/main/api/place_order.php"
click node_customer_orders "https://github.com/abk-00/grocery_delivery/blob/main/orders.php"
click node_payment_api "https://github.com/abk-00/grocery_delivery/blob/main/api/initialize_payment.php"
click node_tracking "https://github.com/abk-00/grocery_delivery/blob/main/customer/track_order.php"
click node_staff "https://github.com/abk-00/grocery_delivery/blob/main/staff/order_details.php"
click node_admin_ops "https://github.com/abk-00/grocery_delivery/blob/main/admin/order_details.php"
click node_delivery_ops "https://github.com/abk-00/grocery_delivery/blob/main/delivery/track_delivery.php"
click node_gps_api "https://github.com/abk-00/grocery_delivery/blob/main/api/update_delivery_location.php"
click node_super_admin "https://github.com/abk-00/grocery_delivery/blob/main/super_admin/companies.php"
click node_tenant_auth "https://github.com/abk-00/grocery_delivery/blob/main/includes/auth.php"
click node_shared_functions "https://github.com/abk-00/grocery_delivery/blob/main/includes/functions.php"
click node_mysql "https://github.com/abk-00/grocery_delivery/blob/main/config/db.php"
click node_payment_config "https://github.com/abk-00/grocery_delivery/blob/main/config/paystack.php"
click node_role_navigation "https://github.com/abk-00/grocery_delivery/blob/main/includes/admin_sidebar.php"
click node_page_loader "https://github.com/abk-00/grocery_delivery/blob/main/includes/loader.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_catalog,node_product,node_cart,node_checkout,node_order_api,node_customer_orders,node_payment_api,node_tracking toneBlue
class node_staff,node_admin_ops,node_delivery_ops,node_gps_api toneAmber
class node_super_admin toneMint
class node_tenant_auth,node_shared_functions,node_mysql,node_payment_config,node_role_navigation,node_page_loader toneRose
class node_customer,node_paystack toneIndigo
```

## Components

### Customer shopping

- [Product catalog](https://github.com/abk-00/grocery_delivery/blob/main/products.php): `products.php`
- [Product details](https://github.com/abk-00/grocery_delivery/blob/main/product.php): `product.php`
- [Shopping cart](https://github.com/abk-00/grocery_delivery/blob/main/cart.php): `cart.php`
- [Checkout](https://github.com/abk-00/grocery_delivery/blob/main/checkout.php): `checkout.php`
- [Order placement](https://github.com/abk-00/grocery_delivery/blob/main/api/place_order.php): `api/place_order.php`
- [Customer orders](https://github.com/abk-00/grocery_delivery/blob/main/orders.php): `orders.php`
- [Payment APIs](https://github.com/abk-00/grocery_delivery/blob/main/api/initialize_payment.php): `api/initialize_payment.php`
- [Customer tracking](https://github.com/abk-00/grocery_delivery/blob/main/customer/track_order.php): `customer/track_order.php`

### Order fulfillment

- [Staff order handling](https://github.com/abk-00/grocery_delivery/blob/main/staff/order_details.php): `staff/order_details.php`
- [Admin operations](https://github.com/abk-00/grocery_delivery/blob/main/admin/order_details.php): `admin/order_details.php`
- [Delivery operations](https://github.com/abk-00/grocery_delivery/blob/main/delivery/track_delivery.php): `delivery/track_delivery.php`
- [GPS location API](https://github.com/abk-00/grocery_delivery/blob/main/api/update_delivery_location.php): `api/update_delivery_location.php`

### Tenant platform

- [Company management](https://github.com/abk-00/grocery_delivery/blob/main/super_admin/companies.php): `super_admin/companies.php`

### Shared services

- [Role and tenant access](https://github.com/abk-00/grocery_delivery/blob/main/includes/auth.php): `includes/auth.php`
- [Shared helpers](https://github.com/abk-00/grocery_delivery/blob/main/includes/functions.php): `includes/functions.php`
- [MySQL database](https://github.com/abk-00/grocery_delivery/blob/main/config/db.php): `config/db.php`
- [Payment configuration](https://github.com/abk-00/grocery_delivery/blob/main/config/paystack.php): `config/paystack.php`
- [Role navigation](https://github.com/abk-00/grocery_delivery/blob/main/includes/admin_sidebar.php): `includes/admin_sidebar.php`
- [Page loader](https://github.com/abk-00/grocery_delivery/blob/main/includes/loader.php): `includes/loader.php`

### Other components

- **Customer**
- **Paystack**

## Connections

- Customer → Product catalog: browses
- Product catalog → Product details: opens details
- Customer → Shopping cart: manages items
- Shopping cart → Checkout: checks out
- Checkout → Order placement: submits order
- Order placement → Customer orders: creates order
- Customer → Customer orders: views orders
- Checkout → Payment APIs: starts payment
- Payment APIs → Paystack: requests payment
- Customer orders → Customer tracking: tracks delivery
- Staff order handling → MySQL database: reads and updates (evidence: `staff/order_details.php`)
- Admin operations → MySQL database: reads and updates (evidence: `admin/order_details.php`)
- Staff order handling → Delivery operations: assigns delivery
- Delivery operations → GPS location API: posts locations (evidence: `delivery/track_delivery.php`)
- GPS location API → MySQL database: stores locations (evidence: `api/update_delivery_location.php`)
- Company management → MySQL database: manages companies (evidence: `super_admin/companies.php`)
- Product catalog → MySQL database: queries products (evidence: `products.php`)
- Order placement → MySQL database: stores orders (evidence: `api/place_order.php`)
- Payment APIs → MySQL database: checks order ownership (evidence: `api/initialize_payment.php`)
- Payment APIs → Payment configuration: loads configuration (evidence: `api/initialize_payment.php`)
- Product catalog → Role and tenant access: enforces company scope
- Staff order handling → Role and tenant access: checks access (evidence: `staff/order_details.php`)
- Admin operations → Role and tenant access: checks access (evidence: `admin/order_details.php`)
- Delivery operations → Role and tenant access: checks access (evidence: `delivery/track_delivery.php`)
- Company management → Role and tenant access: checks role (evidence: `super_admin/companies.php`)
- Staff order handling → Shared helpers: uses helpers (evidence: `staff/order_details.php`)
- Admin operations → Shared helpers: uses helpers (evidence: `admin/order_details.php`)
- Delivery operations → Shared helpers: uses helpers (evidence: `delivery/track_delivery.php`)
- Staff order handling → Role navigation: includes navigation
- Staff order handling → Page loader: includes loader (evidence: `staff/order_details.php`)
