# nepovtor/history-author-preview architecture

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

- Interactive diagram: https://gitdiagram.com/nepovtor/history-author-preview
- Repository: https://github.com/nepovtor/history-author-preview

## Overview

HIStory is a browser-based illustrated memoir reader. Its main path is reader navigation through chapter text and image frames, with progress and annotations retained locally. The graph also includes the documented map, diary, archive, bonus, backup/restore, and offline-reading capabilities. Source excerpts show the storage and offline mechanisms; other app routes are documented in the README or exposed by app.js excerpts, so their internal details are kept at the app boundary.

Main entry points: [`app.js`](https://github.com/nepovtor/history-author-preview/blob/main/app.js) (Reader app), [`offline.js`](https://github.com/nepovtor/history-author-preview/blob/main/offline.js) (Offline settings), [`storage.js`](https://github.com/nepovtor/history-author-preview/blob/main/storage.js) (Local persistence), [`sw.js`](https://github.com/nepovtor/history-author-preview/blob/main/sw.js) (Service worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_reading["Reading experience"]
  node_reader["Reader app<br/>[app.js]"]
  node_map["Story map<br/>[app.js]"]
  node_glass["Glass effects<br/>[glass.js]"]
end

subgraph group_content["Story content"]
  node_chapters["Chapter narratives<br/>[story.js]"]
  node_archive["Photo archive<br/>[story.js]"]
  node_bonus["Bonus content<br/>[app.js]"]
  node_offline_assets["Chapter assets"]
end

subgraph group_personal["Reader data"]
  node_diary["Diary and notes<br/>[app.js]"]
  node_bookmarks["Bookmarks and progress<br/>[app.js]"]
  node_reading_state["Reading state<br/>[app.js]"]
  node_local_store[("Local persistence<br/>[storage.js]")]
  node_backup["Backup and restore<br/>[app.js]"]
end

subgraph group_platform["Browser platform"]
  node_browser_db[("IndexedDB")]
  node_offline_controls["Offline settings<br/>[offline.js]"]
  node_service_worker["Service worker<br/>[sw.js]"]
  node_cache[("Browser cache")]
end

node_browser(("Reader"))
node_cross_tab(("Other tabs"))

node_browser -->|"opens"| node_reader
node_reader -->|"renders"| node_chapters
node_reader -->|"routes to"| node_map
node_reader -->|"routes to"| node_diary
node_reader -->|"routes to"| node_bookmarks
node_reader -->|"routes to"| node_archive
node_reader -->|"routes to"| node_bonus
node_reader -->|"updates"| node_reading_state
node_reader -->|"saves"| node_local_store
node_reader -->|"exports / restores"| node_backup
node_local_store -->|"reads / writes"| node_browser_db
node_local_store -->|"broadcasts changes"| node_cross_tab
node_reader -->|"refreshes"| node_offline_controls
node_offline_controls -->|"loads manifest"| node_offline_assets
node_offline_controls -->|"registers"| node_service_worker
node_offline_controls -->|"downloads / clears"| node_cache
node_service_worker -->|"serves cached files"| node_cache
node_reader -->|"refreshes effects"| node_glass

click node_reader "https://github.com/nepovtor/history-author-preview/blob/main/app.js"
click node_chapters "https://github.com/nepovtor/history-author-preview/blob/main/story.js"
click node_map "https://github.com/nepovtor/history-author-preview/blob/main/app.js"
click node_diary "https://github.com/nepovtor/history-author-preview/blob/main/app.js"
click node_bookmarks "https://github.com/nepovtor/history-author-preview/blob/main/app.js"
click node_archive "https://github.com/nepovtor/history-author-preview/blob/main/story.js"
click node_bonus "https://github.com/nepovtor/history-author-preview/blob/main/app.js"
click node_reading_state "https://github.com/nepovtor/history-author-preview/blob/main/app.js"
click node_local_store "https://github.com/nepovtor/history-author-preview/blob/main/storage.js"
click node_backup "https://github.com/nepovtor/history-author-preview/blob/main/app.js"
click node_offline_controls "https://github.com/nepovtor/history-author-preview/blob/main/offline.js"
click node_offline_assets "https://github.com/nepovtor/history-author-preview/blob/main/offline-assets.json"
click node_service_worker "https://github.com/nepovtor/history-author-preview/blob/main/sw.js"
click node_glass "https://github.com/nepovtor/history-author-preview/blob/main/glass.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_reader,node_map,node_glass toneBlue
class node_chapters,node_archive,node_bonus,node_offline_assets toneAmber
class node_diary,node_bookmarks,node_reading_state,node_local_store,node_backup toneMint
class node_browser_db,node_offline_controls,node_service_worker,node_cache toneRose
class node_browser,node_cross_tab toneIndigo
```

## Components

### Reading experience

- [Reader app](https://github.com/nepovtor/history-author-preview/blob/main/app.js): `app.js`
- [Story map](https://github.com/nepovtor/history-author-preview/blob/main/app.js): `app.js`
- [Glass effects](https://github.com/nepovtor/history-author-preview/blob/main/glass.js): `glass.js`

### Story content

- [Chapter narratives](https://github.com/nepovtor/history-author-preview/blob/main/story.js): `story.js`
- [Photo archive](https://github.com/nepovtor/history-author-preview/blob/main/story.js): `story.js`
- [Bonus content](https://github.com/nepovtor/history-author-preview/blob/main/app.js): `app.js`
- [Chapter assets](https://github.com/nepovtor/history-author-preview/blob/main/offline-assets.json): `offline-assets.json`

### Reader data

- [Diary and notes](https://github.com/nepovtor/history-author-preview/blob/main/app.js): `app.js`
- [Bookmarks and progress](https://github.com/nepovtor/history-author-preview/blob/main/app.js): `app.js`
- [Reading state](https://github.com/nepovtor/history-author-preview/blob/main/app.js): `app.js`
- [Local persistence](https://github.com/nepovtor/history-author-preview/blob/main/storage.js): `storage.js`
- [Backup and restore](https://github.com/nepovtor/history-author-preview/blob/main/app.js): `app.js`

### Browser platform

- **IndexedDB**
- [Offline settings](https://github.com/nepovtor/history-author-preview/blob/main/offline.js): `offline.js`
- [Service worker](https://github.com/nepovtor/history-author-preview/blob/main/sw.js): `sw.js`
- **Browser cache**

### Other components

- **Reader**
- **Other tabs**

## Connections

- Reader → Reader app: opens (evidence: `README.md`)
- Reader app → Chapter narratives: renders (evidence: `app.js`)
- Reader app → Story map: routes to (evidence: `app.js`)
- Reader app → Diary and notes: routes to (evidence: `app.js`)
- Reader app → Bookmarks and progress: routes to (evidence: `app.js`)
- Reader app → Photo archive: routes to (evidence: `README.md`)
- Reader app → Bonus content: routes to (evidence: `app.js`)
- Reader app → Reading state: updates (evidence: `app.js`)
- Reader app → Local persistence: saves (evidence: `app.js`)
- Reader app → Backup and restore: exports / restores (evidence: `app.js`)
- Local persistence → IndexedDB: reads / writes (evidence: `storage.js`)
- Local persistence → Other tabs: broadcasts changes (evidence: `storage.js`)
- Reader app → Offline settings: refreshes (evidence: `app.js`)
- Offline settings → Chapter assets: loads manifest (evidence: `offline.js`)
- Offline settings → Service worker: registers (evidence: `offline.js`)
- Offline settings → Browser cache: downloads / clears (evidence: `offline.js`)
- Service worker → Browser cache: serves cached files (evidence: `sw.js`)
- Reader app → Glass effects: refreshes effects (evidence: `app.js`)
