# realstin/booksstore-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/realstin/booksstore-frontend
- Repository: https://github.com/realstin/booksstore-frontend

## Overview

BookStore is a book discovery and reading web app: visitors browse its public site and news, then sign in to explore books, save them to a personal library, and read with progress, bookmarks, and notes. The graph follows the documented router, auth/library contexts, dashboard pages, reader, and API boundary. It also preserves the public company/resource and newsletter/news capabilities. Evidence is limited to the README (empty), source index, and excerpts; unsampled capabilities are represented without asserting unshown call paths.

Main entry points: [`src/App.jsx`](https://github.com/realstin/booksstore-frontend/blob/main/src/App.jsx) (Route dispatcher), [`src/services/api.js`](https://github.com/realstin/booksstore-frontend/blob/main/src/services/api.js) (Backend API), [`src/pages/Dashboard/Dashboard.jsx`](https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/Dashboard.jsx) (Dashboard overview), [`src/pages/Dashboard/Library.jsx`](https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/Library.jsx) (Personal library)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and access"]
  node_app["Route dispatcher<br/>[App.jsx]"]
  node_authgate["Protected access<br/>[ProtectedRoute.jsx]"]
  node_login["Login and signup<br/>[Signup.jsx]"]
end

subgraph group_public["Public site and news"]
  node_home["Homepage<br/>[Homepage.jsx]"]
  node_marketing["Homepage sections"]
  node_about["About page<br/>[About.jsx]"]
  node_company["Company pages"]
  node_resources["Help and policies"]
  node_news["News pages"]
  node_newsdata["Article content<br/>[news.js]"]
  node_footer["Newsletter footer<br/>[Footer.jsx]"]
end

subgraph group_catalog["Books and library"]
  node_dashboard["Dashboard overview<br/>[Dashboard.jsx]"]
  node_explore["Book exploration<br/>[Explore.jsx]"]
  node_details["Book details<br/>[BookDetails.jsx]"]
  node_library["Personal library<br/>[Library.jsx]"]
  node_profile["Profile and settings<br/>[Profile.jsx]"]
  node_dashboardui["Dashboard layout and cards"]
end

subgraph group_reading["Reading tools"]
  node_reader["Book reader<br/>[BookReader.jsx]"]
  node_reader2["Reader alternative<br/>[BookReaderV2.jsx]"]
  node_progress[("Reading progress<br/>[readingProgress.js]")]
  node_preferences[("Reader preferences<br/>[preferences.js]")]
end

subgraph group_services["State and services"]
  node_auth["Session context<br/>[AuthContext.jsx]"]
  node_api["Backend API<br/>[api.js]"]
  node_libraryctx["Library context<br/>[LibraryContext.jsx]"]
end

node_visitor(("Visitor / reader"))
node_backend[("BookStore backend")]

node_visitor -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"guards routes"| node_authgate
node_app -->|"routes to"| node_news
node_app -->|"routes to"| node_about
node_app -->|"routes to"| node_resources
node_app -->|"routes to"| node_company
node_app -->|"routes to"| node_login
node_authgate -->|"checks session"| node_auth
node_auth -->|"verifies session"| node_api
node_api -->|"requests data"| node_backend
node_home -.->|"renders sections"| node_marketing
node_news -->|"loads articles"| node_newsdata
node_news -.->|"requests news"| node_api
node_footer -->|"subscribes email"| node_api
node_app -.->|"routes to"| node_dashboard
node_app -->|"routes to"| node_explore
node_app -->|"routes to"| node_library
node_app -->|"routes to"| node_details
node_app -.->|"selects reader"| node_reader
node_app -->|"selects alternate"| node_reader2
node_app -->|"routes to"| node_profile
node_library -->|"uses library state"| node_libraryctx
node_libraryctx -->|"loads and updates"| node_api
node_dashboard -->|"fetches dashboard data"| node_api
node_explore -->|"fetches books"| node_api
node_details -->|"fetches book"| node_api
node_details -->|"uses library state"| node_libraryctx
node_dashboard -->|"reads history"| node_progress
node_library -->|"reads progress"| node_progress
node_dashboard -->|"renders cards"| node_dashboardui
node_explore -->|"renders cards"| node_dashboardui
node_library -->|"renders cards"| node_dashboardui
node_reader -->|"loads book tools"| node_api
node_reader -.->|"records position"| node_progress
node_reader -.->|"uses preferences"| node_preferences
node_reader2 -->|"fetches reader data"| node_api
node_login -.->|"updates session"| node_auth
node_app -->|"reads auth state"| node_auth

click node_app "https://github.com/realstin/booksstore-frontend/blob/main/src/App.jsx"
click node_authgate "https://github.com/realstin/booksstore-frontend/blob/main/src/components/ProtectedRoute.jsx"
click node_auth "https://github.com/realstin/booksstore-frontend/blob/main/src/context/AuthContext.jsx"
click node_api "https://github.com/realstin/booksstore-frontend/blob/main/src/services/api.js"
click node_libraryctx "https://github.com/realstin/booksstore-frontend/blob/main/src/context/LibraryContext.jsx"
click node_home "https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Homepage.jsx"
click node_marketing "https://github.com/realstin/booksstore-frontend/tree/main/src/components/Homepage"
click node_about "https://github.com/realstin/booksstore-frontend/blob/main/src/pages/About.jsx"
click node_company "https://github.com/realstin/booksstore-frontend/tree/main/src/pages/Company"
click node_resources "https://github.com/realstin/booksstore-frontend/tree/main/src/pages/Resources"
click node_news "https://github.com/realstin/booksstore-frontend/tree/main/src/pages/News"
click node_newsdata "https://github.com/realstin/booksstore-frontend/blob/main/src/data/news.js"
click node_login "https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Signup.jsx"
click node_dashboard "https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/Dashboard.jsx"
click node_explore "https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/Explore.jsx"
click node_details "https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/BookDetails.jsx"
click node_library "https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/Library.jsx"
click node_profile "https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/Profile.jsx"
click node_reader "https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/BookReader.jsx"
click node_reader2 "https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/BookReaderV2.jsx"
click node_progress "https://github.com/realstin/booksstore-frontend/blob/main/src/utils/readingProgress.js"
click node_preferences "https://github.com/realstin/booksstore-frontend/blob/main/src/utils/preferences.js"
click node_dashboardui "https://github.com/realstin/booksstore-frontend/tree/main/src/components/Dashboard"
click node_footer "https://github.com/realstin/booksstore-frontend/blob/main/src/components/Homepage/Footer.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_authgate,node_login toneBlue
class node_home,node_marketing,node_about,node_company,node_resources,node_news,node_newsdata,node_footer,node_backend toneAmber
class node_dashboard,node_explore,node_details,node_library,node_profile,node_dashboardui toneMint
class node_reader,node_reader2,node_progress,node_preferences toneRose
class node_auth,node_api,node_libraryctx,node_visitor toneIndigo
```

## Components

### App entry and access

- [Route dispatcher](https://github.com/realstin/booksstore-frontend/blob/main/src/App.jsx): `src/App.jsx`
- [Protected access](https://github.com/realstin/booksstore-frontend/blob/main/src/components/ProtectedRoute.jsx): `src/components/ProtectedRoute.jsx`
- [Login and signup](https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Signup.jsx): `src/pages/Signup.jsx`

### Public site and news

- [Homepage](https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Homepage.jsx): `src/pages/Homepage.jsx`
- [Homepage sections](https://github.com/realstin/booksstore-frontend/tree/main/src/components/Homepage): `src/components/Homepage`
- [About page](https://github.com/realstin/booksstore-frontend/blob/main/src/pages/About.jsx): `src/pages/About.jsx`
- [Company pages](https://github.com/realstin/booksstore-frontend/tree/main/src/pages/Company): `src/pages/Company`
- [Help and policies](https://github.com/realstin/booksstore-frontend/tree/main/src/pages/Resources): `src/pages/Resources`
- [News pages](https://github.com/realstin/booksstore-frontend/tree/main/src/pages/News): `src/pages/News`
- [Article content](https://github.com/realstin/booksstore-frontend/blob/main/src/data/news.js): `src/data/news.js`
- [Newsletter footer](https://github.com/realstin/booksstore-frontend/blob/main/src/components/Homepage/Footer.jsx): `src/components/Homepage/Footer.jsx`

### Books and library

- [Dashboard overview](https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/Dashboard.jsx): `src/pages/Dashboard/Dashboard.jsx`
- [Book exploration](https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/Explore.jsx): `src/pages/Dashboard/Explore.jsx`
- [Book details](https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/BookDetails.jsx): `src/pages/Dashboard/BookDetails.jsx`
- [Personal library](https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/Library.jsx): `src/pages/Dashboard/Library.jsx`
- [Profile and settings](https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/Profile.jsx): `src/pages/Dashboard/Profile.jsx`
- [Dashboard layout and cards](https://github.com/realstin/booksstore-frontend/tree/main/src/components/Dashboard): `src/components/Dashboard`

### Reading tools

- [Book reader](https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/BookReader.jsx): `src/pages/Dashboard/BookReader.jsx`
- [Reader alternative](https://github.com/realstin/booksstore-frontend/blob/main/src/pages/Dashboard/BookReaderV2.jsx): `src/pages/Dashboard/BookReaderV2.jsx`
- [Reading progress](https://github.com/realstin/booksstore-frontend/blob/main/src/utils/readingProgress.js): `src/utils/readingProgress.js`
- [Reader preferences](https://github.com/realstin/booksstore-frontend/blob/main/src/utils/preferences.js): `src/utils/preferences.js`

### State and services

- [Session context](https://github.com/realstin/booksstore-frontend/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [Backend API](https://github.com/realstin/booksstore-frontend/blob/main/src/services/api.js): `src/services/api.js`
- [Library context](https://github.com/realstin/booksstore-frontend/blob/main/src/context/LibraryContext.jsx): `src/context/LibraryContext.jsx`

### Other components

- **Visitor / reader**
- **BookStore backend**

## Connections

- Visitor / reader → Route dispatcher: opens (evidence: `src/App.jsx`)
- Route dispatcher → Homepage: routes to (evidence: `src/App.jsx`)
- Route dispatcher → Protected access: guards routes (evidence: `src/App.jsx`)
- Route dispatcher → News pages: routes to (evidence: `src/App.jsx`)
- Route dispatcher → About page: routes to (evidence: `src/App.jsx`)
- Route dispatcher → Help and policies: routes to (evidence: `src/App.jsx`)
- Route dispatcher → Company pages: routes to (evidence: `src/App.jsx`)
- Route dispatcher → Login and signup: routes to (evidence: `src/App.jsx`)
- Protected access → Session context: checks session (evidence: `src/components/ProtectedRoute.jsx`)
- Session context → Backend API: verifies session (evidence: `src/context/AuthContext.jsx`)
- Backend API → BookStore backend: requests data (evidence: `src/services/api.js`)
- Homepage → Homepage sections: renders sections
- News pages → Article content: loads articles (evidence: `src/pages/News/News.jsx`)
- News pages → Backend API: requests news (evidence: `src/pages/News/NewsArticle.jsx`)
- Newsletter footer → Backend API: subscribes email (evidence: `src/components/Homepage/Footer.jsx`)
- Route dispatcher → Dashboard overview: routes to (evidence: `src/App.jsx`)
- Route dispatcher → Book exploration: routes to (evidence: `src/App.jsx`)
- Route dispatcher → Personal library: routes to (evidence: `src/App.jsx`)
- Route dispatcher → Book details: routes to (evidence: `src/App.jsx`)
- Route dispatcher → Book reader: selects reader (evidence: `src/App.jsx`)
- Route dispatcher → Reader alternative: selects alternate (evidence: `src/App.jsx`)
- Route dispatcher → Profile and settings: routes to (evidence: `src/App.jsx`)
- Personal library → Library context: uses library state (evidence: `src/pages/Dashboard/Library.jsx`)
- Library context → Backend API: loads and updates (evidence: `src/context/LibraryContext.jsx`)
- Dashboard overview → Backend API: fetches dashboard data (evidence: `src/pages/Dashboard/Dashboard.jsx`)
- Book exploration → Backend API: fetches books (evidence: `src/pages/Dashboard/Explore.jsx`)
- Book details → Backend API: fetches book (evidence: `src/pages/Dashboard/BookDetails.jsx`)
- Book details → Library context: uses library state (evidence: `src/pages/Dashboard/BookDetails.jsx`)
- Dashboard overview → Reading progress: reads history (evidence: `src/pages/Dashboard/Dashboard.jsx`)
- Personal library → Reading progress: reads progress (evidence: `src/pages/Dashboard/Library.jsx`)
- Dashboard overview → Dashboard layout and cards: renders cards (evidence: `src/pages/Dashboard/Dashboard.jsx`)
- Book exploration → Dashboard layout and cards: renders cards (evidence: `src/pages/Dashboard/Explore.jsx`)
- Personal library → Dashboard layout and cards: renders cards (evidence: `src/pages/Dashboard/Library.jsx`)
- Book reader → Backend API: loads book tools (evidence: `src/pages/Dashboard/BookReader.jsx`)
- Book reader → Reading progress: records position (evidence: `src/pages/Dashboard/BookReader.jsx`)
- Book reader → Reader preferences: uses preferences
- Reader alternative → Backend API: fetches reader data (evidence: `src/pages/Dashboard/BookReaderV2.jsx`)
- Login and signup → Session context: updates session
- Route dispatcher → Session context: reads auth state (evidence: `src/App.jsx`)
