# sharkye1/szhimatar2 architecture

> Architecture diagram of the GitHub repository sharkye1/szhimatar2, 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/sharkye1/szhimatar2
- Repository: https://github.com/sharkye1/szhimatar2

## Overview

Szhimatar is an offline desktop video compressor and media downloader. Users configure media settings, add files or URLs, preview and queue work, then monitor renders or downloads and retrieve completed files. Rendering is coordinated by a frontend service and scheduler, with FFmpeg processing delegated through the Tauri/Rust backend; downloads use yt-dlp. The README documents additional capabilities such as parallel CPU/GPU rendering, process isolation, presets, themes, localization, and render statistics. Some subsystem links are documented rather than visible in sampled implementation excerpts.

Main entry points: [`src/pages/MainWindow.tsx`](https://github.com/sharkye1/szhimatar2/blob/main/src/pages/MainWindow.tsx) (Main workspace), [`src/services/RenderService.ts`](https://github.com/sharkye1/szhimatar2/blob/main/src/services/RenderService.ts) (Render service), [`src-tauri/src/main.rs`](https://github.com/sharkye1/szhimatar2/blob/main/src-tauri/src/main.rs) (Tauri commands), [`src/contexts/SettingsContext.tsx`](https://github.com/sharkye1/szhimatar2/blob/main/src/contexts/SettingsContext.tsx) (Settings context)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop application"]
  node_app_shell["App shell<br/>[App.tsx]"]
  node_main_window["Main workspace<br/>[MainWindow.tsx]"]
  node_dragdrop["File drag-in"]
  node_file_dragout["File drag-out<br/>[useFileDragOut.ts]"]
end

subgraph group_render["Video rendering"]
  node_render_queue["Render queue hook<br/>[useRenderQueue.ts]"]
  node_render_service["Render service<br/>[RenderService.ts]"]
  node_scheduler["Render scheduler<br/>[RenderScheduler.ts]"]
  node_preview["Media preview<br/>[PreviewPanel.tsx]"]
  node_video_settings["Video settings<br/>[VideoSettings.tsx]"]
  node_audio_settings["Audio settings<br/>[AudioSettings.tsx]"]
  node_validation["Media validation<br/>[videoValidation.ts]"]
  node_audio_validation["Audio validation<br/>[audioValidation.ts]"]
  node_ffmpeg_tools["FFmpeg utilities<br/>[ffmpeg.ts]"]
  node_ffmpeg_finder["FFmpeg discovery<br/>[FFmpegFinder.ts]"]
  node_render_stats["Render statistics"]
end

subgraph group_download["Media downloads"]
  node_download_queue["Download queue"]
  node_download_service["Download service<br/>[DownloadService.ts]"]
end

subgraph group_config["Settings and presets"]
  node_settings_context["Settings context"]
  node_theme_context["Theme context<br/>[ThemeContext.tsx]"]
  node_language_context["Language context"]
  node_presets["Preset manager<br/>[PresetManager.tsx]"]
  node_updates["Update service<br/>[UpdateService.ts]"]
end

subgraph group_runtime["Native runtime"]
  node_yt_dlp["yt-dlp manager<br/>[yt_dlp_manager.rs]"]
  node_rust_process["Process manager<br/>[process_manager.rs]"]
  node_tauri_backend["Tauri commands<br/>[main.rs]"]
end

node_user(("User"))
node_ffmpeg["FFmpeg / FFprobe"]
node_local_data[("Local app data")]

node_user -->|"uses"| node_app_shell
node_app_shell -->|"shows"| node_main_window
node_user -->|"drops files"| node_dragdrop
node_main_window -->|"manages"| node_render_queue
node_main_window -->|"manages"| node_download_queue
node_main_window -->|"opens preview"| node_preview
node_main_window -->|"configures"| node_video_settings
node_main_window -->|"configures"| node_audio_settings
node_main_window -->|"manages presets"| node_presets
node_render_queue -->|"delegates"| node_render_service
node_render_service -->|"uses"| node_scheduler
node_render_service -->|"validates video"| node_validation
node_render_service -->|"validates audio"| node_audio_validation
node_render_service -->|"uses"| node_ffmpeg_tools
node_render_service -->|"records renders"| node_render_stats
node_render_service -->|"invokes commands"| node_tauri_backend
node_ffmpeg_tools -->|"executes probes"| node_ffmpeg
node_tauri_backend -->|"uses process manager"| node_rust_process
node_tauri_backend -->|"uses download manager"| node_yt_dlp
node_download_queue -->|"delegates"| node_download_service
node_main_window -->|"starts downloads"| node_download_service
node_download_service -.->|"invokes commands"| node_tauri_backend
node_yt_dlp -->|"uses process manager"| node_rust_process
node_user -->|"drags completed file"| node_file_dragout
node_file_dragout -->|"starts native drag"| node_tauri_backend
node_ffmpeg_finder -->|"locates binaries"| node_ffmpeg
node_settings_context -->|"loads and saves"| node_tauri_backend
node_settings_context -->|"persists settings"| node_local_data
node_theme_context -->|"reads preferences"| node_settings_context
node_language_context -->|"reads preferences"| node_settings_context
node_presets -->|"loads and saves"| node_tauri_backend
node_render_stats -->|"persists statistics"| node_tauri_backend
node_render_stats -->|"stores history"| node_local_data
node_main_window -->|"checks updates"| node_updates
node_user -->|"configures compression"| node_video_settings
node_user -->|"configures audio"| node_audio_settings
node_render_service -.->|"renders media"| node_ffmpeg

click node_app_shell "https://github.com/sharkye1/szhimatar2/blob/main/src/App.tsx"
click node_main_window "https://github.com/sharkye1/szhimatar2/blob/main/src/pages/MainWindow.tsx"
click node_dragdrop "https://github.com/sharkye1/szhimatar2/blob/main/src/components/DragDropOverlay.tsx"
click node_file_dragout "https://github.com/sharkye1/szhimatar2/blob/main/src/hooks/useFileDragOut.ts"
click node_render_queue "https://github.com/sharkye1/szhimatar2/blob/main/src/hooks/useRenderQueue.ts"
click node_render_service "https://github.com/sharkye1/szhimatar2/blob/main/src/services/RenderService.ts"
click node_scheduler "https://github.com/sharkye1/szhimatar2/blob/main/src/services/RenderScheduler.ts"
click node_preview "https://github.com/sharkye1/szhimatar2/blob/main/src/components/PreviewPanel.tsx"
click node_video_settings "https://github.com/sharkye1/szhimatar2/blob/main/src/pages/VideoSettings.tsx"
click node_audio_settings "https://github.com/sharkye1/szhimatar2/blob/main/src/pages/AudioSettings.tsx"
click node_validation "https://github.com/sharkye1/szhimatar2/blob/main/src/utils/videoValidation.ts"
click node_audio_validation "https://github.com/sharkye1/szhimatar2/blob/main/src/utils/audioValidation.ts"
click node_ffmpeg_tools "https://github.com/sharkye1/szhimatar2/blob/main/src/utils/ffmpeg.ts"
click node_ffmpeg_finder "https://github.com/sharkye1/szhimatar2/blob/main/src/services/FFmpegFinder.ts"
click node_render_stats "https://github.com/sharkye1/szhimatar2/blob/main/src/services/StatisticsService.ts"
click node_download_queue "https://github.com/sharkye1/szhimatar2/blob/main/src/hooks/useDownloadQueue.ts"
click node_download_service "https://github.com/sharkye1/szhimatar2/blob/main/src/services/DownloadService.ts"
click node_yt_dlp "https://github.com/sharkye1/szhimatar2/blob/main/src-tauri/src/yt_dlp_manager.rs"
click node_rust_process "https://github.com/sharkye1/szhimatar2/blob/main/src-tauri/src/process_manager.rs"
click node_tauri_backend "https://github.com/sharkye1/szhimatar2/blob/main/src-tauri/src/main.rs"
click node_settings_context "https://github.com/sharkye1/szhimatar2/blob/main/src/contexts/SettingsContext.tsx"
click node_theme_context "https://github.com/sharkye1/szhimatar2/blob/main/src/contexts/ThemeContext.tsx"
click node_language_context "https://github.com/sharkye1/szhimatar2/blob/main/src/contexts/LanguageContext.tsx"
click node_presets "https://github.com/sharkye1/szhimatar2/blob/main/src/components/PresetManager.tsx"
click node_updates "https://github.com/sharkye1/szhimatar2/blob/main/src/services/UpdateService.ts"

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_shell,node_main_window,node_dragdrop,node_file_dragout,node_user toneBlue
class node_render_queue,node_render_service,node_scheduler,node_preview,node_video_settings,node_audio_settings,node_validation,node_audio_validation,node_ffmpeg_tools,node_ffmpeg_finder,node_render_stats,node_local_data toneAmber
class node_download_queue,node_download_service toneMint
class node_settings_context,node_theme_context,node_language_context,node_presets,node_updates toneRose
class node_yt_dlp,node_rust_process,node_tauri_backend,node_ffmpeg toneIndigo
```

## Components

### Desktop application

- [App shell](https://github.com/sharkye1/szhimatar2/blob/main/src/App.tsx): `src/App.tsx`
- [Main workspace](https://github.com/sharkye1/szhimatar2/blob/main/src/pages/MainWindow.tsx): `src/pages/MainWindow.tsx`
- [File drag-in](https://github.com/sharkye1/szhimatar2/blob/main/src/components/DragDropOverlay.tsx): `src/components/DragDropOverlay.tsx`
- [File drag-out](https://github.com/sharkye1/szhimatar2/blob/main/src/hooks/useFileDragOut.ts): `src/hooks/useFileDragOut.ts`

### Video rendering

- [Render queue hook](https://github.com/sharkye1/szhimatar2/blob/main/src/hooks/useRenderQueue.ts): `src/hooks/useRenderQueue.ts`
- [Render service](https://github.com/sharkye1/szhimatar2/blob/main/src/services/RenderService.ts): `src/services/RenderService.ts`
- [Render scheduler](https://github.com/sharkye1/szhimatar2/blob/main/src/services/RenderScheduler.ts): `src/services/RenderScheduler.ts`
- [Media preview](https://github.com/sharkye1/szhimatar2/blob/main/src/components/PreviewPanel.tsx): `src/components/PreviewPanel.tsx`
- [Video settings](https://github.com/sharkye1/szhimatar2/blob/main/src/pages/VideoSettings.tsx): `src/pages/VideoSettings.tsx`
- [Audio settings](https://github.com/sharkye1/szhimatar2/blob/main/src/pages/AudioSettings.tsx): `src/pages/AudioSettings.tsx`
- [Media validation](https://github.com/sharkye1/szhimatar2/blob/main/src/utils/videoValidation.ts): `src/utils/videoValidation.ts`
- [Audio validation](https://github.com/sharkye1/szhimatar2/blob/main/src/utils/audioValidation.ts): `src/utils/audioValidation.ts`
- [FFmpeg utilities](https://github.com/sharkye1/szhimatar2/blob/main/src/utils/ffmpeg.ts): `src/utils/ffmpeg.ts`
- [FFmpeg discovery](https://github.com/sharkye1/szhimatar2/blob/main/src/services/FFmpegFinder.ts): `src/services/FFmpegFinder.ts`
- [Render statistics](https://github.com/sharkye1/szhimatar2/blob/main/src/services/StatisticsService.ts): `src/services/StatisticsService.ts`

### Media downloads

- [Download queue](https://github.com/sharkye1/szhimatar2/blob/main/src/hooks/useDownloadQueue.ts): `src/hooks/useDownloadQueue.ts`
- [Download service](https://github.com/sharkye1/szhimatar2/blob/main/src/services/DownloadService.ts): `src/services/DownloadService.ts`

### Settings and presets

- [Settings context](https://github.com/sharkye1/szhimatar2/blob/main/src/contexts/SettingsContext.tsx): `src/contexts/SettingsContext.tsx`
- [Theme context](https://github.com/sharkye1/szhimatar2/blob/main/src/contexts/ThemeContext.tsx): `src/contexts/ThemeContext.tsx`
- [Language context](https://github.com/sharkye1/szhimatar2/blob/main/src/contexts/LanguageContext.tsx): `src/contexts/LanguageContext.tsx`
- [Preset manager](https://github.com/sharkye1/szhimatar2/blob/main/src/components/PresetManager.tsx): `src/components/PresetManager.tsx`
- [Update service](https://github.com/sharkye1/szhimatar2/blob/main/src/services/UpdateService.ts): `src/services/UpdateService.ts`

### Native runtime

- [yt-dlp manager](https://github.com/sharkye1/szhimatar2/blob/main/src-tauri/src/yt_dlp_manager.rs): `src-tauri/src/yt_dlp_manager.rs`
- [Process manager](https://github.com/sharkye1/szhimatar2/blob/main/src-tauri/src/process_manager.rs): `src-tauri/src/process_manager.rs`
- [Tauri commands](https://github.com/sharkye1/szhimatar2/blob/main/src-tauri/src/main.rs): `src-tauri/src/main.rs`

### Other components

- **User**
- **FFmpeg / FFprobe**
- **Local app data**

## Connections

- User → App shell: uses
- App shell → Main workspace: shows (evidence: `src/App.tsx`)
- User → File drag-in: drops files
- Main workspace → Render queue hook: manages (evidence: `src/pages/MainWindow.tsx`)
- Main workspace → Download queue: manages (evidence: `src/pages/MainWindow.tsx`)
- Main workspace → Media preview: opens preview (evidence: `src/pages/MainWindow.tsx`)
- Main workspace → Video settings: configures (evidence: `src/pages/MainWindow.tsx`)
- Main workspace → Audio settings: configures (evidence: `src/App.tsx`)
- Main workspace → Preset manager: manages presets (evidence: `src/pages/MainWindow.tsx`)
- Render queue hook → Render service: delegates (evidence: `src/hooks/useRenderQueue.ts`)
- Render service → Render scheduler: uses (evidence: `src/services/RenderService.ts`)
- Render service → Media validation: validates video (evidence: `src/services/RenderService.ts`)
- Render service → Audio validation: validates audio (evidence: `src/services/RenderService.ts`)
- Render service → FFmpeg utilities: uses (evidence: `src/services/RenderService.ts`)
- Render service → Render statistics: records renders (evidence: `src/services/RenderService.ts`)
- Render service → Tauri commands: invokes commands (evidence: `src/services/RenderService.ts`)
- FFmpeg utilities → FFmpeg / FFprobe: executes probes (evidence: `src/utils/ffmpeg.ts`)
- Tauri commands → Process manager: uses process manager (evidence: `src-tauri/src/main.rs`)
- Tauri commands → yt-dlp manager: uses download manager (evidence: `src-tauri/src/main.rs`)
- Download queue → Download service: delegates (evidence: `src/hooks/useDownloadQueue.ts`)
- Main workspace → Download service: starts downloads (evidence: `src/pages/MainWindow.tsx`)
- Download service → Tauri commands: invokes commands
- yt-dlp manager → Process manager: uses process manager (evidence: `src-tauri/src/yt_dlp_manager.rs`)
- User → File drag-out: drags completed file
- File drag-out → Tauri commands: starts native drag (evidence: `src/hooks/useFileDragOut.ts`)
- FFmpeg discovery → FFmpeg / FFprobe: locates binaries (evidence: `src/services/FFmpegFinder.ts`)
- Settings context → Tauri commands: loads and saves (evidence: `src/contexts/SettingsContext.tsx`)
- Settings context → Local app data: persists settings
- Theme context → Settings context: reads preferences (evidence: `src/contexts/ThemeContext.tsx`)
- Language context → Settings context: reads preferences (evidence: `src/contexts/LanguageContext.tsx`)
- Preset manager → Tauri commands: loads and saves (evidence: `src/components/PresetManager.tsx`)
- Render statistics → Tauri commands: persists statistics (evidence: `src/services/StatisticsService.ts`)
- Render statistics → Local app data: stores history
- Main workspace → Update service: checks updates (evidence: `src/pages/MainWindow.tsx`)
- User → Video settings: configures compression
- User → Audio settings: configures audio
- Render service → FFmpeg / FFprobe: renders media
