# lacklotus28-bit/pagewise architecture

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

- Interactive diagram: https://gitdiagram.com/lacklotus28-bit/pagewise
- Repository: https://github.com/lacklotus28-bit/pagewise

## Overview

Pagewise is a Windows desktop EPUB/PDF library and reader. Users import books by picker, folder, or drop; the import hook extracts metadata and covers and adds books to the persisted library. They organize and select a book, then App routes to its EPUB or PDF reader. Reading updates position and statistics; EPUB readers also expose navigation, bookmarks, search, and customization. The README documents these capabilities; relationships involving unsampled panels and the PDF implementation are limited to explicit imports or documented behavior.

Main entry points: [`src/components/Library/LibraryView.tsx`](https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Library/LibraryView.tsx) (Library View), [`src/components/Reader/ReaderView.tsx`](https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Reader/ReaderView.tsx) (EPUB Reader), [`src/store/libraryStore.ts`](https://github.com/lacklotus28-bit/pagewise/blob/main/src/store/libraryStore.ts) (Library Store), [`src/components/Library/BookCard.tsx`](https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Library/BookCard.tsx) (Book Cards)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_library["Library &amp; Import"]
  node_app["App Router<br/>[App.tsx]"]
  node_library_view["Library View<br/>[LibraryView.tsx]"]
  node_book_cards["Book Cards<br/>[BookCard.tsx]"]
  node_shelf_sidebar["Shelf Sidebar<br/>[Sidebar.tsx]"]
  node_metadata_editor["Metadata Editor<br/>[MetadataEditor.tsx]"]
  node_reading_stats["Reading Stats<br/>[StatsPanel.tsx]"]
  node_import_hook["Book Import<br/>[useBookImport.ts]"]
  node_file_drop["File Drop<br/>[useFileDrop.ts]"]
end

subgraph group_reading["Reading"]
  node_epub_reader["EPUB Reader<br/>[ReaderView.tsx]"]
  node_pdf_reader["PDF Reader<br/>[PdfReaderView.tsx]"]
  node_toc_panel["Contents Panel<br/>[TocPanel.tsx]"]
  node_bookmarks_panel["Bookmarks Panel<br/>[BookmarksPanel.tsx]"]
  node_search_bar["Reader Search<br/>[SearchBar.tsx]"]
  node_settings_panel["Reader Settings<br/>[SettingsPanel.tsx]"]
end

subgraph group_state["State &amp; Persistence"]
  node_library_store["Library Store<br/>[libraryStore.ts]"]
  node_settings_store["Settings Store<br/>[settingsStore.ts]"]
end

subgraph group_shared["Shared Services"]
  node_cover_storage[("Cover Files<br/>[coverStorage.ts]")]
  node_text_sanitization["Text Sanitization<br/>[text.ts]"]
end

node_reader(("Reader"))

node_reader -->|"manages books"| node_library_view
node_library_view -->|"imports files"| node_import_hook
node_library_view -->|"registers drop"| node_file_drop
node_file_drop -.->|"delivers paths"| node_import_hook
node_import_hook -->|"queues books"| node_library_store
node_import_hook -->|"saves covers"| node_cover_storage
node_library_view -->|"renders cards"| node_book_cards
node_library_view -->|"renders sidebar"| node_shelf_sidebar
node_library_view -->|"renders stats"| node_reading_stats
node_book_cards -->|"opens editor"| node_metadata_editor
node_book_cards -->|"updates selection"| node_library_store
node_metadata_editor -->|"updates metadata"| node_library_store
node_shelf_sidebar -->|"updates shelves"| node_library_store
node_library_store -->|"persists covers"| node_cover_storage
node_book_cards -->|"resolves cover"| node_cover_storage
node_book_cards -->|"sanitizes author"| node_text_sanitization
node_library_view -->|"sorts authors"| node_text_sanitization
node_app -->|"shows library"| node_library_view
node_app -->|"routes EPUB"| node_epub_reader
node_app -->|"routes PDF"| node_pdf_reader
node_epub_reader -->|"saves progress"| node_library_store
node_pdf_reader -->|"tracks reading"| node_library_store
node_epub_reader -->|"reads settings"| node_settings_store
node_pdf_reader -->|"reads settings"| node_settings_store
node_epub_reader -->|"renders contents"| node_toc_panel
node_epub_reader -->|"renders bookmarks"| node_bookmarks_panel
node_epub_reader -->|"renders search"| node_search_bar
node_epub_reader -->|"renders settings"| node_settings_panel
node_settings_panel -->|"updates preferences"| node_settings_store

click node_app "https://github.com/lacklotus28-bit/pagewise/blob/main/src/App.tsx"
click node_library_view "https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Library/LibraryView.tsx"
click node_book_cards "https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Library/BookCard.tsx"
click node_shelf_sidebar "https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Library/Sidebar.tsx"
click node_metadata_editor "https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Library/MetadataEditor.tsx"
click node_reading_stats "https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Library/StatsPanel.tsx"
click node_import_hook "https://github.com/lacklotus28-bit/pagewise/blob/main/src/hooks/useBookImport.ts"
click node_file_drop "https://github.com/lacklotus28-bit/pagewise/blob/main/src/hooks/useFileDrop.ts"
click node_epub_reader "https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Reader/ReaderView.tsx"
click node_pdf_reader "https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Reader/PdfReaderView.tsx"
click node_toc_panel "https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Reader/TocPanel.tsx"
click node_bookmarks_panel "https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Reader/BookmarksPanel.tsx"
click node_search_bar "https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Reader/SearchBar.tsx"
click node_settings_panel "https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Settings/SettingsPanel.tsx"
click node_library_store "https://github.com/lacklotus28-bit/pagewise/blob/main/src/store/libraryStore.ts"
click node_settings_store "https://github.com/lacklotus28-bit/pagewise/blob/main/src/store/settingsStore.ts"
click node_cover_storage "https://github.com/lacklotus28-bit/pagewise/blob/main/src/utils/coverStorage.ts"
click node_text_sanitization "https://github.com/lacklotus28-bit/pagewise/blob/main/src/utils/text.ts"

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_library_view,node_book_cards,node_shelf_sidebar,node_metadata_editor,node_reading_stats,node_import_hook,node_file_drop toneBlue
class node_epub_reader,node_pdf_reader,node_toc_panel,node_bookmarks_panel,node_search_bar,node_settings_panel toneAmber
class node_library_store,node_settings_store toneMint
class node_cover_storage,node_text_sanitization toneRose
class node_reader toneIndigo
```

## Components

### Library & Import

- [App Router](https://github.com/lacklotus28-bit/pagewise/blob/main/src/App.tsx): `src/App.tsx`
- [Library View](https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Library/LibraryView.tsx): `src/components/Library/LibraryView.tsx`
- [Book Cards](https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Library/BookCard.tsx): `src/components/Library/BookCard.tsx`
- [Shelf Sidebar](https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Library/Sidebar.tsx): `src/components/Library/Sidebar.tsx`
- [Metadata Editor](https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Library/MetadataEditor.tsx): `src/components/Library/MetadataEditor.tsx`
- [Reading Stats](https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Library/StatsPanel.tsx): `src/components/Library/StatsPanel.tsx`
- [Book Import](https://github.com/lacklotus28-bit/pagewise/blob/main/src/hooks/useBookImport.ts): `src/hooks/useBookImport.ts`
- [File Drop](https://github.com/lacklotus28-bit/pagewise/blob/main/src/hooks/useFileDrop.ts): `src/hooks/useFileDrop.ts`

### Reading

- [EPUB Reader](https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Reader/ReaderView.tsx): `src/components/Reader/ReaderView.tsx`
- [PDF Reader](https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Reader/PdfReaderView.tsx): `src/components/Reader/PdfReaderView.tsx`
- [Contents Panel](https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Reader/TocPanel.tsx): `src/components/Reader/TocPanel.tsx`
- [Bookmarks Panel](https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Reader/BookmarksPanel.tsx): `src/components/Reader/BookmarksPanel.tsx`
- [Reader Search](https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Reader/SearchBar.tsx): `src/components/Reader/SearchBar.tsx`
- [Reader Settings](https://github.com/lacklotus28-bit/pagewise/blob/main/src/components/Settings/SettingsPanel.tsx): `src/components/Settings/SettingsPanel.tsx`

### State & Persistence

- [Library Store](https://github.com/lacklotus28-bit/pagewise/blob/main/src/store/libraryStore.ts): `src/store/libraryStore.ts`
- [Settings Store](https://github.com/lacklotus28-bit/pagewise/blob/main/src/store/settingsStore.ts): `src/store/settingsStore.ts`

### Shared Services

- [Cover Files](https://github.com/lacklotus28-bit/pagewise/blob/main/src/utils/coverStorage.ts): `src/utils/coverStorage.ts`
- [Text Sanitization](https://github.com/lacklotus28-bit/pagewise/blob/main/src/utils/text.ts): `src/utils/text.ts`

### Other components

- **Reader**

## Connections

- Reader → Library View: manages books (evidence: `README.md`)
- Library View → Book Import: imports files (evidence: `src/components/Library/LibraryView.tsx`)
- Library View → File Drop: registers drop (evidence: `src/components/Library/LibraryView.tsx`)
- File Drop → Book Import: delivers paths
- Book Import → Library Store: queues books (evidence: `src/hooks/useBookImport.ts`)
- Book Import → Cover Files: saves covers (evidence: `src/hooks/useBookImport.ts`)
- Library View → Book Cards: renders cards (evidence: `src/components/Library/LibraryView.tsx`)
- Library View → Shelf Sidebar: renders sidebar (evidence: `src/components/Library/LibraryView.tsx`)
- Library View → Reading Stats: renders stats (evidence: `src/components/Library/LibraryView.tsx`)
- Book Cards → Metadata Editor: opens editor (evidence: `src/components/Library/BookCard.tsx`)
- Book Cards → Library Store: updates selection (evidence: `src/components/Library/BookCard.tsx`)
- Metadata Editor → Library Store: updates metadata (evidence: `src/components/Library/MetadataEditor.tsx`)
- Shelf Sidebar → Library Store: updates shelves (evidence: `src/components/Library/Sidebar.tsx`)
- Library Store → Cover Files: persists covers (evidence: `src/store/libraryStore.ts`)
- Book Cards → Cover Files: resolves cover (evidence: `src/components/Library/BookCard.tsx`)
- Book Cards → Text Sanitization: sanitizes author (evidence: `src/components/Library/BookCard.tsx`)
- Library View → Text Sanitization: sorts authors (evidence: `src/components/Library/LibraryView.tsx`)
- App Router → Library View: shows library (evidence: `src/App.tsx`)
- App Router → EPUB Reader: routes EPUB (evidence: `src/App.tsx`)
- App Router → PDF Reader: routes PDF (evidence: `src/App.tsx`)
- EPUB Reader → Library Store: saves progress (evidence: `src/components/Reader/ReaderView.tsx`)
- PDF Reader → Library Store: tracks reading (evidence: `src/components/Reader/PdfReaderView.tsx`)
- EPUB Reader → Settings Store: reads settings (evidence: `src/components/Reader/ReaderView.tsx`)
- PDF Reader → Settings Store: reads settings (evidence: `src/components/Reader/PdfReaderView.tsx`)
- EPUB Reader → Contents Panel: renders contents (evidence: `src/components/Reader/ReaderView.tsx`)
- EPUB Reader → Bookmarks Panel: renders bookmarks (evidence: `src/components/Reader/ReaderView.tsx`)
- EPUB Reader → Reader Search: renders search (evidence: `src/components/Reader/ReaderView.tsx`)
- EPUB Reader → Reader Settings: renders settings (evidence: `src/components/Reader/ReaderView.tsx`)
- Reader Settings → Settings Store: updates preferences (evidence: `src/components/Settings/SettingsPanel.tsx`)
