# zack20136/quill-diary architecture

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

- Interactive diagram: https://gitdiagram.com/zack20136/quill-diary
- Repository: https://github.com/zack20136/quill-diary

## Overview

Quill Diary is an Android-first offline encrypted diary; the README describes encrypted vaults, secure unlocking, diary editing, AI features, backup/restore, portable import/export, and Drive backup. Its principal user flow is creating and managing diary content in the app, then protecting it locally or exporting/backing it up. The supplied tree and excerpts expose Android platform bridges and Drive upload internals, but not the main Flutter `lib/` implementation; those app-level capabilities are therefore represented at a high level, without inferred call links. The remaining listed desktop and iOS files are unsupported platform skeletons.

Main entry points: [`android/app/src/main/kotlin/zack20136/com/quill_diary/drive/BackupUploadForegroundService.kt`](https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/BackupUploadForegroundService.kt) (Upload service), [`android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveResumableUploader.kt`](https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveResumableUploader.kt) (Resumable uploader), [`android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveUploadBridge.kt`](https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveUploadBridge.kt) (Drive app bridge), [`android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveUploadJobStore.kt`](https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveUploadJobStore.kt) (Upload job store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Diary app"]
  node_diary["Diary experience"]
  node_secure["Secure access"]
  node_editing["Writing and search"]
  node_ai["AI diary tools"]
  node_support["One-time support"]
end

subgraph group_vault["Vault and exchange"]
  node_realm_channel["Realm import bridge"]
  node_realm_reader["Realm reader"]
  node_portable_export["Portable export"]
end

subgraph group_drive["Drive backup"]
  node_drive_bridge["Drive app bridge"]
  node_upload_service["Upload service"]
  node_job_store[("Upload job store")]
  node_uploader["Resumable uploader"]
  node_token_provider["Access token provider"]
  node_remote_cleanup["Remote cleanup"]
end

subgraph group_bridge["Android integration"]
  node_android_host["Android host<br/>[MainActivity.kt]"]
end

node_user(("Diary user"))
node_google_drive[("Google Drive")]

node_user -->|"uses"| node_diary
node_diary -->|"unlocks vault"| node_secure
node_diary -->|"writes entries"| node_editing
node_diary -->|"uses optional AI"| node_ai
node_diary -->|"offers support"| node_support
node_diary -.->|"imports legacy data"| node_realm_channel
node_realm_channel -->|"reads Realm"| node_realm_reader
node_diary -.->|"exports portable files"| node_portable_export
node_android_host -->|"registers channel"| node_realm_channel
node_android_host -->|"registers channel"| node_portable_export
node_android_host -->|"registers bridge"| node_drive_bridge
node_diary -.->|"starts manual backup"| node_drive_bridge
node_drive_bridge -->|"reads and updates"| node_job_store
node_drive_bridge -->|"starts service"| node_upload_service
node_upload_service -->|"loads and saves jobs"| node_job_store
node_upload_service -->|"runs upload"| node_uploader
node_upload_service -->|"creates provider"| node_token_provider
node_uploader -->|"gets tokens"| node_token_provider
node_uploader -->|"persists progress"| node_job_store
node_uploader -->|"uploads chunks"| node_google_drive
node_remote_cleanup -->|"uses credentials"| node_token_provider
node_remote_cleanup -->|"reads job state"| node_job_store
node_remote_cleanup -.->|"cleans remote files"| node_google_drive

click node_realm_channel "https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/EasyDiaryRealmChannel.kt"
click node_realm_reader "https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/EasyDiaryRealmReader.kt"
click node_portable_export "https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/MediaStoreExportChannel.kt"
click node_android_host "https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/MainActivity.kt"
click node_drive_bridge "https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveUploadBridge.kt"
click node_upload_service "https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/BackupUploadForegroundService.kt"
click node_job_store "https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveUploadJobStore.kt"
click node_uploader "https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveResumableUploader.kt"
click node_token_provider "https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveAccessTokenProvider.kt"
click node_remote_cleanup "https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveRemoteFileCleanup.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_diary,node_secure,node_editing,node_ai,node_support,node_user toneBlue
class node_realm_channel,node_realm_reader,node_portable_export,node_google_drive toneAmber
class node_drive_bridge,node_upload_service,node_job_store,node_uploader,node_token_provider,node_remote_cleanup toneMint
class node_android_host toneRose
```

## Components

### Diary app

- **Diary experience**
- **Secure access**
- **Writing and search**
- **AI diary tools**
- **One-time support**

### Vault and exchange

- [Realm import bridge](https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/EasyDiaryRealmChannel.kt): `android/app/src/main/kotlin/zack20136/com/quill_diary/EasyDiaryRealmChannel.kt`
- [Realm reader](https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/EasyDiaryRealmReader.kt): `android/app/src/main/kotlin/zack20136/com/quill_diary/EasyDiaryRealmReader.kt`
- [Portable export](https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/MediaStoreExportChannel.kt): `android/app/src/main/kotlin/zack20136/com/quill_diary/MediaStoreExportChannel.kt`

### Drive backup

- [Drive app bridge](https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveUploadBridge.kt): `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveUploadBridge.kt`
- [Upload service](https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/BackupUploadForegroundService.kt): `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/BackupUploadForegroundService.kt`
- [Upload job store](https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveUploadJobStore.kt): `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveUploadJobStore.kt`
- [Resumable uploader](https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveResumableUploader.kt): `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveResumableUploader.kt`
- [Access token provider](https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveAccessTokenProvider.kt): `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveAccessTokenProvider.kt`
- [Remote cleanup](https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveRemoteFileCleanup.kt): `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveRemoteFileCleanup.kt`

### Android integration

- [Android host](https://github.com/zack20136/quill-diary/blob/main/android/app/src/main/kotlin/zack20136/com/quill_diary/MainActivity.kt): `android/app/src/main/kotlin/zack20136/com/quill_diary/MainActivity.kt`

### Other components

- **Diary user**
- **Google Drive**

## Connections

- Diary user → Diary experience: uses (evidence: `README.md`)
- Diary experience → Secure access: unlocks vault (evidence: `README.md`)
- Diary experience → Writing and search: writes entries (evidence: `README.md`)
- Diary experience → AI diary tools: uses optional AI (evidence: `README.md`)
- Diary experience → One-time support: offers support (evidence: `README.md`)
- Diary experience → Realm import bridge: imports legacy data
- Realm import bridge → Realm reader: reads Realm (evidence: `android/app/src/main/kotlin/zack20136/com/quill_diary/EasyDiaryRealmChannel.kt`)
- Diary experience → Portable export: exports portable files
- Android host → Realm import bridge: registers channel (evidence: `android/app/src/main/kotlin/zack20136/com/quill_diary/MainActivity.kt`)
- Android host → Portable export: registers channel (evidence: `android/app/src/main/kotlin/zack20136/com/quill_diary/MainActivity.kt`)
- Android host → Drive app bridge: registers bridge (evidence: `android/app/src/main/kotlin/zack20136/com/quill_diary/MainActivity.kt`)
- Diary experience → Drive app bridge: starts manual backup (evidence: `README.md`)
- Drive app bridge → Upload job store: reads and updates (evidence: `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveUploadBridge.kt`)
- Drive app bridge → Upload service: starts service (evidence: `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveUploadBridge.kt`)
- Upload service → Upload job store: loads and saves jobs (evidence: `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/BackupUploadForegroundService.kt`)
- Upload service → Resumable uploader: runs upload (evidence: `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/BackupUploadForegroundService.kt`)
- Upload service → Access token provider: creates provider (evidence: `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/BackupUploadForegroundService.kt`)
- Resumable uploader → Access token provider: gets tokens (evidence: `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveResumableUploader.kt`)
- Resumable uploader → Upload job store: persists progress (evidence: `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveResumableUploader.kt`)
- Resumable uploader → Google Drive: uploads chunks (evidence: `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveResumableUploader.kt`)
- Remote cleanup → Access token provider: uses credentials (evidence: `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveRemoteFileCleanup.kt`)
- Remote cleanup → Upload job store: reads job state (evidence: `android/app/src/main/kotlin/zack20136/com/quill_diary/drive/DriveRemoteFileCleanup.kt`)
- Remote cleanup → Google Drive: cleans remote files
