# aleuuu/hranilka architecture

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

- Interactive diagram: https://gitdiagram.com/aleuuu/hranilka
- Repository: https://github.com/aleuuu/hranilka

## Overview

Хранилка is a Windows desktop app for organizing local photos and documents from a user’s instructions. The main workflow is to choose a folder, scan and analyze its files, review and adjust a proposed organization plan, then apply moves and renames; the app also supports undo. React screens call a typed API backed by Tauri commands, which bridge to a separate Python engine and Rust file operations. The README documents local Ollama models, onboarding and model setup; unsampled subsystem links below rely on those documented capabilities, not inspection of their implementation.

Main entry points: [`src/store.ts`](https://github.com/aleuuu/hranilka/blob/main/src/store.ts) (App state), [`src/screens/Shell.tsx`](https://github.com/aleuuu/hranilka/blob/main/src/screens/Shell.tsx) (Screen router), [`src-tauri/src/lib.rs`](https://github.com/aleuuu/hranilka/blob/main/src-tauri/src/lib.rs) (Command handlers), [`src/screens/Plan.tsx`](https://github.com/aleuuu/hranilka/blob/main/src/screens/Plan.tsx) (Plan review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Interface"]
  node_entry["UI entry<br/>[main.tsx]"]
  node_app["App shell<br/>[App.tsx]"]
  node_onboarding["Onboarding<br/>[Onboarding.tsx]"]
  node_shell["Screen router<br/>[Shell.tsx]"]
  node_modals["Dialogs<br/>[Modals.tsx]"]
  node_store["App state<br/>[store.ts]"]
  node_api["Typed API<br/>[api.ts]"]
  node_mock["Browser mock<br/>[mock.ts]"]
  node_ui["UI components<br/>[ui.tsx]"]
  node_format["Formatting<br/>[format.ts]"]
  node_types["Domain types<br/>[types.ts]"]
end

subgraph group_workflow["Organization workflow"]
  node_start["Folder selection<br/>[Start.tsx]"]
  node_analysis["Analysis view<br/>[Analysis.tsx]"]
  node_plan["Plan review<br/>[Plan.tsx]"]
  node_tune["Plan tuning<br/>[Tune.tsx]"]
  node_result["Apply result<br/>[Result.tsx]"]
end

subgraph group_desktop["Desktop services"]
  node_tauri["Command handlers<br/>[lib.rs]"]
  node_bridge["Engine process bridge<br/>[engine.rs]"]
  node_fileops["File moves and undo<br/>[fsops.rs]"]
  node_ollama["Ollama management<br/>[ollama.rs]"]
  node_system["System checks<br/>[sys.rs]"]
  node_settings["Settings storage<br/>[settings.rs]"]
end

subgraph group_engine["Analysis engine"]
  node_python["Scan and plan engine<br/>[engine.py]"]
end

node_user(("User"))
node_ollama_service{{"Ollama service"}}

node_user -->|"opens app"| node_entry
node_entry -->|"renders"| node_app
node_app -->|"renders"| node_onboarding
node_app -->|"renders"| node_shell
node_app -->|"renders"| node_modals
node_shell -->|"routes to"| node_start
node_shell -->|"routes to"| node_analysis
node_shell -->|"routes to"| node_plan
node_shell -->|"routes to"| node_result
node_shell -->|"routes to"| node_tune
node_onboarding -->|"starts checks"| node_store
node_start -->|"selects folder"| node_store
node_analysis -->|"uses state"| node_store
node_plan -->|"uses state"| node_store
node_tune -->|"uses state"| node_store
node_result -->|"uses state"| node_store
node_store -->|"calls"| node_api
node_api -->|"selects fallback"| node_mock
node_api -->|"invokes commands"| node_tauri
node_tauri -->|"dispatches engine calls"| node_bridge
node_tauri -->|"delegates file operations"| node_fileops
node_tauri -->|"delegates model management"| node_ollama
node_tauri -->|"checks system"| node_system
node_tauri -->|"reads and saves settings"| node_settings
node_bridge -->|"exchanges JSON"| node_python
node_python -.->|"uses local models"| node_ollama_service
node_ollama -.->|"manages models"| node_ollama_service
node_store -->|"uses domain types"| node_types
node_api -->|"uses domain types"| node_types
node_mock -->|"renders sample data with"| node_ui
node_analysis -->|"uses components"| node_ui
node_plan -->|"formats display values"| node_format
node_plan -->|"uses components"| node_ui
node_analysis -->|"formats display values"| node_format
node_python -.->|"produces plan for"| node_fileops
node_user -->|"reviews organization plan"| node_plan
node_user -->|"applies or undoes moves"| node_fileops

click node_entry "https://github.com/aleuuu/hranilka/blob/main/src/main.tsx"
click node_app "https://github.com/aleuuu/hranilka/blob/main/src/App.tsx"
click node_onboarding "https://github.com/aleuuu/hranilka/blob/main/src/screens/Onboarding.tsx"
click node_shell "https://github.com/aleuuu/hranilka/blob/main/src/screens/Shell.tsx"
click node_start "https://github.com/aleuuu/hranilka/blob/main/src/screens/Start.tsx"
click node_analysis "https://github.com/aleuuu/hranilka/blob/main/src/screens/Analysis.tsx"
click node_plan "https://github.com/aleuuu/hranilka/blob/main/src/screens/Plan.tsx"
click node_tune "https://github.com/aleuuu/hranilka/blob/main/src/screens/Tune.tsx"
click node_result "https://github.com/aleuuu/hranilka/blob/main/src/screens/Result.tsx"
click node_modals "https://github.com/aleuuu/hranilka/blob/main/src/screens/Modals.tsx"
click node_store "https://github.com/aleuuu/hranilka/blob/main/src/store.ts"
click node_api "https://github.com/aleuuu/hranilka/blob/main/src/lib/api.ts"
click node_mock "https://github.com/aleuuu/hranilka/blob/main/src/lib/mock.ts"
click node_ui "https://github.com/aleuuu/hranilka/blob/main/src/ui.tsx"
click node_format "https://github.com/aleuuu/hranilka/blob/main/src/lib/format.ts"
click node_types "https://github.com/aleuuu/hranilka/blob/main/src/lib/types.ts"
click node_tauri "https://github.com/aleuuu/hranilka/blob/main/src-tauri/src/lib.rs"
click node_bridge "https://github.com/aleuuu/hranilka/blob/main/src-tauri/src/engine.rs"
click node_fileops "https://github.com/aleuuu/hranilka/blob/main/src-tauri/src/fsops.rs"
click node_ollama "https://github.com/aleuuu/hranilka/blob/main/src-tauri/src/ollama.rs"
click node_system "https://github.com/aleuuu/hranilka/blob/main/src-tauri/src/sys.rs"
click node_settings "https://github.com/aleuuu/hranilka/blob/main/src-tauri/src/settings.rs"
click node_python "https://github.com/aleuuu/hranilka/blob/main/engine/engine.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_entry,node_app,node_onboarding,node_shell,node_modals,node_store,node_api,node_mock,node_ui,node_format,node_types,node_user toneBlue
class node_start,node_analysis,node_plan,node_tune,node_result toneAmber
class node_tauri,node_bridge,node_fileops,node_ollama,node_system,node_settings toneMint
class node_python toneRose
class node_ollama_service toneIndigo
```

## Components

### Interface

- [UI entry](https://github.com/aleuuu/hranilka/blob/main/src/main.tsx): `src/main.tsx`
- [App shell](https://github.com/aleuuu/hranilka/blob/main/src/App.tsx): `src/App.tsx`
- [Onboarding](https://github.com/aleuuu/hranilka/blob/main/src/screens/Onboarding.tsx): `src/screens/Onboarding.tsx`
- [Screen router](https://github.com/aleuuu/hranilka/blob/main/src/screens/Shell.tsx): `src/screens/Shell.tsx`
- [Dialogs](https://github.com/aleuuu/hranilka/blob/main/src/screens/Modals.tsx): `src/screens/Modals.tsx`
- [App state](https://github.com/aleuuu/hranilka/blob/main/src/store.ts): `src/store.ts`
- [Typed API](https://github.com/aleuuu/hranilka/blob/main/src/lib/api.ts): `src/lib/api.ts`
- [Browser mock](https://github.com/aleuuu/hranilka/blob/main/src/lib/mock.ts): `src/lib/mock.ts`
- [UI components](https://github.com/aleuuu/hranilka/blob/main/src/ui.tsx): `src/ui.tsx`
- [Formatting](https://github.com/aleuuu/hranilka/blob/main/src/lib/format.ts): `src/lib/format.ts`
- [Domain types](https://github.com/aleuuu/hranilka/blob/main/src/lib/types.ts): `src/lib/types.ts`

### Organization workflow

- [Folder selection](https://github.com/aleuuu/hranilka/blob/main/src/screens/Start.tsx): `src/screens/Start.tsx`
- [Analysis view](https://github.com/aleuuu/hranilka/blob/main/src/screens/Analysis.tsx): `src/screens/Analysis.tsx`
- [Plan review](https://github.com/aleuuu/hranilka/blob/main/src/screens/Plan.tsx): `src/screens/Plan.tsx`
- [Plan tuning](https://github.com/aleuuu/hranilka/blob/main/src/screens/Tune.tsx): `src/screens/Tune.tsx`
- [Apply result](https://github.com/aleuuu/hranilka/blob/main/src/screens/Result.tsx): `src/screens/Result.tsx`

### Desktop services

- [Command handlers](https://github.com/aleuuu/hranilka/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`
- [Engine process bridge](https://github.com/aleuuu/hranilka/blob/main/src-tauri/src/engine.rs): `src-tauri/src/engine.rs`
- [File moves and undo](https://github.com/aleuuu/hranilka/blob/main/src-tauri/src/fsops.rs): `src-tauri/src/fsops.rs`
- [Ollama management](https://github.com/aleuuu/hranilka/blob/main/src-tauri/src/ollama.rs): `src-tauri/src/ollama.rs`
- [System checks](https://github.com/aleuuu/hranilka/blob/main/src-tauri/src/sys.rs): `src-tauri/src/sys.rs`
- [Settings storage](https://github.com/aleuuu/hranilka/blob/main/src-tauri/src/settings.rs): `src-tauri/src/settings.rs`

### Analysis engine

- [Scan and plan engine](https://github.com/aleuuu/hranilka/blob/main/engine/engine.py): `engine/engine.py`

### Other components

- **User**
- **Ollama service**

## Connections

- User → UI entry: opens app (evidence: `README.md`)
- UI entry → App shell: renders (evidence: `src/main.tsx`)
- App shell → Onboarding: renders (evidence: `src/App.tsx`)
- App shell → Screen router: renders (evidence: `src/App.tsx`)
- App shell → Dialogs: renders (evidence: `src/App.tsx`)
- Screen router → Folder selection: routes to (evidence: `src/screens/Shell.tsx`)
- Screen router → Analysis view: routes to (evidence: `src/screens/Shell.tsx`)
- Screen router → Plan review: routes to (evidence: `src/screens/Shell.tsx`)
- Screen router → Apply result: routes to (evidence: `src/screens/Shell.tsx`)
- Screen router → Plan tuning: routes to (evidence: `src/screens/Shell.tsx`)
- Onboarding → App state: starts checks (evidence: `src/screens/Onboarding.tsx`)
- Folder selection → App state: selects folder (evidence: `src/screens/Start.tsx`)
- Analysis view → App state: uses state (evidence: `src/screens/Analysis.tsx`)
- Plan review → App state: uses state (evidence: `src/screens/Plan.tsx`)
- Plan tuning → App state: uses state (evidence: `src/screens/Tune.tsx`)
- Apply result → App state: uses state (evidence: `src/screens/Result.tsx`)
- App state → Typed API: calls (evidence: `src/store.ts`)
- Typed API → Browser mock: selects fallback (evidence: `src/lib/api.ts`)
- Typed API → Command handlers: invokes commands (evidence: `src/lib/api.ts`)
- Command handlers → Engine process bridge: dispatches engine calls (evidence: `src-tauri/src/lib.rs`)
- Command handlers → File moves and undo: delegates file operations (evidence: `src-tauri/src/lib.rs`)
- Command handlers → Ollama management: delegates model management (evidence: `src-tauri/src/lib.rs`)
- Command handlers → System checks: checks system (evidence: `src-tauri/src/lib.rs`)
- Command handlers → Settings storage: reads and saves settings (evidence: `src-tauri/src/lib.rs`)
- Engine process bridge → Scan and plan engine: exchanges JSON (evidence: `src-tauri/src/engine.rs`)
- Scan and plan engine → Ollama service: uses local models (evidence: `README.md`)
- Ollama management → Ollama service: manages models (evidence: `README.md`)
- App state → Domain types: uses domain types (evidence: `src/store.ts`)
- Typed API → Domain types: uses domain types (evidence: `src/lib/api.ts`)
- Browser mock → UI components: renders sample data with (evidence: `src/lib/mock.ts`)
- Analysis view → UI components: uses components (evidence: `src/screens/Analysis.tsx`)
- Plan review → Formatting: formats display values (evidence: `src/screens/Plan.tsx`)
- Plan review → UI components: uses components (evidence: `src/screens/Plan.tsx`)
- Analysis view → Formatting: formats display values (evidence: `src/screens/Analysis.tsx`)
- Scan and plan engine → File moves and undo: produces plan for (evidence: `README.md`)
- User → Plan review: reviews organization plan (evidence: `README.md`)
- User → File moves and undo: applies or undoes moves (evidence: `README.md`)
