# johnkoder/book-pdf architecture

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

- Interactive diagram: https://gitdiagram.com/johnkoder/book-pdf
- Repository: https://github.com/johnkoder/book-pdf

## Overview

PDF Bookmarks is a local-first Android PDF reader. A user imports a PDF, opens it in the viewer, saves page bookmarks and later jumps back to those pages; the app also remembers each PDF’s last-opened page. The README documents private file storage, SQLite-backed metadata and bookmarks, device preferences, dark mode, optional view-only PDF color inversion, and bundled license information. Source excerpts were limited, so the graph reflects documented responsibilities and avoids asserting uncertain internal call wiring.

Main entry points: [`lib/services/bookmark_repository.dart`](https://github.com/johnkoder/book-pdf/blob/main/lib/services/bookmark_repository.dart) (Bookmark repository), [`lib/screens/viewer_screen.dart`](https://github.com/johnkoder/book-pdf/blob/main/lib/screens/viewer_screen.dart) (PDF viewer), [`lib/screens/home_screen.dart`](https://github.com/johnkoder/book-pdf/blob/main/lib/screens/home_screen.dart) (PDF library), [`lib/services/pdf_repository.dart`](https://github.com/johnkoder/book-pdf/blob/main/lib/services/pdf_repository.dart) (PDF repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["App interface"]
  node_entry["App entry<br/>[main.dart]"]
  node_app["App shell<br/>[app.dart]"]
  node_home["PDF library<br/>[home_screen.dart]"]
  node_viewer["PDF viewer<br/>[viewer_screen.dart]"]
  node_settings["Settings"]
  node_bookmark_list["Bookmark list<br/>[bookmark_list.dart]"]
end

subgraph group_services["App services"]
  node_importer["PDF import"]
  node_pdf_repo["PDF repository"]
  node_bookmark_repo["Bookmark repository"]
  node_settings_controller["Settings controller"]
  node_license_registry["License registry"]
end

subgraph group_local["Local data"]
  node_pdf_model["PDF metadata<br/>[app_pdf.dart]"]
  node_bookmark_model["Bookmark data<br/>[bookmark.dart]"]
  node_database[("SQLite database<br/>[app_database.dart]")]
  node_private_files[("Private PDF files")]
  node_preferences[("Device preferences")]
end

subgraph group_platform["Platform integrations"]
  node_document_storage["Android documents"]
  node_pdf_engine["PDFium renderer"]
  node_licenses["Bundled licenses"]
end

node_reader(("Reader"))

node_reader -->|"opens"| node_entry
node_entry -->|"starts"| node_app
node_app -->|"shows library"| node_home
node_app -->|"shows settings"| node_settings
node_home -->|"imports PDF"| node_importer
node_importer -->|"selects original"| node_document_storage
node_importer -->|"copies PDF"| node_private_files
node_home -->|"manages PDFs"| node_pdf_repo
node_pdf_repo -->|"reads/writes metadata"| node_database
node_pdf_repo -->|"deletes copy"| node_private_files
node_viewer -->|"renders pages"| node_pdf_engine
node_viewer -->|"manages bookmarks"| node_bookmark_repo
node_viewer -->|"remembers page"| node_pdf_repo
node_bookmark_list -->|"loads bookmarks"| node_bookmark_repo
node_bookmark_repo -->|"reads/writes bookmarks"| node_database
node_bookmark_repo -->|"uses PDF metadata"| node_pdf_model
node_bookmark_repo -->|"uses bookmark data"| node_bookmark_model
node_home -->|"opens PDF"| node_viewer
node_bookmark_list -->|"jumps to page"| node_viewer
node_settings -->|"updates settings"| node_settings_controller
node_settings_controller -->|"reads/writes theme"| node_preferences
node_settings -->|"opens licenses"| node_license_registry
node_license_registry -->|"reads notices"| node_licenses

click node_entry "https://github.com/johnkoder/book-pdf/blob/main/lib/main.dart"
click node_app "https://github.com/johnkoder/book-pdf/blob/main/lib/app.dart"
click node_home "https://github.com/johnkoder/book-pdf/blob/main/lib/screens/home_screen.dart"
click node_viewer "https://github.com/johnkoder/book-pdf/blob/main/lib/screens/viewer_screen.dart"
click node_settings "https://github.com/johnkoder/book-pdf/blob/main/lib/screens/settings_screen.dart"
click node_bookmark_list "https://github.com/johnkoder/book-pdf/blob/main/lib/widgets/bookmark_list.dart"
click node_importer "https://github.com/johnkoder/book-pdf/blob/main/lib/services/pdf_import_service.dart"
click node_pdf_repo "https://github.com/johnkoder/book-pdf/blob/main/lib/services/pdf_repository.dart"
click node_bookmark_repo "https://github.com/johnkoder/book-pdf/blob/main/lib/services/bookmark_repository.dart"
click node_settings_controller "https://github.com/johnkoder/book-pdf/blob/main/lib/services/settings_controller.dart"
click node_license_registry "https://github.com/johnkoder/book-pdf/blob/main/lib/services/bundled_license_registry.dart"
click node_pdf_model "https://github.com/johnkoder/book-pdf/blob/main/lib/models/app_pdf.dart"
click node_bookmark_model "https://github.com/johnkoder/book-pdf/blob/main/lib/models/bookmark.dart"
click node_database "https://github.com/johnkoder/book-pdf/blob/main/lib/services/app_database.dart"
click node_pdf_engine "https://github.com/johnkoder/book-pdf/blob/main/third_party/pdfium_flutter/lib/pdfium_flutter.dart"
click node_licenses "https://github.com/johnkoder/book-pdf/tree/main/assets/licenses"

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_entry,node_app,node_home,node_viewer,node_settings,node_bookmark_list toneBlue
class node_importer,node_pdf_repo,node_bookmark_repo,node_settings_controller,node_license_registry toneAmber
class node_pdf_model,node_bookmark_model,node_database,node_private_files,node_preferences toneMint
class node_document_storage,node_pdf_engine,node_licenses toneRose
class node_reader toneIndigo
```

## Components

### App interface

- [App entry](https://github.com/johnkoder/book-pdf/blob/main/lib/main.dart): `lib/main.dart`
- [App shell](https://github.com/johnkoder/book-pdf/blob/main/lib/app.dart): `lib/app.dart`
- [PDF library](https://github.com/johnkoder/book-pdf/blob/main/lib/screens/home_screen.dart): `lib/screens/home_screen.dart`
- [PDF viewer](https://github.com/johnkoder/book-pdf/blob/main/lib/screens/viewer_screen.dart): `lib/screens/viewer_screen.dart`
- [Settings](https://github.com/johnkoder/book-pdf/blob/main/lib/screens/settings_screen.dart): `lib/screens/settings_screen.dart`
- [Bookmark list](https://github.com/johnkoder/book-pdf/blob/main/lib/widgets/bookmark_list.dart): `lib/widgets/bookmark_list.dart`

### App services

- [PDF import](https://github.com/johnkoder/book-pdf/blob/main/lib/services/pdf_import_service.dart): `lib/services/pdf_import_service.dart`
- [PDF repository](https://github.com/johnkoder/book-pdf/blob/main/lib/services/pdf_repository.dart): `lib/services/pdf_repository.dart`
- [Bookmark repository](https://github.com/johnkoder/book-pdf/blob/main/lib/services/bookmark_repository.dart): `lib/services/bookmark_repository.dart`
- [Settings controller](https://github.com/johnkoder/book-pdf/blob/main/lib/services/settings_controller.dart): `lib/services/settings_controller.dart`
- [License registry](https://github.com/johnkoder/book-pdf/blob/main/lib/services/bundled_license_registry.dart): `lib/services/bundled_license_registry.dart`

### Local data

- [PDF metadata](https://github.com/johnkoder/book-pdf/blob/main/lib/models/app_pdf.dart): `lib/models/app_pdf.dart`
- [Bookmark data](https://github.com/johnkoder/book-pdf/blob/main/lib/models/bookmark.dart): `lib/models/bookmark.dart`
- [SQLite database](https://github.com/johnkoder/book-pdf/blob/main/lib/services/app_database.dart): `lib/services/app_database.dart`
- **Private PDF files**
- **Device preferences**

### Platform integrations

- **Android documents**
- [PDFium renderer](https://github.com/johnkoder/book-pdf/blob/main/third_party/pdfium_flutter/lib/pdfium_flutter.dart): `third_party/pdfium_flutter/lib/pdfium_flutter.dart`
- [Bundled licenses](https://github.com/johnkoder/book-pdf/tree/main/assets/licenses): `assets/licenses`

### Other components

- **Reader**

## Connections

- Reader → App entry: opens
- App entry → App shell: starts
- App shell → PDF library: shows library
- App shell → Settings: shows settings
- PDF library → PDF import: imports PDF
- PDF import → Android documents: selects original
- PDF import → Private PDF files: copies PDF
- PDF library → PDF repository: manages PDFs
- PDF repository → SQLite database: reads/writes metadata
- PDF repository → Private PDF files: deletes copy
- PDF viewer → PDFium renderer: renders pages
- PDF viewer → Bookmark repository: manages bookmarks
- PDF viewer → PDF repository: remembers page
- Bookmark list → Bookmark repository: loads bookmarks
- Bookmark repository → SQLite database: reads/writes bookmarks
- Bookmark repository → PDF metadata: uses PDF metadata
- Bookmark repository → Bookmark data: uses bookmark data
- PDF library → PDF viewer: opens PDF
- Bookmark list → PDF viewer: jumps to page
- Settings → Settings controller: updates settings
- Settings controller → Device preferences: reads/writes theme
- Settings → License registry: opens licenses
- License registry → Bundled licenses: reads notices
