# mhnuc/bookstore architecture

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

- Interactive diagram: https://gitdiagram.com/mhnuc/bookstore
- Repository: https://github.com/mhnuc/bookstore

## Overview

BookVerse is a browser-based online bookstore. The main customer workflow is browsing and filtering books, adding them to a persistent cart, and submitting an order; account registration/sign-in and order history support returning customers. An admin area manages the book catalog and order statuses. The source index and excerpts show the main component wiring and service calls; the README contains no further product description, so some unsampled UI behavior is represented only at the component level.

Main entry points: [`src/App.jsx`](https://github.com/mhnuc/bookstore/blob/main/src/App.jsx) (App shell), [`src/context/AuthContext.jsx`](https://github.com/mhnuc/bookstore/blob/main/src/context/AuthContext.jsx) (Auth state), [`src/context/CartContext.jsx`](https://github.com/mhnuc/bookstore/blob/main/src/context/CartContext.jsx) (Cart state), [`src/services/bookService.js`](https://github.com/mhnuc/bookstore/blob/main/src/services/bookService.js) (Book catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_app["App shell<br/>[App.jsx]"]
  node_catalog["Book catalog<br/>[bookService.js]"]
  node_filters["Category filter<br/>[CategoryFilter.jsx]"]
  node_bookcard["Book card<br/>[BookCard.jsx]"]
  node_bookdetail["Book details"]
  node_hero["Hero banner<br/>[HeroBanner.jsx]"]
  node_informational["Store information<br/>[AboutModal.jsx]"]
  node_policy["Store policies<br/>[PolicyModal.jsx]"]
  node_contact["Contact form<br/>[ContactModal.jsx]"]
  node_navbar["Navigation<br/>[Navbar.jsx]"]
  node_mockdata["Mock book data<br/>[mockData.js]"]
end

subgraph group_identity["Accounts"]
  node_authui["Sign-in and registration<br/>[AuthModal.jsx]"]
  node_login["Login form<br/>[LoginModal.jsx]"]
  node_register["Registration form<br/>[RegisterModal.jsx]"]
  node_authstate["Auth state<br/>[AuthContext.jsx]"]
end

subgraph group_commerce["Cart and Orders"]
  node_cartstate["Cart state<br/>[CartContext.jsx]"]
  node_cartdrawer["Cart drawer<br/>[CartDrawer.jsx]"]
  node_checkout["Checkout<br/>[CheckoutModal.jsx]"]
  node_orders["Order service<br/>[orderService.js]"]
  node_history["Order history"]
end

subgraph group_operations["Store Operations"]
  node_admin["Admin panel<br/>[AdminPanel.jsx]"]
  node_configui["Backend configuration"]
  node_supabaseclient["Supabase client<br/>[supabase.js]"]
end

node_customer(("Shopper"))
node_supabase[("Supabase")]
node_browserstorage[("Browser storage")]

node_customer -->|"uses"| node_app
node_app -->|"fetches books"| node_catalog
node_app -->|"renders"| node_hero
node_app -->|"renders"| node_filters
node_app -->|"renders"| node_bookcard
node_app -->|"renders"| node_bookdetail
node_app -->|"renders"| node_navbar
node_app -->|"renders"| node_informational
node_app -->|"renders"| node_policy
node_app -->|"renders"| node_contact
node_app -->|"renders"| node_authui
node_app -->|"renders"| node_cartdrawer
node_app -->|"renders"| node_checkout
node_app -->|"renders"| node_history
node_app -->|"renders"| node_admin
node_app -->|"renders"| node_configui
node_bookcard -->|"adds items"| node_cartstate
node_bookdetail -->|"adds items"| node_cartstate
node_cartdrawer -->|"reads and updates"| node_cartstate
node_checkout -->|"reads and clears"| node_cartstate
node_checkout -->|"reads user"| node_authstate
node_checkout -->|"creates order"| node_orders
node_history -->|"fetches orders"| node_orders
node_authui -->|"selects"| node_login
node_authui -->|"selects"| node_register
node_login -->|"authenticates"| node_authstate
node_register -->|"registers user"| node_authstate
node_navbar -->|"reads and signs out"| node_authstate
node_navbar -->|"reads count"| node_cartstate
node_admin -->|"manages books"| node_catalog
node_admin -->|"manages orders"| node_orders
node_configui -->|"updates credentials"| node_supabaseclient
node_authstate -->|"uses client"| node_supabaseclient
node_catalog -->|"queries catalog"| node_supabaseclient
node_catalog -->|"falls back to"| node_mockdata
node_orders -->|"queries orders"| node_supabaseclient
node_supabaseclient -->|"connects to"| node_supabase
node_catalog -->|"reads and writes fallback"| node_browserstorage
node_orders -->|"reads and writes fallback"| node_browserstorage
node_cartstate -->|"persists cart"| node_browserstorage
node_authstate -->|"persists mock user"| node_browserstorage

click node_app "https://github.com/mhnuc/bookstore/blob/main/src/App.jsx"
click node_catalog "https://github.com/mhnuc/bookstore/blob/main/src/services/bookService.js"
click node_filters "https://github.com/mhnuc/bookstore/blob/main/src/components/CategoryFilter.jsx"
click node_bookcard "https://github.com/mhnuc/bookstore/blob/main/src/components/BookCard.jsx"
click node_bookdetail "https://github.com/mhnuc/bookstore/blob/main/src/components/BookDetailModal.jsx"
click node_hero "https://github.com/mhnuc/bookstore/blob/main/src/components/HeroBanner.jsx"
click node_informational "https://github.com/mhnuc/bookstore/blob/main/src/components/AboutModal.jsx"
click node_policy "https://github.com/mhnuc/bookstore/blob/main/src/components/PolicyModal.jsx"
click node_contact "https://github.com/mhnuc/bookstore/blob/main/src/components/ContactModal.jsx"
click node_navbar "https://github.com/mhnuc/bookstore/blob/main/src/components/Navbar.jsx"
click node_authui "https://github.com/mhnuc/bookstore/blob/main/src/components/AuthModal.jsx"
click node_login "https://github.com/mhnuc/bookstore/blob/main/src/components/LoginModal.jsx"
click node_register "https://github.com/mhnuc/bookstore/blob/main/src/components/RegisterModal.jsx"
click node_authstate "https://github.com/mhnuc/bookstore/blob/main/src/context/AuthContext.jsx"
click node_cartstate "https://github.com/mhnuc/bookstore/blob/main/src/context/CartContext.jsx"
click node_cartdrawer "https://github.com/mhnuc/bookstore/blob/main/src/components/CartDrawer.jsx"
click node_checkout "https://github.com/mhnuc/bookstore/blob/main/src/components/CheckoutModal.jsx"
click node_orders "https://github.com/mhnuc/bookstore/blob/main/src/services/orderService.js"
click node_history "https://github.com/mhnuc/bookstore/blob/main/src/components/OrderHistoryModal.jsx"
click node_admin "https://github.com/mhnuc/bookstore/blob/main/src/components/AdminPanel.jsx"
click node_configui "https://github.com/mhnuc/bookstore/blob/main/src/components/SupabaseConfigModal.jsx"
click node_supabaseclient "https://github.com/mhnuc/bookstore/blob/main/src/lib/supabase.js"
click node_mockdata "https://github.com/mhnuc/bookstore/blob/main/src/services/mockData.js"

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_catalog,node_filters,node_bookcard,node_bookdetail,node_hero,node_informational,node_policy,node_contact,node_navbar,node_mockdata toneBlue
class node_authui,node_login,node_register,node_authstate,node_supabase,node_browserstorage toneAmber
class node_cartstate,node_cartdrawer,node_checkout,node_orders,node_history toneMint
class node_admin,node_configui,node_supabaseclient toneRose
class node_customer toneIndigo
```

## Components

### Storefront

- [App shell](https://github.com/mhnuc/bookstore/blob/main/src/App.jsx): `src/App.jsx`
- [Book catalog](https://github.com/mhnuc/bookstore/blob/main/src/services/bookService.js): `src/services/bookService.js`
- [Category filter](https://github.com/mhnuc/bookstore/blob/main/src/components/CategoryFilter.jsx): `src/components/CategoryFilter.jsx`
- [Book card](https://github.com/mhnuc/bookstore/blob/main/src/components/BookCard.jsx): `src/components/BookCard.jsx`
- [Book details](https://github.com/mhnuc/bookstore/blob/main/src/components/BookDetailModal.jsx): `src/components/BookDetailModal.jsx`
- [Hero banner](https://github.com/mhnuc/bookstore/blob/main/src/components/HeroBanner.jsx): `src/components/HeroBanner.jsx`
- [Store information](https://github.com/mhnuc/bookstore/blob/main/src/components/AboutModal.jsx): `src/components/AboutModal.jsx`
- [Store policies](https://github.com/mhnuc/bookstore/blob/main/src/components/PolicyModal.jsx): `src/components/PolicyModal.jsx`
- [Contact form](https://github.com/mhnuc/bookstore/blob/main/src/components/ContactModal.jsx): `src/components/ContactModal.jsx`
- [Navigation](https://github.com/mhnuc/bookstore/blob/main/src/components/Navbar.jsx): `src/components/Navbar.jsx`
- [Mock book data](https://github.com/mhnuc/bookstore/blob/main/src/services/mockData.js): `src/services/mockData.js`

### Accounts

- [Sign-in and registration](https://github.com/mhnuc/bookstore/blob/main/src/components/AuthModal.jsx): `src/components/AuthModal.jsx`
- [Login form](https://github.com/mhnuc/bookstore/blob/main/src/components/LoginModal.jsx): `src/components/LoginModal.jsx`
- [Registration form](https://github.com/mhnuc/bookstore/blob/main/src/components/RegisterModal.jsx): `src/components/RegisterModal.jsx`
- [Auth state](https://github.com/mhnuc/bookstore/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`

### Cart and Orders

- [Cart state](https://github.com/mhnuc/bookstore/blob/main/src/context/CartContext.jsx): `src/context/CartContext.jsx`
- [Cart drawer](https://github.com/mhnuc/bookstore/blob/main/src/components/CartDrawer.jsx): `src/components/CartDrawer.jsx`
- [Checkout](https://github.com/mhnuc/bookstore/blob/main/src/components/CheckoutModal.jsx): `src/components/CheckoutModal.jsx`
- [Order service](https://github.com/mhnuc/bookstore/blob/main/src/services/orderService.js): `src/services/orderService.js`
- [Order history](https://github.com/mhnuc/bookstore/blob/main/src/components/OrderHistoryModal.jsx): `src/components/OrderHistoryModal.jsx`

### Store Operations

- [Admin panel](https://github.com/mhnuc/bookstore/blob/main/src/components/AdminPanel.jsx): `src/components/AdminPanel.jsx`
- [Backend configuration](https://github.com/mhnuc/bookstore/blob/main/src/components/SupabaseConfigModal.jsx): `src/components/SupabaseConfigModal.jsx`
- [Supabase client](https://github.com/mhnuc/bookstore/blob/main/src/lib/supabase.js): `src/lib/supabase.js`

### Other components

- **Shopper**
- **Supabase**
- **Browser storage**

## Connections

- Shopper → App shell: uses
- App shell → Book catalog: fetches books (evidence: `src/App.jsx`)
- App shell → Hero banner: renders (evidence: `src/App.jsx`)
- App shell → Category filter: renders (evidence: `src/App.jsx`)
- App shell → Book card: renders (evidence: `src/App.jsx`)
- App shell → Book details: renders (evidence: `src/App.jsx`)
- App shell → Navigation: renders (evidence: `src/App.jsx`)
- App shell → Store information: renders (evidence: `src/App.jsx`)
- App shell → Store policies: renders (evidence: `src/App.jsx`)
- App shell → Contact form: renders (evidence: `src/App.jsx`)
- App shell → Sign-in and registration: renders (evidence: `src/App.jsx`)
- App shell → Cart drawer: renders (evidence: `src/App.jsx`)
- App shell → Checkout: renders (evidence: `src/App.jsx`)
- App shell → Order history: renders (evidence: `src/App.jsx`)
- App shell → Admin panel: renders (evidence: `src/App.jsx`)
- App shell → Backend configuration: renders (evidence: `src/App.jsx`)
- Book card → Cart state: adds items (evidence: `src/components/BookCard.jsx`)
- Book details → Cart state: adds items (evidence: `src/components/BookDetailModal.jsx`)
- Cart drawer → Cart state: reads and updates (evidence: `src/components/CartDrawer.jsx`)
- Checkout → Cart state: reads and clears (evidence: `src/components/CheckoutModal.jsx`)
- Checkout → Auth state: reads user (evidence: `src/components/CheckoutModal.jsx`)
- Checkout → Order service: creates order (evidence: `src/components/CheckoutModal.jsx`)
- Order history → Order service: fetches orders (evidence: `src/components/OrderHistoryModal.jsx`)
- Sign-in and registration → Login form: selects (evidence: `src/components/AuthModal.jsx`)
- Sign-in and registration → Registration form: selects (evidence: `src/components/AuthModal.jsx`)
- Login form → Auth state: authenticates (evidence: `src/components/LoginModal.jsx`)
- Registration form → Auth state: registers user (evidence: `src/components/RegisterModal.jsx`)
- Navigation → Auth state: reads and signs out (evidence: `src/components/Navbar.jsx`)
- Navigation → Cart state: reads count (evidence: `src/components/Navbar.jsx`)
- Admin panel → Book catalog: manages books (evidence: `src/components/AdminPanel.jsx`)
- Admin panel → Order service: manages orders (evidence: `src/components/AdminPanel.jsx`)
- Backend configuration → Supabase client: updates credentials (evidence: `src/components/SupabaseConfigModal.jsx`)
- Auth state → Supabase client: uses client (evidence: `src/context/AuthContext.jsx`)
- Book catalog → Supabase client: queries catalog (evidence: `src/services/bookService.js`)
- Book catalog → Mock book data: falls back to (evidence: `src/services/bookService.js`)
- Order service → Supabase client: queries orders (evidence: `src/services/orderService.js`)
- Supabase client → Supabase: connects to
- Book catalog → Browser storage: reads and writes fallback (evidence: `src/services/bookService.js`)
- Order service → Browser storage: reads and writes fallback (evidence: `src/services/orderService.js`)
- Cart state → Browser storage: persists cart (evidence: `src/context/CartContext.jsx`)
- Auth state → Browser storage: persists mock user (evidence: `src/context/AuthContext.jsx`)
