# hossain-arafat/pizzago architecture

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

- Interactive diagram: https://gitdiagram.com/hossain-arafat/pizzago
- Repository: https://github.com/hossain-arafat/pizzago

## Overview

1. **What this repository is**
   PizzaGo is a PHP/MySQL restaurant ordering system built around an MVC split: browser-facing PHP views, request-handling controllers, and database models. It is not a single-page app; each interaction is a server-rendered request/response cycle.

2. **Application entry and request routing**
   `index.php` is the top-level entry point. From there, the app presents the landing/auth flow and delegates feature actions to dedicated controllers. The architecture suggests standard PHP page navigation rather than a framework router.

3. **Presentation layer**
   The `view/` directory contains the rendered pages for customer, staff, and admin workflows: login/signup, menu/cart, dashboard, orders, profile, pizza management, staff management, and password recovery. Shared UI chrome lives in `header.php`, `footer.php`, `navigationBar.php`, and `sidebar.php`, which indicates a template-based layout boundary.

4. **Business logic layer**
   The `controller/` directory is where form submissions and actions are handled. Controllers are split by feature, including authentication (`loginController.php`, `signupController.php`, `logoutController.php`, `forgetPassController.php`), account management (`profileController.php`, `passwordController.php`), ordering (`orderController.php`), and admin/staff operations (`addPizzaController.php`, `updatePizzaController.php`, `deletePizzaController.php`, `addStaffController.php`, `pizzaAvailabilityController.php`, `pizzaStatusController.php`).

5. **Data access layer**
   The `model/` directory encapsulates persistence. `connection.php` centralizes the MySQL connection, while `user.php`, `pizza.php`, and `order.php` represent the main data domains. This is the main boundary between application logic and the database.

6. **Core data domains**
   The system is organized around users, pizzas, and orders. Users carry roles such as customer, staff, and admin. Pizzas are the catalog/inventory entity. Orders connect customers to purchased pizzas and carry status progression through the workflow.

7. **Order and cart flow**
   Customer shopping is session-driven: browse menu in `view/menu.php`, add items to `view/cart.php`, then submit through `orderController.php`. The controller likely computes totals, creates order records, and writes order items through the model layer. This is the primary transactional path in the system.

8. **Operational workflows for staff/admin**
   Admin and staff use separate operational screens such as `dashboard.php`, `orders.php`, `availability.php`, `assigned.php`, `staff.php`, and the pizza management views. `pizzaStatusController.php` manages order lifecycle updates, while `pizzaAvailabilityController.php` controls whether menu items are in stock. These are the main back-office control points.

9. **Authentication and session boundary**
   Authentication is handled server-side with PHP sessions. Login/signup/forgot-password flows establish the session identity, and role-based access determines which view/controller set is reachable. This makes session state a key architectural dependency across all modules.

10. **Frontend assets**
   The `css/` and `js/` directories are organized per screen or feature, so styling and client-side validation are modular but not central to the business architecture. `image/` holds static menu assets, while `assets/` appears to store documentation screenshots rather than runtime dependencies.

11. **Infrastructure and runtime**
   The stack is traditional PHP 7.4+ on Apache with MySQL 5.7+ access via procedural MySQLi. There is no evidence of an ORM, API backend, or separate service tier; the database is directly accessed through the model classes/functions.

12. **Diagram boundaries to emphasize**
   For an architecture diagram, the important boundaries are: browser/UI views, PHP controller layer, model/database access layer, and MySQL persistence. The key flows are authentication, menu/cart checkout, order-status updates, and admin inventory/staff management. Role-based access sits across all of them.

