# ouyangyanhuo/moyue architecture

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

- Interactive diagram: https://gitdiagram.com/ouyangyanhuo/moyue
- Repository: https://github.com/ouyangyanhuo/moyue

## Overview

Moyue is a Flutter reading app for Markdown, HTML, and RSS, centered on importing and organizing documents, opening them in a reader, and remembering reading progress. The documented workflow also branches into Markdown editing, feed subscriptions, and display customization. Markdown and HTML normally render as native Flutter widgets; WebView is an optional HTML-only alternative. The README documents the broad architecture and subsystem links; sampled source confirms Android incoming-file staging and platform channel behavior, but most Dart implementation files were not sampled, so uncertain internal wiring is omitted.

Main entry points: [`lib/features/reader/reader_detail_page.dart`](https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/reader/reader_detail_page.dart) (Reader detail), [`lib/features/reader/library_page.dart`](https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/reader/library_page.dart) (Document library), [`lib/services/moyue_storage_service.dart`](https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/moyue_storage_service.dart) (Storage facade), [`lib/app/moyue_app.dart`](https://github.com/ouyangyanhuo/moyue/blob/main/lib/app/moyue_app.dart) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and UI"]
  node_shell["App shell<br/>[moyue_app.dart]"]
  node_library["Document library<br/>[library_page.dart]"]
  node_rss_page["RSS page<br/>[rss_page.dart]"]
  node_settings["Settings<br/>[settings_page.dart]"]
end

subgraph group_reading["Reading and authoring"]
  node_reader["Reader detail"]
  node_native_html["Native HTML"]
  node_webview["Optional WebView"]
  node_editor["Markdown editor<br/>[editor_page.dart]"]
end

subgraph group_services["Domain services"]
  node_rss_service["RSS service<br/>[rss_service.dart]"]
  node_package["Package import/export"]
  node_incoming["Incoming files"]
  node_progress["Reading progress"]
  node_storage_service["Storage facade"]
  node_decoder["Text decoder<br/>[text_decoder.dart]"]
end

subgraph group_state["Storage and models"]
  node_models["Document and feed models"]
  node_index[("SQLite index")]
  node_files[("Document files")]
  node_display["Display preferences"]
  node_theme["Theme and styles<br/>[moyue_theme.dart]"]
end

subgraph group_platform["Platform integrations"]
  node_android["Android activity<br/>[MainActivity.kt]"]
end

node_user(("Reader"))
node_feed_net(("RSS/Atom sources"))
node_browser(("External browser"))

node_user -->|"opens"| node_shell
node_shell -->|"shows"| node_library
node_shell -->|"shows"| node_rss_page
node_shell -->|"shows"| node_settings
node_library -->|"opens document"| node_reader
node_library -->|"imports files"| node_incoming
node_android -->|"stages files"| node_incoming
node_reader -->|"loads document"| node_storage_service
node_storage_service -->|"reads/writes index"| node_index
node_storage_service -->|"reads/writes files"| node_files
node_storage_service -->|"delegates packages"| node_package
node_package -->|"decodes text"| node_decoder
node_package -->|"updates index"| node_index
node_package -->|"writes package files"| node_files
node_reader -->|"renders HTML"| node_native_html
node_reader -.->|"renders HTML"| node_webview
node_reader -->|"saves/restores"| node_progress
node_reader -->|"displays document"| node_models
node_library -->|"edits Markdown"| node_editor
node_editor -->|"saves draft"| node_storage_service
node_rss_page -->|"manages feeds"| node_rss_service
node_rss_service -->|"fetches feeds"| node_feed_net
node_rss_page -->|"opens article"| node_browser
node_settings -->|"updates preferences"| node_display
node_display -->|"configures appearance"| node_theme
node_library -->|"uses document models"| node_models
node_rss_service -->|"produces feed data"| node_models

click node_shell "https://github.com/ouyangyanhuo/moyue/blob/main/lib/app/moyue_app.dart"
click node_library "https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/reader/library_page.dart"
click node_rss_page "https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/rss/rss_page.dart"
click node_settings "https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/settings/settings_page.dart"
click node_reader "https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/reader/reader_detail_page.dart"
click node_native_html "https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/reader/native_html_view.dart"
click node_webview "https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/reader/webview_html_view.dart"
click node_editor "https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/editor/editor_page.dart"
click node_rss_service "https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/rss_service.dart"
click node_package "https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/document_package_service.dart"
click node_incoming "https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/incoming_file_service.dart"
click node_progress "https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/reading_progress_service.dart"
click node_storage_service "https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/moyue_storage_service.dart"
click node_decoder "https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/text_decoder.dart"
click node_models "https://github.com/ouyangyanhuo/moyue/blob/main/lib/models/reading_document.dart"
click node_index "https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/database/moyue_index_database.dart"
click node_files "https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/storage/package_file_store.dart"
click node_display "https://github.com/ouyangyanhuo/moyue/blob/main/lib/core/display/display_preferences.dart"
click node_theme "https://github.com/ouyangyanhuo/moyue/blob/main/lib/core/theme/moyue_theme.dart"
click node_android "https://github.com/ouyangyanhuo/moyue/blob/main/android/app/src/main/kotlin/com/moyue/application/MainActivity.kt"

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_shell,node_library,node_rss_page,node_settings,node_browser toneBlue
class node_reader,node_native_html,node_webview,node_editor toneAmber
class node_rss_service,node_package,node_incoming,node_progress,node_storage_service,node_decoder toneMint
class node_models,node_index,node_files,node_display,node_theme toneRose
class node_android,node_user,node_feed_net toneIndigo
```

## Components

### App and UI

- [App shell](https://github.com/ouyangyanhuo/moyue/blob/main/lib/app/moyue_app.dart): `lib/app/moyue_app.dart`
- [Document library](https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/reader/library_page.dart): `lib/features/reader/library_page.dart`
- [RSS page](https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/rss/rss_page.dart): `lib/features/rss/rss_page.dart`
- [Settings](https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/settings/settings_page.dart): `lib/features/settings/settings_page.dart`

### Reading and authoring

- [Reader detail](https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/reader/reader_detail_page.dart): `lib/features/reader/reader_detail_page.dart`
- [Native HTML](https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/reader/native_html_view.dart): `lib/features/reader/native_html_view.dart`
- [Optional WebView](https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/reader/webview_html_view.dart): `lib/features/reader/webview_html_view.dart`
- [Markdown editor](https://github.com/ouyangyanhuo/moyue/blob/main/lib/features/editor/editor_page.dart): `lib/features/editor/editor_page.dart`

### Domain services

- [RSS service](https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/rss_service.dart): `lib/services/rss_service.dart`
- [Package import/export](https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/document_package_service.dart): `lib/services/document_package_service.dart`
- [Incoming files](https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/incoming_file_service.dart): `lib/services/incoming_file_service.dart`
- [Reading progress](https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/reading_progress_service.dart): `lib/services/reading_progress_service.dart`
- [Storage facade](https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/moyue_storage_service.dart): `lib/services/moyue_storage_service.dart`
- [Text decoder](https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/text_decoder.dart): `lib/services/text_decoder.dart`

### Storage and models

- [Document and feed models](https://github.com/ouyangyanhuo/moyue/blob/main/lib/models/reading_document.dart): `lib/models/reading_document.dart`
- [SQLite index](https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/database/moyue_index_database.dart): `lib/services/database/moyue_index_database.dart`
- [Document files](https://github.com/ouyangyanhuo/moyue/blob/main/lib/services/storage/package_file_store.dart): `lib/services/storage/package_file_store.dart`
- [Display preferences](https://github.com/ouyangyanhuo/moyue/blob/main/lib/core/display/display_preferences.dart): `lib/core/display/display_preferences.dart`
- [Theme and styles](https://github.com/ouyangyanhuo/moyue/blob/main/lib/core/theme/moyue_theme.dart): `lib/core/theme/moyue_theme.dart`

### Platform integrations

- [Android activity](https://github.com/ouyangyanhuo/moyue/blob/main/android/app/src/main/kotlin/com/moyue/application/MainActivity.kt): `android/app/src/main/kotlin/com/moyue/application/MainActivity.kt`

### Other components

- **Reader**
- **RSS/Atom sources**
- **External browser**

## Connections

- Reader → App shell: opens
- App shell → Document library: shows
- App shell → RSS page: shows
- App shell → Settings: shows
- Document library → Reader detail: opens document
- Document library → Incoming files: imports files
- Android activity → Incoming files: stages files
- Reader detail → Storage facade: loads document
- Storage facade → SQLite index: reads/writes index
- Storage facade → Document files: reads/writes files
- Storage facade → Package import/export: delegates packages
- Package import/export → Text decoder: decodes text
- Package import/export → SQLite index: updates index
- Package import/export → Document files: writes package files
- Reader detail → Native HTML: renders HTML
- Reader detail → Optional WebView: renders HTML
- Reader detail → Reading progress: saves/restores
- Reader detail → Document and feed models: displays document
- Document library → Markdown editor: edits Markdown
- Markdown editor → Storage facade: saves draft
- RSS page → RSS service: manages feeds
- RSS service → RSS/Atom sources: fetches feeds
- RSS page → External browser: opens article
- Settings → Display preferences: updates preferences
- Display preferences → Theme and styles: configures appearance
- Document library → Document and feed models: uses document models
- RSS service → Document and feed models: produces feed data
