# khaled5ahmed/online_bookstore architecture

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

- Interactive diagram: https://gitdiagram.com/khaled5ahmed/online_bookstore
- Repository: https://github.com/khaled5ahmed/online_bookstore

## Overview

This is a PHP/MySQL online bookstore. Customers discover books, manage accounts and carts, then check out; administrators maintain catalog and publisher data, monitor inventory and sales, and confirm incoming publisher orders. The graph separates storefront, customer operations, administration, and shared data/security. Several frontend-to-endpoint connections and unsampled capabilities are documented but their exact runtime wiring is not visible in the excerpts, so those links are omitted or marked unverified rather than inferred.

Main entry points: [`frontend/customer`](https://github.com/khaled5ahmed/online_bookstore/tree/main/frontend/customer) (Customer Portal), [`frontend/admin/modify_book.php`](https://github.com/khaled5ahmed/online_bookstore/blob/main/frontend/admin/modify_book.php) (Inventory Editor), [`backend/shared/auth.php`](https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/shared/auth.php) (Session & Access Control), [`backend/admin`](https://github.com/khaled5ahmed/online_bookstore/tree/main/backend/admin) (Catalog Administration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_catalog_ui["Catalog &amp; Search UI<br/>[search.html]"]
  node_search_api["Catalog Search<br/>[search.php]"]
  node_store_entry["Store Entry<br/>[index.php]"]
end

subgraph group_customer_ops["Customer Operations"]
  node_account_api["Account Services"]
  node_cart_api["Cart Management<br/>[cart.php]"]
  node_checkout_api["Checkout<br/>[checkout.php]"]
  node_orders_api["Order History<br/>[past_orders.php]"]
  node_wishlist_api["Wishlist<br/>[wishlist.php]"]
  node_profile_api["Profile Management<br/>[edit_profile.php]"]
  node_customer_ui["Customer Portal"]
end

subgraph group_administration["Administration"]
  node_admin_dashboard["Admin Dashboard<br/>[dashboard.php]"]
  node_inventory_ui["Inventory Editor<br/>[modify_book.php]"]
  node_shipment_ui["Publisher Shipments"]
  node_admin_catalog["Catalog Administration"]
  node_admin_reports["Sales Reports<br/>[reports.php]"]
end

subgraph group_platform["Shared Platform"]
  node_auth["Session &amp; Access Control<br/>[auth.php]"]
  node_db_config["Database Connector<br/>[db.php]"]
  node_database[("Bookstore Database")]
  node_replenishment["Reorder Triggers<br/>[03_triggers.sql]"]
end

node_customer(("Customer"))
node_admin(("Administrator"))

node_customer -->|"opens store"| node_store_entry
node_customer -->|"browses catalog"| node_catalog_ui
node_catalog_ui -.->|"searches books"| node_search_api
node_customer -->|"uses portal"| node_customer_ui
node_customer_ui -.->|"uses account services"| node_account_api
node_customer_ui -.->|"manages cart"| node_cart_api
node_customer_ui -.->|"submits checkout"| node_checkout_api
node_customer_ui -.->|"views orders"| node_orders_api
node_customer_ui -.->|"manages wishlist"| node_wishlist_api
node_customer_ui -.->|"edits profile"| node_profile_api
node_checkout_api -->|"records sales; updates stock"| node_database
node_admin -->|"monitors operations"| node_admin_dashboard
node_admin_dashboard -->|"checks admin access"| node_auth
node_admin -->|"manages inventory"| node_inventory_ui
node_inventory_ui -->|"checks admin access"| node_auth
node_inventory_ui -->|"requests book changes"| node_admin_catalog
node_inventory_ui -->|"loads book results"| node_search_api
node_admin -->|"confirms arrivals"| node_shipment_ui
node_admin -->|"requests reports"| node_admin_reports
node_admin_catalog -->|"maintains catalog records"| node_database
node_admin_reports -->|"checks admin access"| node_auth
node_admin_reports -->|"queries sales data"| node_database
node_search_api -->|"opens connection"| node_db_config
node_admin_catalog -->|"guards book creation"| node_auth
node_db_config -->|"connects"| node_database
node_database -.->|"applies stock triggers"| node_replenishment

click node_catalog_ui "https://github.com/khaled5ahmed/online_bookstore/blob/main/frontend/customer/search.html"
click node_search_api "https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/customer/search.php"
click node_store_entry "https://github.com/khaled5ahmed/online_bookstore/blob/main/frontend/index.php"
click node_account_api "https://github.com/khaled5ahmed/online_bookstore/tree/main/backend/customer"
click node_cart_api "https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/customer/cart.php"
click node_checkout_api "https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/customer/checkout.php"
click node_orders_api "https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/customer/past_orders.php"
click node_wishlist_api "https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/customer/wishlist.php"
click node_profile_api "https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/customer/edit_profile.php"
click node_customer_ui "https://github.com/khaled5ahmed/online_bookstore/tree/main/frontend/customer"
click node_admin_dashboard "https://github.com/khaled5ahmed/online_bookstore/blob/main/frontend/admin/dashboard.php"
click node_inventory_ui "https://github.com/khaled5ahmed/online_bookstore/blob/main/frontend/admin/modify_book.php"
click node_shipment_ui "https://github.com/khaled5ahmed/online_bookstore/blob/main/frontend/admin/confirm_shipments.php"
click node_admin_catalog "https://github.com/khaled5ahmed/online_bookstore/tree/main/backend/admin"
click node_admin_reports "https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/admin/reports.php"
click node_auth "https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/shared/auth.php"
click node_db_config "https://github.com/khaled5ahmed/online_bookstore/blob/main/config/db.php"
click node_replenishment "https://github.com/khaled5ahmed/online_bookstore/blob/main/sql/03_triggers.sql"

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_ui,node_search_api,node_store_entry toneBlue
class node_account_api,node_cart_api,node_checkout_api,node_orders_api,node_wishlist_api,node_profile_api,node_customer_ui toneAmber
class node_admin_dashboard,node_inventory_ui,node_shipment_ui,node_admin_catalog,node_admin_reports toneMint
class node_auth,node_db_config,node_database,node_replenishment toneRose
class node_customer,node_admin toneIndigo
```

## Components

### Storefront

- [Catalog & Search UI](https://github.com/khaled5ahmed/online_bookstore/blob/main/frontend/customer/search.html): `frontend/customer/search.html`
- [Catalog Search](https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/customer/search.php): `backend/customer/search.php`
- [Store Entry](https://github.com/khaled5ahmed/online_bookstore/blob/main/frontend/index.php): `frontend/index.php`

### Customer Operations

- [Account Services](https://github.com/khaled5ahmed/online_bookstore/tree/main/backend/customer): `backend/customer`
- [Cart Management](https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/customer/cart.php): `backend/customer/cart.php`
- [Checkout](https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/customer/checkout.php): `backend/customer/checkout.php`
- [Order History](https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/customer/past_orders.php): `backend/customer/past_orders.php`
- [Wishlist](https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/customer/wishlist.php): `backend/customer/wishlist.php`
- [Profile Management](https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/customer/edit_profile.php): `backend/customer/edit_profile.php`
- [Customer Portal](https://github.com/khaled5ahmed/online_bookstore/tree/main/frontend/customer): `frontend/customer`

### Administration

- [Admin Dashboard](https://github.com/khaled5ahmed/online_bookstore/blob/main/frontend/admin/dashboard.php): `frontend/admin/dashboard.php`
- [Inventory Editor](https://github.com/khaled5ahmed/online_bookstore/blob/main/frontend/admin/modify_book.php): `frontend/admin/modify_book.php`
- [Publisher Shipments](https://github.com/khaled5ahmed/online_bookstore/blob/main/frontend/admin/confirm_shipments.php): `frontend/admin/confirm_shipments.php`
- [Catalog Administration](https://github.com/khaled5ahmed/online_bookstore/tree/main/backend/admin): `backend/admin`
- [Sales Reports](https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/admin/reports.php): `backend/admin/reports.php`

### Shared Platform

- [Session & Access Control](https://github.com/khaled5ahmed/online_bookstore/blob/main/backend/shared/auth.php): `backend/shared/auth.php`
- [Database Connector](https://github.com/khaled5ahmed/online_bookstore/blob/main/config/db.php): `config/db.php`
- **Bookstore Database**
- [Reorder Triggers](https://github.com/khaled5ahmed/online_bookstore/blob/main/sql/03_triggers.sql): `sql/03_triggers.sql`

### Other components

- **Customer**
- **Administrator**

## Connections

- Customer → Store Entry: opens store (evidence: `README.md`)
- Customer → Catalog & Search UI: browses catalog (evidence: `README.md`)
- Catalog & Search UI → Catalog Search: searches books
- Customer → Customer Portal: uses portal (evidence: `README.md`)
- Customer Portal → Account Services: uses account services
- Customer Portal → Cart Management: manages cart
- Customer Portal → Checkout: submits checkout
- Customer Portal → Order History: views orders
- Customer Portal → Wishlist: manages wishlist
- Customer Portal → Profile Management: edits profile
- Checkout → Bookstore Database: records sales; updates stock (evidence: `backend/customer/checkout.php`)
- Administrator → Admin Dashboard: monitors operations (evidence: `README.md`)
- Admin Dashboard → Session & Access Control: checks admin access (evidence: `frontend/admin/dashboard.php`)
- Administrator → Inventory Editor: manages inventory (evidence: `README.md`)
- Inventory Editor → Session & Access Control: checks admin access (evidence: `frontend/admin/modify_book.php`)
- Inventory Editor → Catalog Administration: requests book changes (evidence: `frontend/admin/modify_book.php`)
- Inventory Editor → Catalog Search: loads book results (evidence: `frontend/admin/modify_book.php`)
- Administrator → Publisher Shipments: confirms arrivals (evidence: `frontend/admin/confirm_shipments.php`)
- Administrator → Sales Reports: requests reports (evidence: `README.md`)
- Catalog Administration → Bookstore Database: maintains catalog records (evidence: `backend/admin/add_book.php`)
- Sales Reports → Session & Access Control: checks admin access (evidence: `backend/admin/reports.php`)
- Sales Reports → Bookstore Database: queries sales data (evidence: `backend/admin/reports.php`)
- Catalog Search → Database Connector: opens connection (evidence: `backend/customer/search.php`)
- Catalog Administration → Session & Access Control: guards book creation (evidence: `backend/admin/add_book.php`)
- Database Connector → Bookstore Database: connects (evidence: `config/db.php`)
- Bookstore Database → Reorder Triggers: applies stock triggers
