# roy-jade/blablabook architecture

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

- Interactive diagram: https://gitdiagram.com/roy-jade/blablabook
- Repository: https://github.com/roy-jade/blablabook

## Overview

Blablabook is a personal-library web app: readers browse/search books, inspect book details and community ratings, then manage owned titles and their own reading feedback; registered users can manage their accounts. The graph combines sampled call sites and explicit README capabilities. Backend domain controllers not excerpted are represented by their exact controller paths; their detailed internal calls are not inferred.

Main entry points: [`frontend/src/api/api.js`](https://github.com/roy-jade/blablabook/blob/main/frontend/src/api/api.js) (API client), [`frontend/src/App.jsx`](https://github.com/roy-jade/blablabook/blob/main/frontend/src/App.jsx) (React application), [`backend/routers/router.js`](https://github.com/roy-jade/blablabook/blob/main/backend/routers/router.js) (HTTP routing), [`backend/config/db.js`](https://github.com/roy-jade/blablabook/blob/main/backend/config/db.js) (SQL connection pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Reader experience"]
  node_spa["React application<br/>[App.jsx]"]
  node_userctx["User session context"]
  node_libraryui["Book browsing<br/>[Library.jsx]"]
  node_bookui["Book details and reviews<br/>[BookID.jsx]"]
  node_booktiles["Book cards<br/>[BookMini.jsx]"]
  node_ownershipui["Ownership controls<br/>[BookOwnership.jsx]"]
  node_ratingui["Ratings and comments<br/>[RatingInput.jsx]"]
  node_carousel["Book suggestions<br/>[Carousel.jsx]"]
  node_accountui["Registration and account<br/>[Register.jsx]"]
  node_dashboard["Account settings<br/>[Dashboard.jsx]"]
  node_http["API client<br/>[api.js]"]
end

subgraph group_api["Backend API"]
  node_routes["HTTP routing<br/>[router.js]"]
  node_authroutes["Auth routing<br/>[authRouter.js]"]
  node_auth["Authentication and accounts<br/>[auth.js]"]
  node_jwt["JWT authorization<br/>[checkJWT.js]"]
  node_catalog["Public book catalogue<br/>[library.js]"]
  node_search["Catalogue search<br/>[openLibrary.js]"]
  node_personal["Personal library and reviews<br/>[personalLibrary.js]"]
  node_movements["Library book changes<br/>[bookMovements.js]"]
end

subgraph group_data["Persistence and catalogue"]
  node_olservice["OpenLibrary integration<br/>[OpenLibrary.js]"]
  node_cache["Search cache<br/>[cache.js]"]
  node_dbclient["SQL connection pool<br/>[db.js]"]
  node_postgres[("PostgreSQL")]
end

node_reader(("Reader"))
node_openlibrary["OpenLibrary"]

node_reader -->|"uses"| node_spa
node_spa -->|"provides session"| node_userctx
node_spa -->|"loads session"| node_http
node_spa -->|"routes to"| node_libraryui
node_spa -->|"routes to"| node_bookui
node_spa -->|"routes to"| node_accountui
node_spa -->|"routes to"| node_dashboard
node_libraryui -->|"requests books"| node_http
node_libraryui -->|"renders"| node_booktiles
node_bookui -->|"requests details"| node_http
node_bookui -->|"renders"| node_ownershipui
node_bookui -->|"renders"| node_ratingui
node_bookui -->|"renders"| node_carousel
node_ownershipui -->|"updates ownership"| node_http
node_ratingui -->|"submits rating"| node_http
node_accountui -->|"registers"| node_http
node_dashboard -.->|"updates account"| node_http
node_http -->|"sends API requests"| node_routes
node_http -->|"sends auth requests"| node_authroutes
node_routes -->|"dispatches"| node_catalog
node_routes -->|"dispatches"| node_search
node_routes -->|"dispatches"| node_personal
node_routes -->|"dispatches"| node_movements
node_authroutes -->|"dispatches"| node_auth
node_authroutes -->|"guards routes"| node_jwt
node_routes -->|"guards routes"| node_jwt
node_auth -->|"queries"| node_dbclient
node_jwt -->|"checks user"| node_dbclient
node_catalog -->|"queries"| node_dbclient
node_personal -->|"queries"| node_dbclient
node_movements -->|"queries"| node_dbclient
node_dbclient -.->|"queries"| node_postgres
node_search -->|"searches catalogue"| node_olservice
node_search -->|"uses cache"| node_cache
node_movements -->|"enriches books"| node_olservice
node_movements -->|"uses cache"| node_cache
node_olservice -->|"fetches book data"| node_openlibrary

click node_spa "https://github.com/roy-jade/blablabook/blob/main/frontend/src/App.jsx"
click node_userctx "https://github.com/roy-jade/blablabook/blob/main/frontend/src/contexts/CurrentUserContext.js"
click node_libraryui "https://github.com/roy-jade/blablabook/blob/main/frontend/src/pages/Library/Library.jsx"
click node_bookui "https://github.com/roy-jade/blablabook/blob/main/frontend/src/pages/BookID/BookID.jsx"
click node_booktiles "https://github.com/roy-jade/blablabook/blob/main/frontend/src/components/BookMini/BookMini.jsx"
click node_ownershipui "https://github.com/roy-jade/blablabook/blob/main/frontend/src/components/BookOwnership/BookOwnership.jsx"
click node_ratingui "https://github.com/roy-jade/blablabook/blob/main/frontend/src/components/RatingInput/RatingInput.jsx"
click node_carousel "https://github.com/roy-jade/blablabook/blob/main/frontend/src/components/Carousel/Carousel.jsx"
click node_accountui "https://github.com/roy-jade/blablabook/blob/main/frontend/src/pages/Register/Register.jsx"
click node_dashboard "https://github.com/roy-jade/blablabook/blob/main/frontend/src/pages/Dashboard/Dashboard.jsx"
click node_http "https://github.com/roy-jade/blablabook/blob/main/frontend/src/api/api.js"
click node_routes "https://github.com/roy-jade/blablabook/blob/main/backend/routers/router.js"
click node_authroutes "https://github.com/roy-jade/blablabook/blob/main/backend/routers/authRouter.js"
click node_auth "https://github.com/roy-jade/blablabook/blob/main/backend/controllers/auth.js"
click node_jwt "https://github.com/roy-jade/blablabook/blob/main/backend/middleware/checkJWT.js"
click node_catalog "https://github.com/roy-jade/blablabook/blob/main/backend/controllers/library.js"
click node_search "https://github.com/roy-jade/blablabook/blob/main/backend/controllers/openLibrary.js"
click node_personal "https://github.com/roy-jade/blablabook/blob/main/backend/controllers/personalLibrary.js"
click node_movements "https://github.com/roy-jade/blablabook/blob/main/backend/controllers/bookMovements.js"
click node_olservice "https://github.com/roy-jade/blablabook/blob/main/backend/services/OpenLibrary.js"
click node_cache "https://github.com/roy-jade/blablabook/blob/main/backend/config/cache.js"
click node_dbclient "https://github.com/roy-jade/blablabook/blob/main/backend/config/db.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_spa,node_userctx,node_libraryui,node_bookui,node_booktiles,node_ownershipui,node_ratingui,node_carousel,node_accountui,node_dashboard,node_http toneBlue
class node_routes,node_authroutes,node_auth,node_jwt,node_catalog,node_search,node_personal,node_movements toneAmber
class node_olservice,node_cache,node_dbclient,node_postgres toneMint
class node_reader,node_openlibrary toneIndigo
```

## Components

### Reader experience

- [React application](https://github.com/roy-jade/blablabook/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [User session context](https://github.com/roy-jade/blablabook/blob/main/frontend/src/contexts/CurrentUserContext.js): `frontend/src/contexts/CurrentUserContext.js`
- [Book browsing](https://github.com/roy-jade/blablabook/blob/main/frontend/src/pages/Library/Library.jsx): `frontend/src/pages/Library/Library.jsx`
- [Book details and reviews](https://github.com/roy-jade/blablabook/blob/main/frontend/src/pages/BookID/BookID.jsx): `frontend/src/pages/BookID/BookID.jsx`
- [Book cards](https://github.com/roy-jade/blablabook/blob/main/frontend/src/components/BookMini/BookMini.jsx): `frontend/src/components/BookMini/BookMini.jsx`
- [Ownership controls](https://github.com/roy-jade/blablabook/blob/main/frontend/src/components/BookOwnership/BookOwnership.jsx): `frontend/src/components/BookOwnership/BookOwnership.jsx`
- [Ratings and comments](https://github.com/roy-jade/blablabook/blob/main/frontend/src/components/RatingInput/RatingInput.jsx): `frontend/src/components/RatingInput/RatingInput.jsx`
- [Book suggestions](https://github.com/roy-jade/blablabook/blob/main/frontend/src/components/Carousel/Carousel.jsx): `frontend/src/components/Carousel/Carousel.jsx`
- [Registration and account](https://github.com/roy-jade/blablabook/blob/main/frontend/src/pages/Register/Register.jsx): `frontend/src/pages/Register/Register.jsx`
- [Account settings](https://github.com/roy-jade/blablabook/blob/main/frontend/src/pages/Dashboard/Dashboard.jsx): `frontend/src/pages/Dashboard/Dashboard.jsx`
- [API client](https://github.com/roy-jade/blablabook/blob/main/frontend/src/api/api.js): `frontend/src/api/api.js`

### Backend API

- [HTTP routing](https://github.com/roy-jade/blablabook/blob/main/backend/routers/router.js): `backend/routers/router.js`
- [Auth routing](https://github.com/roy-jade/blablabook/blob/main/backend/routers/authRouter.js): `backend/routers/authRouter.js`
- [Authentication and accounts](https://github.com/roy-jade/blablabook/blob/main/backend/controllers/auth.js): `backend/controllers/auth.js`
- [JWT authorization](https://github.com/roy-jade/blablabook/blob/main/backend/middleware/checkJWT.js): `backend/middleware/checkJWT.js`
- [Public book catalogue](https://github.com/roy-jade/blablabook/blob/main/backend/controllers/library.js): `backend/controllers/library.js`
- [Catalogue search](https://github.com/roy-jade/blablabook/blob/main/backend/controllers/openLibrary.js): `backend/controllers/openLibrary.js`
- [Personal library and reviews](https://github.com/roy-jade/blablabook/blob/main/backend/controllers/personalLibrary.js): `backend/controllers/personalLibrary.js`
- [Library book changes](https://github.com/roy-jade/blablabook/blob/main/backend/controllers/bookMovements.js): `backend/controllers/bookMovements.js`

### Persistence and catalogue

- [OpenLibrary integration](https://github.com/roy-jade/blablabook/blob/main/backend/services/OpenLibrary.js): `backend/services/OpenLibrary.js`
- [Search cache](https://github.com/roy-jade/blablabook/blob/main/backend/config/cache.js): `backend/config/cache.js`
- [SQL connection pool](https://github.com/roy-jade/blablabook/blob/main/backend/config/db.js): `backend/config/db.js`
- **PostgreSQL**

### Other components

- **Reader**
- **OpenLibrary**

## Connections

- Reader → React application: uses (evidence: `frontend/src/App.jsx`)
- React application → User session context: provides session (evidence: `frontend/src/App.jsx`)
- React application → API client: loads session (evidence: `frontend/src/App.jsx`)
- React application → Book browsing: routes to (evidence: `frontend/src/App.jsx`)
- React application → Book details and reviews: routes to (evidence: `frontend/src/App.jsx`)
- React application → Registration and account: routes to (evidence: `frontend/src/App.jsx`)
- React application → Account settings: routes to (evidence: `frontend/src/App.jsx`)
- Book browsing → API client: requests books (evidence: `frontend/src/pages/Library/Library.jsx`)
- Book browsing → Book cards: renders (evidence: `frontend/src/pages/Library/Library.jsx`)
- Book details and reviews → API client: requests details (evidence: `frontend/src/pages/BookID/BookID.jsx`)
- Book details and reviews → Ownership controls: renders (evidence: `frontend/src/pages/BookID/BookID.jsx`)
- Book details and reviews → Ratings and comments: renders (evidence: `frontend/src/pages/BookID/BookID.jsx`)
- Book details and reviews → Book suggestions: renders (evidence: `frontend/src/pages/BookID/BookID.jsx`)
- Ownership controls → API client: updates ownership (evidence: `frontend/src/components/BookOwnership/BookOwnership.jsx`)
- Ratings and comments → API client: submits rating (evidence: `frontend/src/components/RatingInput/RatingInput.jsx`)
- Registration and account → API client: registers (evidence: `frontend/src/pages/Register/Register.jsx`)
- Account settings → API client: updates account
- API client → HTTP routing: sends API requests (evidence: `frontend/src/api/api.js`)
- API client → Auth routing: sends auth requests (evidence: `frontend/src/api/api.js`)
- HTTP routing → Public book catalogue: dispatches (evidence: `backend/routers/router.js`)
- HTTP routing → Catalogue search: dispatches (evidence: `backend/routers/router.js`)
- HTTP routing → Personal library and reviews: dispatches (evidence: `backend/routers/router.js`)
- HTTP routing → Library book changes: dispatches (evidence: `backend/routers/router.js`)
- Auth routing → Authentication and accounts: dispatches (evidence: `backend/routers/authRouter.js`)
- Auth routing → JWT authorization: guards routes (evidence: `backend/routers/authRouter.js`)
- HTTP routing → JWT authorization: guards routes (evidence: `backend/routers/router.js`)
- Authentication and accounts → SQL connection pool: queries (evidence: `backend/controllers/auth.js`)
- JWT authorization → SQL connection pool: checks user (evidence: `backend/middleware/checkJWT.js`)
- Public book catalogue → SQL connection pool: queries (evidence: `backend/controllers/library.js`)
- Personal library and reviews → SQL connection pool: queries (evidence: `backend/controllers/personalLibrary.js`)
- Library book changes → SQL connection pool: queries (evidence: `backend/controllers/bookMovements.js`)
- SQL connection pool → PostgreSQL: queries
- Catalogue search → OpenLibrary integration: searches catalogue (evidence: `backend/controllers/openLibrary.js`)
- Catalogue search → Search cache: uses cache (evidence: `backend/controllers/openLibrary.js`)
- Library book changes → OpenLibrary integration: enriches books (evidence: `backend/controllers/bookMovements.js`)
- Library book changes → Search cache: uses cache (evidence: `backend/controllers/bookMovements.js`)
- OpenLibrary integration → OpenLibrary: fetches book data (evidence: `backend/services/OpenLibrary.js`)
