# parthivsurya/gstorage architecture

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

- Interactive diagram: https://gitdiagram.com/parthivsurya/gstorage
- Repository: https://github.com/parthivsurya/gstorage

## Overview

Gstore is a local-only Qt desktop app that pools multiple Google Drive accounts behind one indexed folder tree. The main workflow starts in the desktop UI: link accounts, then upload, browse, download, or manage pooled files; transfers use whole-file placement or chunking and persist their results in the local index. Other major capabilities include folder transfers, link sharing, repair/reconciliation, backups, Drive tidying, and signed self-updates. Some subsystems are represented by README-described capabilities because their source was not sampled; those links are cited to the README or omitted where implementation wiring is uncertain.

Main entry points: [`src/gstore/ui/upload_worker.py`](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/ui/upload_worker.py) (Upload worker), [`src/gstore/ui/storage_panel.py`](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/ui/storage_panel.py) (Storage panel), [`src/gstore/app.py`](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/app.py) (Application startup), [`src/gstore/auth/accounts.py`](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/auth/accounts.py) (Account store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop UI"]
  node_app["Application startup<br/>[app.py]"]
  node_window["Main window<br/>[main_window.py]"]
  node_storage["Storage panel<br/>[storage_panel.py]"]
  node_upload_ui["Upload worker<br/>[upload_worker.py]"]
  node_folder_up["Folder upload"]
  node_folder_down["Folder download"]
  node_reconcile_ui["Repair worker"]
end

subgraph group_identity["Accounts"]
  node_oauth["OAuth login<br/>[oauth.py]"]
  node_accounts["Account store<br/>[accounts.py]"]
  node_keychain["OS keychain"]
end

subgraph group_transfers["Drive transfers"]
  node_drive_service["Drive service<br/>[service.py]"]
  node_placement["Account placement<br/>[placement.py]"]
  node_whole_upload["Whole-file upload<br/>[upload.py]"]
  node_chunk_upload["Chunk upload<br/>[chunk_upload.py]"]
  node_download["File download<br/>[download.py]"]
  node_folder_ops["Folder operations<br/>[folder.py]"]
end

subgraph group_state["Local index"]
  node_database[("SQLite database<br/>[database.py]")]
  node_index["File index<br/>[store.py]"]
  node_pending["Pending chunks<br/>[pending_chunks.py]"]
end

subgraph group_capabilities["Sharing and upkeep"]
  node_sharing["Link sharing<br/>[publish.py]"]
  node_share_fetch["Share retrieval<br/>[fetch.py]"]
  node_backup["Index backups<br/>[autobackup.py]"]
  node_reconcile["Drive reconciliation<br/>[reconcile.py]"]
  node_tidy["Drive tidy<br/>[tidy.py]"]
  node_updater["Self-updater<br/>[install.py]"]
end

node_user(("User"))
node_google_drive["Google Drive"]

node_user -->|"launches"| node_app
node_app -->|"opens"| node_database
node_app -->|"starts"| node_window
node_user -->|"uses"| node_window
node_storage -->|"starts login"| node_oauth
node_oauth -->|"stores credentials"| node_accounts
node_accounts -->|"encrypts tokens"| node_keychain
node_accounts -->|"persists accounts"| node_database
node_upload_ui -->|"plans placement"| node_placement
node_upload_ui -->|"uploads chunks"| node_chunk_upload
node_upload_ui -->|"uploads whole file"| node_whole_upload
node_upload_ui -->|"tracks progress"| node_pending
node_folder_up -->|"reuses upload"| node_upload_ui
node_folder_up -->|"builds folder tree"| node_folder_ops
node_folder_down -->|"downloads files"| node_download
node_drive_service -->|"builds API access"| node_google_drive
node_whole_upload -->|"uploads files"| node_google_drive
node_chunk_upload -->|"uploads parts"| node_google_drive
node_download -->|"fetches files"| node_google_drive
node_upload_ui -->|"records files"| node_index
node_index -->|"stores index"| node_database
node_user -->|"shares files"| node_sharing
node_sharing -->|"publishes link"| node_google_drive
node_share_fetch -->|"fetches shared data"| node_google_drive
node_storage -->|"starts repair"| node_reconcile_ui
node_reconcile_ui -->|"reconciles index"| node_reconcile
node_reconcile -->|"checks Drive files"| node_google_drive
node_storage -->|"manages backups"| node_backup
node_storage -->|"starts tidy"| node_tidy
node_user -->|"requests update"| node_updater
node_updater -->|"downloads release"| node_google_drive

click node_app "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/app.py"
click node_window "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/ui/main_window.py"
click node_storage "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/ui/storage_panel.py"
click node_upload_ui "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/ui/upload_worker.py"
click node_folder_up "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/ui/folder_upload_worker.py"
click node_folder_down "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/ui/folder_download_worker.py"
click node_reconcile_ui "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/ui/reconcile_worker.py"
click node_oauth "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/auth/oauth.py"
click node_accounts "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/auth/accounts.py"
click node_drive_service "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/service.py"
click node_placement "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/placement.py"
click node_whole_upload "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/upload.py"
click node_chunk_upload "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/chunk_upload.py"
click node_download "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/download.py"
click node_folder_ops "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/folder.py"
click node_database "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/db/database.py"
click node_index "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/index/store.py"
click node_pending "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/index/pending_chunks.py"
click node_sharing "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/share/publish.py"
click node_share_fetch "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/share/fetch.py"
click node_backup "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/index/autobackup.py"
click node_reconcile "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/reconcile.py"
click node_tidy "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/tidy.py"
click node_updater "https://github.com/parthivsurya/gstorage/blob/main/src/gstore/updater/install.py"

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_app,node_window,node_storage,node_upload_ui,node_folder_up,node_folder_down,node_reconcile_ui,node_user toneBlue
class node_oauth,node_accounts,node_keychain toneAmber
class node_drive_service,node_placement,node_whole_upload,node_chunk_upload,node_download,node_folder_ops toneMint
class node_database,node_index,node_pending toneRose
class node_sharing,node_share_fetch,node_backup,node_reconcile,node_tidy,node_updater,node_google_drive toneIndigo
```

## Components

### Desktop UI

- [Application startup](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/app.py): `src/gstore/app.py`
- [Main window](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/ui/main_window.py): `src/gstore/ui/main_window.py`
- [Storage panel](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/ui/storage_panel.py): `src/gstore/ui/storage_panel.py`
- [Upload worker](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/ui/upload_worker.py): `src/gstore/ui/upload_worker.py`
- [Folder upload](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/ui/folder_upload_worker.py): `src/gstore/ui/folder_upload_worker.py`
- [Folder download](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/ui/folder_download_worker.py): `src/gstore/ui/folder_download_worker.py`
- [Repair worker](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/ui/reconcile_worker.py): `src/gstore/ui/reconcile_worker.py`

### Accounts

- [OAuth login](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/auth/oauth.py): `src/gstore/auth/oauth.py`
- [Account store](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/auth/accounts.py): `src/gstore/auth/accounts.py`
- **OS keychain**

### Drive transfers

- [Drive service](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/service.py): `src/gstore/drive/service.py`
- [Account placement](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/placement.py): `src/gstore/drive/placement.py`
- [Whole-file upload](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/upload.py): `src/gstore/drive/upload.py`
- [Chunk upload](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/chunk_upload.py): `src/gstore/drive/chunk_upload.py`
- [File download](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/download.py): `src/gstore/drive/download.py`
- [Folder operations](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/folder.py): `src/gstore/drive/folder.py`

### Local index

- [SQLite database](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/db/database.py): `src/gstore/db/database.py`
- [File index](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/index/store.py): `src/gstore/index/store.py`
- [Pending chunks](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/index/pending_chunks.py): `src/gstore/index/pending_chunks.py`

### Sharing and upkeep

- [Link sharing](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/share/publish.py): `src/gstore/share/publish.py`
- [Share retrieval](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/share/fetch.py): `src/gstore/share/fetch.py`
- [Index backups](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/index/autobackup.py): `src/gstore/index/autobackup.py`
- [Drive reconciliation](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/reconcile.py): `src/gstore/drive/reconcile.py`
- [Drive tidy](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/drive/tidy.py): `src/gstore/drive/tidy.py`
- [Self-updater](https://github.com/parthivsurya/gstorage/blob/main/src/gstore/updater/install.py): `src/gstore/updater/install.py`

### Other components

- **User**
- **Google Drive**

## Connections

- User → Application startup: launches (evidence: `src/gstore/app.py`)
- Application startup → SQLite database: opens (evidence: `src/gstore/app.py`)
- Application startup → Main window: starts (evidence: `src/gstore/app.py`)
- User → Main window: uses (evidence: `README.md`)
- Storage panel → OAuth login: starts login (evidence: `src/gstore/ui/storage_panel.py`)
- OAuth login → Account store: stores credentials (evidence: `src/gstore/auth/accounts.py`)
- Account store → OS keychain: encrypts tokens (evidence: `README.md`)
- Account store → SQLite database: persists accounts (evidence: `src/gstore/auth/accounts.py`)
- Upload worker → Account placement: plans placement (evidence: `src/gstore/ui/upload_worker.py`)
- Upload worker → Chunk upload: uploads chunks (evidence: `src/gstore/ui/upload_worker.py`)
- Upload worker → Whole-file upload: uploads whole file (evidence: `src/gstore/ui/upload_worker.py`)
- Upload worker → Pending chunks: tracks progress (evidence: `src/gstore/ui/upload_worker.py`)
- Folder upload → Upload worker: reuses upload (evidence: `src/gstore/ui/folder_upload_worker.py`)
- Folder upload → Folder operations: builds folder tree (evidence: `src/gstore/ui/folder_upload_worker.py`)
- Folder download → File download: downloads files (evidence: `src/gstore/ui/folder_download_worker.py`)
- Drive service → Google Drive: builds API access (evidence: `README.md`)
- Whole-file upload → Google Drive: uploads files (evidence: `README.md`)
- Chunk upload → Google Drive: uploads parts (evidence: `README.md`)
- File download → Google Drive: fetches files (evidence: `README.md`)
- Upload worker → File index: records files (evidence: `README.md`)
- File index → SQLite database: stores index (evidence: `README.md`)
- User → Link sharing: shares files (evidence: `README.md`)
- Link sharing → Google Drive: publishes link (evidence: `README.md`)
- Share retrieval → Google Drive: fetches shared data (evidence: `README.md`)
- Storage panel → Repair worker: starts repair (evidence: `src/gstore/ui/storage_panel.py`)
- Repair worker → Drive reconciliation: reconciles index (evidence: `src/gstore/ui/reconcile_worker.py`)
- Drive reconciliation → Google Drive: checks Drive files
- Storage panel → Index backups: manages backups (evidence: `src/gstore/ui/storage_panel.py`)
- Storage panel → Drive tidy: starts tidy (evidence: `README.md`)
- User → Self-updater: requests update (evidence: `README.md`)
- Self-updater → Google Drive: downloads release (evidence: `README.md`)
