# faheemahamed/bookhubclient architecture

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

- Interactive diagram: https://gitdiagram.com/faheemahamed/bookhubclient
- Repository: https://github.com/faheemahamed/bookhubclient

## Overview

BookHub is a React digital-library frontend for readers, publishers, and administrators. Visitors discover books and view details; registered users can request publisher status, publishers submit and manage books and handle requests, and administrators review publisher applications and book submissions and manage the catalog. App.jsx provides routing and role-gated areas, while shared authentication and toast contexts support those workflows. The frontend calls an external API; the excerpts show selected requests, but not a backend implementation or the full behavior of every page.

Main entry points: [`src/App.jsx`](https://github.com/faheemahamed/bookhubclient/blob/main/src/App.jsx) (Routing and access), [`src/pages/Home.jsx`](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/Home.jsx) (Home), [`src/pages/publisher/PublisherDashboard.jsx`](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/publisher/PublisherDashboard.jsx) (Publisher catalog), [`src/pages/admin/PendingBooks.jsx`](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/admin/PendingBooks.jsx) (Review submissions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["App and shared state"]
  node_app["Routing and access<br/>[App.jsx]"]
  node_auth["Authentication state<br/>[AuthContext.jsx]"]
  node_toast["Toast notifications<br/>[ToastContext.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
end

subgraph group_reader["Reader experience"]
  node_home["Home<br/>[Home.jsx]"]
  node_books["Book discovery<br/>[Books.jsx]"]
  node_details["Book details<br/>[BookDetails.jsx]"]
  node_about["About<br/>[About.jsx]"]
  node_contact["Contact<br/>[Contact.jsx]"]
  node_login["Login<br/>[Login.jsx]"]
  node_register["Registration<br/>[Register.jsx]"]
  node_become["Publisher application"]
  node_footer["Site footer<br/>[Footer.jsx]"]
  node_counter["Home counters<br/>[Counter.jsx]"]
end

subgraph group_publisher["Publisher workflow"]
  node_publisher_dash["Publisher catalog"]
  node_add_book["Book submission<br/>[AddBook.jsx]"]
  node_book_requests["Publisher requests<br/>[BookRequests.jsx]"]
  node_publisher_sidebar["Publisher navigation"]
  node_edit["Book edit modal<br/>[EditBookModal.jsx]"]
end

subgraph group_admin["Administration"]
  node_admin_dash["Admin overview<br/>[AdminDashboard.jsx]"]
  node_publisher_review["Review publishers"]
  node_book_review["Review submissions<br/>[PendingBooks.jsx]"]
  node_manage_books["Manage catalog<br/>[ManageBooks.jsx]"]
  node_admin_sidebar["Admin navigation<br/>[AdminSidebar.jsx]"]
  node_confirm["Confirmation modal<br/>[ConfirmModal.jsx]"]
end

node_visitor(("Visitor or user"))
node_api{{"BookHub API"}}

node_visitor -->|"opens"| node_app
node_app -->|"provides auth"| node_auth
node_app -->|"provides toasts"| node_toast
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_books
node_app -->|"routes to"| node_details
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_register
node_app -->|"routes to"| node_become
node_app -->|"guards route"| node_publisher_dash
node_app -->|"guards route"| node_book_requests
node_app -->|"guards route"| node_publisher_review
node_app -->|"guards route"| node_book_review
node_app -->|"guards route"| node_manage_books
node_home -->|"links to"| node_books
node_home -.->|"fetches content"| node_api
node_book_review -->|"fetches and updates"| node_api
node_publisher_dash -->|"fetches and deletes"| node_api
node_publisher_dash -->|"opens"| node_edit
node_edit -->|"updates book"| node_api
node_book_review -->|"confirms action"| node_confirm
node_publisher_dash -->|"notifies"| node_toast
node_book_review -->|"notifies"| node_toast
node_login -->|"sets session"| node_auth
node_home -->|"renders"| node_navbar
node_home -->|"renders"| node_footer
node_home -->|"renders"| node_counter
node_publisher_dash -->|"renders"| node_publisher_sidebar
node_book_review -->|"renders"| node_admin_sidebar
node_publisher_dash -->|"renders"| node_navbar
node_book_review -->|"renders"| node_navbar
node_details -->|"renders"| node_navbar
node_details -->|"renders"| node_footer
node_visitor -.->|"visits"| node_about
node_visitor -.->|"visits"| node_contact
node_visitor -.->|"admin access"| node_admin_dash
node_visitor -.->|"publisher access"| node_add_book

click node_app "https://github.com/faheemahamed/bookhubclient/blob/main/src/App.jsx"
click node_auth "https://github.com/faheemahamed/bookhubclient/blob/main/src/context/AuthContext.jsx"
click node_toast "https://github.com/faheemahamed/bookhubclient/blob/main/src/context/ToastContext.jsx"
click node_home "https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/Home.jsx"
click node_books "https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/user/Books.jsx"
click node_details "https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/user/BookDetails.jsx"
click node_about "https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/About.jsx"
click node_contact "https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/Contact.jsx"
click node_login "https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/auth/Login.jsx"
click node_register "https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/auth/Register.jsx"
click node_become "https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/user/BecomePublisher.jsx"
click node_publisher_dash "https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/publisher/PublisherDashboard.jsx"
click node_add_book "https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/publisher/AddBook.jsx"
click node_book_requests "https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/publisher/BookRequests.jsx"
click node_admin_dash "https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/admin/AdminDashboard.jsx"
click node_publisher_review "https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/admin/PublisherRequests.jsx"
click node_book_review "https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/admin/PendingBooks.jsx"
click node_manage_books "https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/admin/ManageBooks.jsx"
click node_navbar "https://github.com/faheemahamed/bookhubclient/blob/main/src/components/Navbar.jsx"
click node_admin_sidebar "https://github.com/faheemahamed/bookhubclient/blob/main/src/components/AdminSidebar.jsx"
click node_publisher_sidebar "https://github.com/faheemahamed/bookhubclient/blob/main/src/components/PublisherSidebar.jsx"
click node_confirm "https://github.com/faheemahamed/bookhubclient/blob/main/src/components/ConfirmModal.jsx"
click node_edit "https://github.com/faheemahamed/bookhubclient/blob/main/src/components/EditBookModal.jsx"
click node_footer "https://github.com/faheemahamed/bookhubclient/blob/main/src/components/Footer.jsx"
click node_counter "https://github.com/faheemahamed/bookhubclient/blob/main/src/components/Counter.jsx"

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_app,node_auth,node_toast,node_navbar,node_visitor toneBlue
class node_home,node_books,node_details,node_about,node_contact,node_login,node_register,node_become,node_footer,node_counter toneAmber
class node_publisher_dash,node_add_book,node_book_requests,node_publisher_sidebar,node_edit,node_api toneMint
class node_admin_dash,node_publisher_review,node_book_review,node_manage_books,node_admin_sidebar,node_confirm toneRose
```

## Components

### App and shared state

- [Routing and access](https://github.com/faheemahamed/bookhubclient/blob/main/src/App.jsx): `src/App.jsx`
- [Authentication state](https://github.com/faheemahamed/bookhubclient/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [Toast notifications](https://github.com/faheemahamed/bookhubclient/blob/main/src/context/ToastContext.jsx): `src/context/ToastContext.jsx`
- [Navigation](https://github.com/faheemahamed/bookhubclient/blob/main/src/components/Navbar.jsx): `src/components/Navbar.jsx`

### Reader experience

- [Home](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`
- [Book discovery](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/user/Books.jsx): `src/pages/user/Books.jsx`
- [Book details](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/user/BookDetails.jsx): `src/pages/user/BookDetails.jsx`
- [About](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/About.jsx): `src/pages/About.jsx`
- [Contact](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/Contact.jsx): `src/pages/Contact.jsx`
- [Login](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/auth/Login.jsx): `src/pages/auth/Login.jsx`
- [Registration](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/auth/Register.jsx): `src/pages/auth/Register.jsx`
- [Publisher application](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/user/BecomePublisher.jsx): `src/pages/user/BecomePublisher.jsx`
- [Site footer](https://github.com/faheemahamed/bookhubclient/blob/main/src/components/Footer.jsx): `src/components/Footer.jsx`
- [Home counters](https://github.com/faheemahamed/bookhubclient/blob/main/src/components/Counter.jsx): `src/components/Counter.jsx`

### Publisher workflow

- [Publisher catalog](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/publisher/PublisherDashboard.jsx): `src/pages/publisher/PublisherDashboard.jsx`
- [Book submission](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/publisher/AddBook.jsx): `src/pages/publisher/AddBook.jsx`
- [Publisher requests](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/publisher/BookRequests.jsx): `src/pages/publisher/BookRequests.jsx`
- [Publisher navigation](https://github.com/faheemahamed/bookhubclient/blob/main/src/components/PublisherSidebar.jsx): `src/components/PublisherSidebar.jsx`
- [Book edit modal](https://github.com/faheemahamed/bookhubclient/blob/main/src/components/EditBookModal.jsx): `src/components/EditBookModal.jsx`

### Administration

- [Admin overview](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/admin/AdminDashboard.jsx): `src/pages/admin/AdminDashboard.jsx`
- [Review publishers](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/admin/PublisherRequests.jsx): `src/pages/admin/PublisherRequests.jsx`
- [Review submissions](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/admin/PendingBooks.jsx): `src/pages/admin/PendingBooks.jsx`
- [Manage catalog](https://github.com/faheemahamed/bookhubclient/blob/main/src/pages/admin/ManageBooks.jsx): `src/pages/admin/ManageBooks.jsx`
- [Admin navigation](https://github.com/faheemahamed/bookhubclient/blob/main/src/components/AdminSidebar.jsx): `src/components/AdminSidebar.jsx`
- [Confirmation modal](https://github.com/faheemahamed/bookhubclient/blob/main/src/components/ConfirmModal.jsx): `src/components/ConfirmModal.jsx`

### Other components

- **Visitor or user**
- **BookHub API**

## Connections

- Visitor or user → Routing and access: opens (evidence: `src/App.jsx`)
- Routing and access → Authentication state: provides auth (evidence: `src/App.jsx`)
- Routing and access → Toast notifications: provides toasts (evidence: `src/App.jsx`)
- Routing and access → Home: routes to (evidence: `src/App.jsx`)
- Routing and access → Book discovery: routes to (evidence: `src/App.jsx`)
- Routing and access → Book details: routes to (evidence: `src/App.jsx`)
- Routing and access → Login: routes to (evidence: `src/App.jsx`)
- Routing and access → Registration: routes to (evidence: `src/App.jsx`)
- Routing and access → Publisher application: routes to (evidence: `src/App.jsx`)
- Routing and access → Publisher catalog: guards route (evidence: `src/App.jsx`)
- Routing and access → Publisher requests: guards route (evidence: `src/App.jsx`)
- Routing and access → Review publishers: guards route (evidence: `src/App.jsx`)
- Routing and access → Review submissions: guards route (evidence: `src/App.jsx`)
- Routing and access → Manage catalog: guards route (evidence: `src/App.jsx`)
- Home → Book discovery: links to (evidence: `src/pages/Home.jsx`)
- Home → BookHub API: fetches content
- Review submissions → BookHub API: fetches and updates (evidence: `src/pages/admin/PendingBooks.jsx`)
- Publisher catalog → BookHub API: fetches and deletes (evidence: `src/pages/publisher/PublisherDashboard.jsx`)
- Publisher catalog → Book edit modal: opens (evidence: `src/pages/publisher/PublisherDashboard.jsx`)
- Book edit modal → BookHub API: updates book (evidence: `src/components/EditBookModal.jsx`)
- Review submissions → Confirmation modal: confirms action (evidence: `src/pages/admin/PendingBooks.jsx`)
- Publisher catalog → Toast notifications: notifies (evidence: `src/pages/publisher/PublisherDashboard.jsx`)
- Review submissions → Toast notifications: notifies (evidence: `src/pages/admin/PendingBooks.jsx`)
- Login → Authentication state: sets session (evidence: `src/pages/auth/Login.jsx`)
- Home → Navigation: renders (evidence: `src/pages/Home.jsx`)
- Home → Site footer: renders (evidence: `src/pages/Home.jsx`)
- Home → Home counters: renders (evidence: `src/pages/Home.jsx`)
- Publisher catalog → Publisher navigation: renders (evidence: `src/pages/publisher/PublisherDashboard.jsx`)
- Review submissions → Admin navigation: renders (evidence: `src/pages/admin/PendingBooks.jsx`)
- Publisher catalog → Navigation: renders (evidence: `src/pages/publisher/PublisherDashboard.jsx`)
- Review submissions → Navigation: renders (evidence: `src/pages/admin/PendingBooks.jsx`)
- Book details → Navigation: renders (evidence: `src/pages/user/BookDetails.jsx`)
- Book details → Site footer: renders (evidence: `src/pages/user/BookDetails.jsx`)
- Visitor or user → About: visits
- Visitor or user → Contact: visits
- Visitor or user → Admin overview: admin access
- Visitor or user → Book submission: publisher access
