# ahrm/sioyek architecture

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

- Interactive diagram: https://gitdiagram.com/ahrm/sioyek
- Repository: https://github.com/ahrm/sioyek

## Overview

Sioyek is a desktop-focused PDF reader for textbooks and research papers, with an Android activity and speech service. The principal workflow is opening a PDF, viewing and navigating its pages, then saving or revisiting reading state and annotations. The README also describes quick open, contents search, smart jumps, overviews, marks, bookmarks, highlights, and portals. The sampled entry point shows manager setup and construction of the main widget; feature-level wiring beyond those visible relationships is summarized conservatively from the README and tree.

Main entry points: [`pdf_viewer/main.cpp`](https://github.com/ahrm/sioyek/blob/development/pdf_viewer/main.cpp) (Application startup), [`pdf_viewer/database.cpp`](https://github.com/ahrm/sioyek/blob/development/pdf_viewer/database.cpp) (Reading-state database), [`pdf_viewer/main_widget.cpp`](https://github.com/ahrm/sioyek/blob/development/pdf_viewer/main_widget.cpp) (Main window), [`pdf_viewer/document.cpp`](https://github.com/ahrm/sioyek/blob/development/pdf_viewer/document.cpp) (PDF document)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main["Application startup<br/>[main.cpp]"]
  node_widget["Main window<br/>[main_widget.cpp]"]
  node_config["Configuration<br/>[config.cpp]"]
  node_input["Input and commands<br/>[input.cpp]"]
end

subgraph group_reading["Reading"]
  node_document["PDF document<br/>[document.cpp]"]
  node_view["Document view<br/>[document_view.cpp]"]
  node_renderer["PDF renderer<br/>[pdf_renderer.cpp]"]
  node_quickopen["Quick open"]
end

subgraph group_research["Research tools"]
  node_navigation["Navigation features"]
  node_search["Search"]
  node_synctex["Source synchronization<br/>[synctex_parser.c]"]
end

subgraph group_state["User state"]
  node_annotations["Annotations and marks"]
  node_portals["Portals"]
  node_database[("Reading-state database<br/>[database.cpp]")]
end

subgraph group_platform["Platform features"]
  node_touch["Touch controls"]
  node_android["Android activity"]
  node_tts["Speech service"]
end

node_reader(("Reader"))

node_reader -->|"opens PDF"| node_main
node_main -->|"loads settings"| node_config
node_main -->|"creates commands"| node_input
node_main -->|"opens databases"| node_database
node_main -->|"creates window"| node_widget
node_widget -->|"manages documents"| node_document
node_document -->|"provides pages"| node_view
node_view -->|"renders pages"| node_renderer
node_reader -->|"finds recent files"| node_quickopen
node_reader -->|"jumps and browses"| node_navigation
node_reader -->|"searches documents"| node_search
node_reader -->|"creates annotations"| node_annotations
node_reader -->|"links locations"| node_portals
node_annotations -->|"persists state"| node_database
node_portals -->|"persists links"| node_database
node_reader -->|"uses touch UI"| node_touch
node_reader -.->|"opens on Android"| node_android
node_android -.->|"controls speech"| node_tts
node_reader -.->|"syncs source"| node_synctex

click node_main "https://github.com/ahrm/sioyek/blob/development/pdf_viewer/main.cpp"
click node_widget "https://github.com/ahrm/sioyek/blob/development/pdf_viewer/main_widget.cpp"
click node_config "https://github.com/ahrm/sioyek/blob/development/pdf_viewer/config.cpp"
click node_input "https://github.com/ahrm/sioyek/blob/development/pdf_viewer/input.cpp"
click node_document "https://github.com/ahrm/sioyek/blob/development/pdf_viewer/document.cpp"
click node_view "https://github.com/ahrm/sioyek/blob/development/pdf_viewer/document_view.cpp"
click node_renderer "https://github.com/ahrm/sioyek/blob/development/pdf_viewer/pdf_renderer.cpp"
click node_quickopen "https://github.com/ahrm/sioyek/tree/development/pdf_viewer"
click node_navigation "https://github.com/ahrm/sioyek/tree/development/pdf_viewer"
click node_search "https://github.com/ahrm/sioyek/tree/development/pdf_viewer"
click node_synctex "https://github.com/ahrm/sioyek/blob/development/pdf_viewer/synctex/synctex_parser.c"
click node_annotations "https://github.com/ahrm/sioyek/tree/development/pdf_viewer"
click node_portals "https://github.com/ahrm/sioyek/tree/development/pdf_viewer"
click node_database "https://github.com/ahrm/sioyek/blob/development/pdf_viewer/database.cpp"
click node_touch "https://github.com/ahrm/sioyek/tree/development/pdf_viewer/touchui"
click node_android "https://github.com/ahrm/sioyek/blob/development/android/src/info/sioyek/sioyek/SioyekActivity.java"
click node_tts "https://github.com/ahrm/sioyek/blob/development/android/src/info/sioyek/sioyek/TextToSpeechService.java"

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_main,node_widget,node_config,node_input toneBlue
class node_document,node_view,node_renderer,node_quickopen toneAmber
class node_navigation,node_search,node_synctex toneMint
class node_annotations,node_portals,node_database toneRose
class node_touch,node_android,node_tts,node_reader toneIndigo
```

## Components

### Application

- [Application startup](https://github.com/ahrm/sioyek/blob/development/pdf_viewer/main.cpp): `pdf_viewer/main.cpp`
- [Main window](https://github.com/ahrm/sioyek/blob/development/pdf_viewer/main_widget.cpp): `pdf_viewer/main_widget.cpp`
- [Configuration](https://github.com/ahrm/sioyek/blob/development/pdf_viewer/config.cpp): `pdf_viewer/config.cpp`
- [Input and commands](https://github.com/ahrm/sioyek/blob/development/pdf_viewer/input.cpp): `pdf_viewer/input.cpp`

### Reading

- [PDF document](https://github.com/ahrm/sioyek/blob/development/pdf_viewer/document.cpp): `pdf_viewer/document.cpp`
- [Document view](https://github.com/ahrm/sioyek/blob/development/pdf_viewer/document_view.cpp): `pdf_viewer/document_view.cpp`
- [PDF renderer](https://github.com/ahrm/sioyek/blob/development/pdf_viewer/pdf_renderer.cpp): `pdf_viewer/pdf_renderer.cpp`
- [Quick open](https://github.com/ahrm/sioyek/tree/development/pdf_viewer): `pdf_viewer`

### Research tools

- [Navigation features](https://github.com/ahrm/sioyek/tree/development/pdf_viewer): `pdf_viewer`
- [Search](https://github.com/ahrm/sioyek/tree/development/pdf_viewer): `pdf_viewer`
- [Source synchronization](https://github.com/ahrm/sioyek/blob/development/pdf_viewer/synctex/synctex_parser.c): `pdf_viewer/synctex/synctex_parser.c`

### User state

- [Annotations and marks](https://github.com/ahrm/sioyek/tree/development/pdf_viewer): `pdf_viewer`
- [Portals](https://github.com/ahrm/sioyek/tree/development/pdf_viewer): `pdf_viewer`
- [Reading-state database](https://github.com/ahrm/sioyek/blob/development/pdf_viewer/database.cpp): `pdf_viewer/database.cpp`

### Platform features

- [Touch controls](https://github.com/ahrm/sioyek/tree/development/pdf_viewer/touchui): `pdf_viewer/touchui`
- [Android activity](https://github.com/ahrm/sioyek/blob/development/android/src/info/sioyek/sioyek/SioyekActivity.java): `android/src/info/sioyek/sioyek/SioyekActivity.java`
- [Speech service](https://github.com/ahrm/sioyek/blob/development/android/src/info/sioyek/sioyek/TextToSpeechService.java): `android/src/info/sioyek/sioyek/TextToSpeechService.java`

### Other components

- **Reader**

## Connections

- Reader → Application startup: opens PDF
- Application startup → Configuration: loads settings
- Application startup → Input and commands: creates commands
- Application startup → Reading-state database: opens databases
- Application startup → Main window: creates window
- Main window → PDF document: manages documents
- PDF document → Document view: provides pages
- Document view → PDF renderer: renders pages
- Reader → Quick open: finds recent files
- Reader → Navigation features: jumps and browses
- Reader → Search: searches documents
- Reader → Annotations and marks: creates annotations
- Reader → Portals: links locations
- Annotations and marks → Reading-state database: persists state
- Portals → Reading-state database: persists links
- Reader → Touch controls: uses touch UI
- Reader → Android activity: opens on Android
- Android activity → Speech service: controls speech
- Reader → Source synchronization: syncs source
