# mh06a/book-store-website architecture

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

- Interactive diagram: https://gitdiagram.com/mh06a/book-store-website
- Repository: https://github.com/mh06a/book-store-website

## Overview

This PHP bookstore application supports account registration and login, book browsing/details, favorites, recently opened books, and profile/account management. Its likely user workflow is to browse books, open a detail page, and save favorites or recent items; authenticated users can also manage their profiles. The graph shows controller-to-model calls where the excerpts establish them. JavaScript-to-endpoint and page-to-action wiring is not evidenced in the supplied excerpts, so those links are omitted.

Main entry points: [`Model/DatabaseConnection.php`](https://github.com/mh06a/book-store-website/blob/main/Model/DatabaseConnection.php) (Database connection), [`Model/DatabaseOperations.php`](https://github.com/mh06a/book-store-website/blob/main/Model/DatabaseOperations.php) (User operations), [`Model/FavoriteOperations.php`](https://github.com/mh06a/book-store-website/blob/main/Model/FavoriteOperations.php) (Favorite and recent operations), [`Controller/register_action.php`](https://github.com/mh06a/book-store-website/blob/main/Controller/register_action.php) (Register account)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Bookstore pages"]
  node_home["Book browsing<br/>[home.php]"]
  node_details["Book details<br/>[book_details.html]"]
  node_auth_pages["Login and registration<br/>[Login.html]"]
  node_profile_page["Profile page<br/>[profile.html]"]
  node_favorite_page["Favorites page<br/>[favoriteBook.html]"]
end

subgraph group_controllers["Request handlers"]
  node_register["Register account"]
  node_login["Authenticate user<br/>[login_action.php]"]
  node_profile["Load profile<br/>[profile.php]"]
  node_update_profile["Update profile<br/>[update_profile.php]"]
  node_delete_account["Delete account<br/>[delete_account.php]"]
  node_favorite_action["Change favorites"]
  node_favorites["List favorites<br/>[get_favorites.php]"]
  node_add_recent["Record recent book<br/>[add_recent.php]"]
  node_get_recent["List recent books<br/>[get_recent.php]"]
end

subgraph group_models["Application data"]
  node_user_ops["User operations"]
  node_favorite_ops["Favorite and recent operations"]
  node_db_connection["Database connection"]
end

node_visitor(("Visitor"))
node_mysql[("MySQL database")]

node_register -->|"registers via"| node_user_ops
node_login -->|"authenticates via"| node_user_ops
node_profile -->|"loads user via"| node_user_ops
node_delete_account -->|"deletes via"| node_user_ops
node_favorite_action -->|"changes favorites via"| node_favorite_ops
node_favorites -->|"reads favorites via"| node_favorite_ops
node_add_recent -->|"records via"| node_favorite_ops
node_get_recent -->|"reads recents via"| node_favorite_ops
node_register -->|"loads connection"| node_db_connection
node_login -->|"loads connection"| node_db_connection
node_profile -->|"loads connection"| node_db_connection
node_delete_account -->|"loads connection"| node_db_connection
node_favorite_action -->|"loads connection"| node_db_connection
node_favorites -->|"loads connection"| node_db_connection
node_add_recent -->|"loads connection"| node_db_connection
node_get_recent -->|"loads connection"| node_db_connection
node_db_connection -->|"connects to"| node_mysql

click node_home "https://github.com/mh06a/book-store-website/blob/main/View/home.php"
click node_details "https://github.com/mh06a/book-store-website/blob/main/View/book_details.html"
click node_auth_pages "https://github.com/mh06a/book-store-website/blob/main/View/Login.html"
click node_profile_page "https://github.com/mh06a/book-store-website/blob/main/View/profile.html"
click node_favorite_page "https://github.com/mh06a/book-store-website/blob/main/View/favoriteBook.html"
click node_register "https://github.com/mh06a/book-store-website/blob/main/Controller/register_action.php"
click node_login "https://github.com/mh06a/book-store-website/blob/main/Controller/login_action.php"
click node_profile "https://github.com/mh06a/book-store-website/blob/main/Controller/profile.php"
click node_update_profile "https://github.com/mh06a/book-store-website/blob/main/Controller/update_profile.php"
click node_delete_account "https://github.com/mh06a/book-store-website/blob/main/Controller/delete_account.php"
click node_favorite_action "https://github.com/mh06a/book-store-website/blob/main/Controller/favorite_action.php"
click node_favorites "https://github.com/mh06a/book-store-website/blob/main/Controller/get_favorites.php"
click node_add_recent "https://github.com/mh06a/book-store-website/blob/main/Controller/add_recent.php"
click node_get_recent "https://github.com/mh06a/book-store-website/blob/main/Controller/get_recent.php"
click node_user_ops "https://github.com/mh06a/book-store-website/blob/main/Model/DatabaseOperations.php"
click node_favorite_ops "https://github.com/mh06a/book-store-website/blob/main/Model/FavoriteOperations.php"
click node_db_connection "https://github.com/mh06a/book-store-website/blob/main/Model/DatabaseConnection.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_details,node_auth_pages,node_profile_page,node_favorite_page toneBlue
class node_register,node_login,node_profile,node_update_profile,node_delete_account,node_favorite_action,node_favorites,node_add_recent,node_get_recent,node_mysql toneAmber
class node_user_ops,node_favorite_ops,node_db_connection toneMint
class node_visitor toneIndigo
```

## Components

### Bookstore pages

- [Book browsing](https://github.com/mh06a/book-store-website/blob/main/View/home.php): `View/home.php`
- [Book details](https://github.com/mh06a/book-store-website/blob/main/View/book_details.html): `View/book_details.html`
- [Login and registration](https://github.com/mh06a/book-store-website/blob/main/View/Login.html): `View/Login.html`
- [Profile page](https://github.com/mh06a/book-store-website/blob/main/View/profile.html): `View/profile.html`
- [Favorites page](https://github.com/mh06a/book-store-website/blob/main/View/favoriteBook.html): `View/favoriteBook.html`

### Request handlers

- [Register account](https://github.com/mh06a/book-store-website/blob/main/Controller/register_action.php): `Controller/register_action.php`
- [Authenticate user](https://github.com/mh06a/book-store-website/blob/main/Controller/login_action.php): `Controller/login_action.php`
- [Load profile](https://github.com/mh06a/book-store-website/blob/main/Controller/profile.php): `Controller/profile.php`
- [Update profile](https://github.com/mh06a/book-store-website/blob/main/Controller/update_profile.php): `Controller/update_profile.php`
- [Delete account](https://github.com/mh06a/book-store-website/blob/main/Controller/delete_account.php): `Controller/delete_account.php`
- [Change favorites](https://github.com/mh06a/book-store-website/blob/main/Controller/favorite_action.php): `Controller/favorite_action.php`
- [List favorites](https://github.com/mh06a/book-store-website/blob/main/Controller/get_favorites.php): `Controller/get_favorites.php`
- [Record recent book](https://github.com/mh06a/book-store-website/blob/main/Controller/add_recent.php): `Controller/add_recent.php`
- [List recent books](https://github.com/mh06a/book-store-website/blob/main/Controller/get_recent.php): `Controller/get_recent.php`

### Application data

- [User operations](https://github.com/mh06a/book-store-website/blob/main/Model/DatabaseOperations.php): `Model/DatabaseOperations.php`
- [Favorite and recent operations](https://github.com/mh06a/book-store-website/blob/main/Model/FavoriteOperations.php): `Model/FavoriteOperations.php`
- [Database connection](https://github.com/mh06a/book-store-website/blob/main/Model/DatabaseConnection.php): `Model/DatabaseConnection.php`

### Other components

- **Visitor**
- **MySQL database**

## Connections

- Register account → User operations: registers via (evidence: `Controller/register_action.php`)
- Authenticate user → User operations: authenticates via (evidence: `Controller/login_action.php`)
- Load profile → User operations: loads user via (evidence: `Controller/profile.php`)
- Delete account → User operations: deletes via (evidence: `Controller/delete_account.php`)
- Change favorites → Favorite and recent operations: changes favorites via (evidence: `Controller/favorite_action.php`)
- List favorites → Favorite and recent operations: reads favorites via (evidence: `Controller/get_favorites.php`)
- Record recent book → Favorite and recent operations: records via (evidence: `Controller/add_recent.php`)
- List recent books → Favorite and recent operations: reads recents via (evidence: `Controller/get_recent.php`)
- Register account → Database connection: loads connection (evidence: `Controller/register_action.php`)
- Authenticate user → Database connection: loads connection (evidence: `Controller/login_action.php`)
- Load profile → Database connection: loads connection (evidence: `Controller/profile.php`)
- Delete account → Database connection: loads connection (evidence: `Controller/delete_account.php`)
- Change favorites → Database connection: loads connection (evidence: `Controller/favorite_action.php`)
- List favorites → Database connection: loads connection (evidence: `Controller/get_favorites.php`)
- Record recent book → Database connection: loads connection (evidence: `Controller/add_recent.php`)
- List recent books → Database connection: loads connection (evidence: `Controller/get_recent.php`)
- Database connection → MySQL database: connects to (evidence: `Model/DatabaseConnection.php`)