Main entry points: [`view/login.php`](https://github.com/hossain-arafat/pizzago/blob/main/view/login.php) (Login), [`view/menu.php`](https://github.com/hossain-arafat/pizzago/blob/main/view/menu.php) (Menu), [`view/dashboard.php`](https://github.com/hossain-arafat/pizzago/blob/main/view/dashboard.php) (Dashboard), [`index.php`](https://github.com/hossain-arafat/pizzago/blob/main/index.php) (index.php)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Presentation"]
  node_index["index.php<br/>entry point<br/>[index.php]"]
  node_login_view["Login<br/>auth view<br/>[login.php]"]
  node_signup_view["Signup<br/>auth view<br/>[signup.php]"]
  node_forget_view["Recover<br/>auth view<br/>[forget.php]"]
  node_menu_view["Menu<br/>customer view<br/>[menu.php]"]
  node_cart_view["Cart<br/>checkout view<br/>[cart.php]"]
  node_dashboard_view["Dashboard<br/>admin view<br/>[dashboard.php]"]
  node_orders_view["Orders<br/>ops view<br/>[orders.php]"]
  node_manage_pizzas_view["Pizzas<br/>admin view<br/>[manage_pizzas.php]"]
  node_add_pizza_view["Add Pizza<br/>admin view<br/>[add_pizza.php]"]
  node_staff_view["Staff<br/>admin view<br/>[staff.php]"]
  node_profile_view["Profile<br/>account view<br/>[profile.php]"]
  node_shared_layout["Shell<br/>layout partials"]
end

subgraph group_controllers["Controllers"]
  node_auth_ctrl["Auth<br/>controller set"]
  node_account_ctrl["Account<br/>controller set"]
  node_order_ctrl["Orders<br/>order controller"]
  node_pizza_ctrl["Pizza Ops<br/>admin controllers"]
end

subgraph group_models["Models"]
  node_user_model[("Users<br/>domain model<br/>[user.php]")]
  node_pizza_model[("Pizzas<br/>domain model<br/>[pizza.php]")]
  node_order_model[("Orders<br/>domain model<br/>[order.php]")]
  node_db_conn[("MySQL<br/>connection layer<br/>[connection.php]")]
end

subgraph group_assets["Static assets"]
  node_css_js["UI Assets<br/>static assets"]
end

node_index -->|"landing/auth"| node_login_view
node_index -->|"browse"| node_menu_view
node_index -->|"roles"| node_dashboard_view
node_login_view -->|"submit"| node_auth_ctrl
node_signup_view -->|"submit"| node_auth_ctrl
node_forget_view -->|"recover"| node_auth_ctrl
node_auth_ctrl -->|"users"| node_user_model
node_profile_view -->|"update"| node_account_ctrl
node_account_ctrl -->|"profile"| node_user_model
node_menu_view -->|"cart"| node_cart_view
node_cart_view -->|"checkout"| node_order_ctrl
node_order_ctrl -->|"orders"| node_order_model
node_order_ctrl -->|"items"| node_pizza_model
node_dashboard_view -->|"ops"| node_orders_view
node_orders_view -->|"status"| node_pizza_ctrl
node_manage_pizzas_view -->|"catalog"| node_pizza_ctrl
node_add_pizza_view -->|"create"| node_pizza_ctrl
node_staff_view -->|"staff"| node_pizza_ctrl
node_pizza_ctrl -->|"pizzas"| node_pizza_model
node_pizza_ctrl -->|"status"| node_order_model
node_pizza_model -->|"sql"| node_db_conn
node_user_model -->|"sql"| node_db_conn
node_order_model -->|"sql"| node_db_conn
node_shared_layout -->|"chrome"| node_login_view
node_shared_layout -->|"chrome"| node_menu_view
node_shared_layout -->|"chrome"| node_dashboard_view
node_css_js -->|"style"| node_login_view
node_css_js -->|"style"| node_menu_view
node_css_js -->|"style"| node_dashboard_view

click node_index "https://github.com/hossain-arafat/pizzago/blob/main/index.php"
click node_login_view "https://github.com/hossain-arafat/pizzago/blob/main/view/login.php"
click node_signup_view "https://github.com/hossain-arafat/pizzago/blob/main/view/signup.php"
click node_forget_view "https://github.com/hossain-arafat/pizzago/blob/main/view/forget.php"
click node_menu_view "https://github.com/hossain-arafat/pizzago/blob/main/view/menu.php"
click node_cart_view "https://github.com/hossain-arafat/pizzago/blob/main/view/cart.php"
click node_dashboard_view "https://github.com/hossain-arafat/pizzago/blob/main/view/dashboard.php"
click node_orders_view "https://github.com/hossain-arafat/pizzago/blob/main/view/orders.php"
click node_manage_pizzas_view "https://github.com/hossain-arafat/pizzago/blob/main/view/manage_pizzas.php"
click node_add_pizza_view "https://github.com/hossain-arafat/pizzago/blob/main/view/add_pizza.php"
click node_staff_view "https://github.com/hossain-arafat/pizzago/blob/main/view/staff.php"
click node_profile_view "https://github.com/hossain-arafat/pizzago/blob/main/view/profile.php"
click node_order_ctrl "https://github.com/hossain-arafat/pizzago/blob/main/controller/orderController.php"
click node_user_model "https://github.com/hossain-arafat/pizzago/blob/main/model/user.php"
click node_pizza_model "https://github.com/hossain-arafat/pizzago/blob/main/model/pizza.php"
click node_order_model "https://github.com/hossain-arafat/pizzago/blob/main/model/order.php"
click node_db_conn "https://github.com/hossain-arafat/pizzago/blob/main/model/connection.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_index,node_login_view,node_signup_view,node_forget_view,node_menu_view,node_cart_view,node_dashboard_view,node_orders_view,node_manage_pizzas_view,node_add_pizza_view,node_staff_view,node_profile_view,node_shared_layout toneBlue
class node_auth_ctrl,node_account_ctrl,node_order_ctrl,node_pizza_ctrl toneAmber
class node_user_model,node_pizza_model,node_order_model,node_db_conn toneMint
class node_css_js toneRose
```

## Components

### Presentation

Server-rendered pages and shared layout for customer, staff, and admin workflows.

- [index.php](https://github.com/hossain-arafat/pizzago/blob/main/index.php): entry point · Top-level application entry and landing flow. · `index.php`
- [Login](https://github.com/hossain-arafat/pizzago/blob/main/view/login.php): auth view · Customer/staff/admin sign-in page. · `view/login.php`
- [Signup](https://github.com/hossain-arafat/pizzago/blob/main/view/signup.php): auth view · Account creation page. · `view/signup.php`
- [Recover](https://github.com/hossain-arafat/pizzago/blob/main/view/forget.php): auth view · Password recovery page. · `view/forget.php`
- [Menu](https://github.com/hossain-arafat/pizzago/blob/main/view/menu.php): customer view · Browse pizzas and add items to cart. · `view/menu.php`
- [Cart](https://github.com/hossain-arafat/pizzago/blob/main/view/cart.php): checkout view · Session-driven shopping cart and checkout screen. · `view/cart.php`
- [Dashboard](https://github.com/hossain-arafat/pizzago/blob/main/view/dashboard.php): admin view · Staff/admin landing and operational summary. · `view/dashboard.php`
- [Orders](https://github.com/hossain-arafat/pizzago/blob/main/view/orders.php): ops view · Back-office order queue and status workbench. · `view/orders.php`
- [Pizzas](https://github.com/hossain-arafat/pizzago/blob/main/view/manage_pizzas.php): admin view · Pizza catalog management screen. · `view/manage_pizzas.php`
- [Add Pizza](https://github.com/hossain-arafat/pizzago/blob/main/view/add_pizza.php): admin view · Form for creating pizza records. · `view/add_pizza.php`
- [Staff](https://github.com/hossain-arafat/pizzago/blob/main/view/staff.php): admin view · Staff management screen. · `view/staff.php`
- [Profile](https://github.com/hossain-arafat/pizzago/blob/main/view/profile.php): account view · User profile and account details page. · `view/profile.php`
- **Shell**: layout partials · Shared header, navigation, sidebar, and footer used across pages.

### Controllers

Request handlers for authentication, ordering, and back-office actions.

- **Auth**: controller set · Login, signup, logout, and password recovery handlers.
- **Account**: controller set · Profile and password update handlers.
- [Orders](https://github.com/hossain-arafat/pizzago/blob/main/controller/orderController.php): order controller · Checkout, order creation, and customer order submission. · `controller/orderController.php`
- **Pizza Ops**: admin controllers · Add, update, delete, availability, and status actions for pizzas and orders.

### Models

Persistence and domain access over MySQL.

- [Users](https://github.com/hossain-arafat/pizzago/blob/main/model/user.php): domain model · User accounts, roles, and authentication-related persistence. · `model/user.php`
- [Pizzas](https://github.com/hossain-arafat/pizzago/blob/main/model/pizza.php): domain model · Pizza catalog and availability persistence. · `model/pizza.php`
- [Orders](https://github.com/hossain-arafat/pizzago/blob/main/model/order.php): domain model · Order records and order workflow state. · `model/order.php`
- [MySQL](https://github.com/hossain-arafat/pizzago/blob/main/model/connection.php): connection layer · Central database connection used by the models. · `model/connection.php`

### Static assets

Screen-specific CSS, JavaScript, and images that support the views.

- **UI Assets**: static assets · Screen-specific CSS and JavaScript for forms and page behavior.

## Connections

- index.php → Login: landing/auth · Entry point presents the sign-in flow.
- index.php → Menu: browse · Authenticated users reach the menu experience.
- index.php → Dashboard: roles · Role-based navigation reaches staff/admin areas.
- Login → Auth: submit · Login form posts credentials to authentication handlers.
- Signup → Auth: submit · Signup form creates a new account through auth handlers.
- Recover → Auth: recover · Password recovery requests are handled by auth controllers.
- Auth → Users: users · Authentication and account actions read/write user records.
- Profile → Account: update · Profile and password forms submit account changes.
- Account → Users: profile · Account changes persist through the user domain model.
- Menu → Cart: cart · Users move from browsing to cart review.
- Cart → Orders: checkout · Cart submission creates an order.
- Orders → Orders: orders · Checkout writes orders and order items.
- Orders → Pizzas: items · Checkout resolves pizza details and pricing.
- Dashboard → Orders: ops · Dashboard links into operational order management.
- Orders → Pizza Ops: status · Order queue actions update lifecycle state.
- Pizzas → Pizza Ops: catalog · Pizza management screens post create/update/delete actions.
- Add Pizza → Pizza Ops: create · Pizza creation form submits to pizza controllers.
- Staff → Pizza Ops: staff · Staff administration routes through back-office controllers.
- Pizza Ops → Pizzas: pizzas · Pizza operations persist catalog and availability changes.
- Pizza Ops → Orders: status · Order status updates persist through the order domain model.
- Pizzas → MySQL: sql · Pizza persistence uses the shared MySQL connection.
- Users → MySQL: sql · User persistence uses the shared MySQL connection.
- Orders → MySQL: sql · Order persistence uses the shared MySQL connection.
- Shell → Login: chrome · Shared page shell is reused by auth pages.
- Shell → Menu: chrome · Shared page shell is reused by customer pages.
- Shell → Dashboard: chrome · Shared page shell is reused by staff/admin pages.
- UI Assets → Login: style · Page assets support login and other form screens.
- UI Assets → Menu: style · Page assets support menu and cart screens.
- UI Assets → Dashboard: style · Page assets support dashboard and admin screens.
