# mahamudul496/uiu-bookhub architecture

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

- Interactive diagram: https://gitdiagram.com/mahamudul496/uiu-bookhub
- Repository: https://github.com/mahamudul496/uiu-bookhub

## Overview

UIU BookHUB is a student marketplace for buying, selling, donating, and discovering academic materials. Students browse approved listings, then can save items, request purchases, message sellers, and review completed transactions; sellers submit listings and respond to requests, while admins review submissions. The graph groups the documented capabilities into user-facing pages and PHP API domains, with authentication and MySQL access as shared internal layers. API-to-auth and API-to-database links are shown where source excerpts or the index support them; page-to-endpoint wiring is not established by the available evidence.

Main entry points: [`config/auth.php`](https://github.com/mahamudul496/uiu-bookhub/blob/main/config/auth.php) (Auth and sessions), [`config/database.php`](https://github.com/mahamudul496/uiu-bookhub/blob/main/config/database.php) (MySQL connection), [`api/listings/create.php`](https://github.com/mahamudul496/uiu-bookhub/blob/main/api/listings/create.php) (Listing submissions), [`api/donations`](https://github.com/mahamudul496/uiu-bookhub/tree/main/api/donations) (Donation listings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webpages["Public pages"]
  node_studentpages["Student pages"]
  node_clientjs["Browser JavaScript"]
end

subgraph group_identity["Identity and access"]
  node_loginapi["Login API<br/>[login.php]"]
  node_authapi["Session APIs"]
  node_authcore["Auth and sessions<br/>[auth.php]"]
  node_database[("MySQL connection<br/>[database.php]")]
end

subgraph group_market["Marketplace and giving"]
  node_listingbrowse["Listing discovery"]
  node_listingcreate["Listing submissions<br/>[create.php]"]
  node_donations["Donation listings"]
end

subgraph group_transactions["Student transactions"]
  node_wishlist["Wishlist"]
  node_purchases["Purchase requests"]
  node_messages["Student chat"]
  node_reviews["Seller reviews"]
end

subgraph group_operations["Admin operations"]
  node_adminpages["Admin pages"]
  node_adminapi["Admin review APIs"]
end

node_students(("Students"))
node_admins(("Admins"))

node_students -->|"browse and discover"| node_webpages
node_students -->|"use student tools"| node_studentpages
node_admins -->|"manage listings"| node_adminpages
node_webpages -.->|"use browser scripts"| node_clientjs
node_studentpages -.->|"use browser scripts"| node_clientjs
node_students -->|"sign in"| node_loginapi
node_loginapi -->|"loads auth helpers"| node_authcore
node_authapi -->|"loads auth helpers"| node_authcore
node_authcore -->|"opens database"| node_database
node_listingcreate -->|"checks student session"| node_authcore
node_listingcreate -->|"inserts listings"| node_database
node_listingbrowse -->|"queries approved listings"| node_database
node_donations -->|"loads auth helpers"| node_authcore
node_donations -->|"queries donations"| node_database
node_wishlist -->|"checks student session"| node_authcore
node_purchases -->|"checks student session"| node_authcore
node_messages -->|"checks student session"| node_authcore
node_reviews -->|"checks student session"| node_authcore
node_adminapi -->|"checks admin access"| node_authcore
node_adminapi -->|"updates review status"| node_database

click node_studentpages "https://github.com/mahamudul496/uiu-bookhub/tree/main/student"
click node_clientjs "https://github.com/mahamudul496/uiu-bookhub/tree/main/js"
click node_loginapi "https://github.com/mahamudul496/uiu-bookhub/blob/main/api/auth/login.php"
click node_authapi "https://github.com/mahamudul496/uiu-bookhub/tree/main/api/auth"
click node_authcore "https://github.com/mahamudul496/uiu-bookhub/blob/main/config/auth.php"
click node_listingbrowse "https://github.com/mahamudul496/uiu-bookhub/tree/main/api/listings"
click node_listingcreate "https://github.com/mahamudul496/uiu-bookhub/blob/main/api/listings/create.php"
click node_donations "https://github.com/mahamudul496/uiu-bookhub/tree/main/api/donations"
click node_wishlist "https://github.com/mahamudul496/uiu-bookhub/tree/main/api/wishlist"
click node_purchases "https://github.com/mahamudul496/uiu-bookhub/tree/main/api/purchases"
click node_messages "https://github.com/mahamudul496/uiu-bookhub/tree/main/api/messages"
click node_reviews "https://github.com/mahamudul496/uiu-bookhub/tree/main/api/reviews"
click node_adminpages "https://github.com/mahamudul496/uiu-bookhub/tree/main/admin"
click node_adminapi "https://github.com/mahamudul496/uiu-bookhub/tree/main/api/admin"
click node_database "https://github.com/mahamudul496/uiu-bookhub/blob/main/config/database.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_webpages,node_studentpages,node_clientjs toneBlue
class node_loginapi,node_authapi,node_authcore,node_database toneAmber
class node_listingbrowse,node_listingcreate,node_donations toneMint
class node_wishlist,node_purchases,node_messages,node_reviews toneRose
class node_adminpages,node_adminapi,node_students,node_admins toneIndigo
```

## Components

### Web experience

- **Public pages**
- [Student pages](https://github.com/mahamudul496/uiu-bookhub/tree/main/student): `student`
- [Browser JavaScript](https://github.com/mahamudul496/uiu-bookhub/tree/main/js): `js`

### Identity and access

- [Login API](https://github.com/mahamudul496/uiu-bookhub/blob/main/api/auth/login.php): `api/auth/login.php`
- [Session APIs](https://github.com/mahamudul496/uiu-bookhub/tree/main/api/auth): `api/auth`
- [Auth and sessions](https://github.com/mahamudul496/uiu-bookhub/blob/main/config/auth.php): `config/auth.php`
- [MySQL connection](https://github.com/mahamudul496/uiu-bookhub/blob/main/config/database.php): `config/database.php`

### Marketplace and giving

- [Listing discovery](https://github.com/mahamudul496/uiu-bookhub/tree/main/api/listings): `api/listings`
- [Listing submissions](https://github.com/mahamudul496/uiu-bookhub/blob/main/api/listings/create.php): `api/listings/create.php`
- [Donation listings](https://github.com/mahamudul496/uiu-bookhub/tree/main/api/donations): `api/donations`

### Student transactions

- [Wishlist](https://github.com/mahamudul496/uiu-bookhub/tree/main/api/wishlist): `api/wishlist`
- [Purchase requests](https://github.com/mahamudul496/uiu-bookhub/tree/main/api/purchases): `api/purchases`
- [Student chat](https://github.com/mahamudul496/uiu-bookhub/tree/main/api/messages): `api/messages`
- [Seller reviews](https://github.com/mahamudul496/uiu-bookhub/tree/main/api/reviews): `api/reviews`

### Admin operations

- [Admin pages](https://github.com/mahamudul496/uiu-bookhub/tree/main/admin): `admin`
- [Admin review APIs](https://github.com/mahamudul496/uiu-bookhub/tree/main/api/admin): `api/admin`

### Other components

- **Students**
- **Admins**

## Connections

- Students → Public pages: browse and discover (evidence: `README.md`)
- Students → Student pages: use student tools (evidence: `README.md`)
- Admins → Admin pages: manage listings (evidence: `README.md`)
- Public pages → Browser JavaScript: use browser scripts
- Student pages → Browser JavaScript: use browser scripts
- Students → Login API: sign in (evidence: `README.md`)
- Login API → Auth and sessions: loads auth helpers (evidence: `api/auth/login.php`)
- Session APIs → Auth and sessions: loads auth helpers (evidence: `api/auth/me.php`)
- Auth and sessions → MySQL connection: opens database (evidence: `config/auth.php`)
- Listing submissions → Auth and sessions: checks student session (evidence: `api/listings/create.php`)
- Listing submissions → MySQL connection: inserts listings (evidence: `api/listings/create.php`)
- Listing discovery → MySQL connection: queries approved listings (evidence: `api/listings/list.php`)
- Donation listings → Auth and sessions: loads auth helpers (evidence: `api/donations/create.php`)
- Donation listings → MySQL connection: queries donations (evidence: `api/donations/list.php`)
- Wishlist → Auth and sessions: checks student session (evidence: `api/wishlist/toggle.php`)
- Purchase requests → Auth and sessions: checks student session (evidence: `api/purchases/respond.php`)
- Student chat → Auth and sessions: checks student session (evidence: `api/messages/start.php`)
- Seller reviews → Auth and sessions: checks student session (evidence: `api/reviews/create.php`)
- Admin review APIs → Auth and sessions: checks admin access (evidence: `api/admin/review.php`)
- Admin review APIs → MySQL connection: updates review status (evidence: `api/admin/review.php`)
