# alinice1998/munajjam-desktop architecture

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

- Interactive diagram: https://gitdiagram.com/alinice1998/munajjam-desktop
- Repository: https://github.com/alinice1998/munajjam-desktop

## Overview

Munajjam is a Quranic recitation alignment workstation: users load audio and Quran text in the desktop QA editor, select an alignment method, review word and breath timings, and can process batches. The desktop communicates with a local FastAPI server; alignment combines the documented Zipformer, neural breath segmentation, and (for hybrid mode) Wav2Vec2 refinement. The README also documents Quran text data, waveform editing/playback, batch manifests, localization, and progress reporting. Flutter internals and several server routes were not sampled, so those links reflect README claims rather than inspected calls.

Main entry points: [`munajjam_desktop/lib/views/qa_screen.dart`](https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/views/qa_screen.dart) (QA workspace), [`munajjam_server.py`](https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_server.py) (REST job API), [`hybrid_aligner/hybrid_pipeline.py`](https://github.com/alinice1998/munajjam-desktop/blob/main/hybrid_aligner/hybrid_pipeline.py) (Hybrid pipeline), [`munajjam_desktop/lib/services/aligner_api_service.dart`](https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/services/aligner_api_service.dart) (Alignment API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop workstation"]
  node_qa["QA workspace<br/>[qa_screen.dart]"]
  node_alignment_ui["Alignment controls"]
  node_waveform["Waveform editor"]
  node_player["Karaoke player"]
  node_batch["Batch alignment"]
  node_audio["Audio services<br/>[audio_service.dart]"]
  node_api_client["Alignment API client"]
  node_server_manager["Server lifecycle"]
  node_localization["Localization<br/>[app_locale.dart]"]
  node_batch_items["Batch item model"]
end

subgraph group_server["Local API"]
  node_api["REST job API<br/>[munajjam_server.py]"]
end

subgraph group_alignment["Alignment engines"]
  node_zipformer["Zipformer aligner<br/>[neural_aligner.py]"]
  node_hybrid["Hybrid pipeline<br/>[hybrid_pipeline.py]"]
  node_segmenter["Breath segmenter"]
  node_wav2vec["Forced aligner"]
  node_gpu["GPU providers<br/>[gpu_utils.py]"]
end

subgraph group_resources["Quran resources"]
  node_quran_data[("Quran text data<br/>[quran_hafsh.json]")]
end

node_user(("Recitation editor"))

node_user -->|"edits recitation"| node_qa
node_qa -.->|"configures alignment"| node_alignment_ui
node_qa -.->|"reviews timings"| node_waveform
node_qa -.->|"plays audio"| node_player
node_qa -.->|"submits jobs"| node_api_client
node_batch -.->|"requests alignment"| node_api_client
node_batch -.->|"tracks items"| node_batch_items
node_qa -.->|"loads audio"| node_audio
node_api_client -.->|"calls REST API"| node_api
node_server_manager -.->|"starts server"| node_api
node_api -.->|"dispatches alignment"| node_hybrid
node_api -.->|"dispatches classic mode"| node_zipformer
node_hybrid -->|"segments breaths"| node_segmenter
node_hybrid -->|"refines words"| node_wav2vec
node_hybrid -.->|"recognizes speech"| node_zipformer
node_segmenter -->|"selects providers"| node_gpu
node_wav2vec -.->|"selects providers"| node_gpu
node_api -.->|"serves Quran data"| node_quran_data
node_api -.->|"returns progress"| node_api_client

click node_qa "https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/views/qa_screen.dart"
click node_alignment_ui "https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/views/widgets/hybrid_alignment_modal.dart"
click node_waveform "https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/views/widgets/waveform_editor.dart"
click node_player "https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/views/widgets/karaoke_player.dart"
click node_batch "https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/services/batch_alignment_service.dart"
click node_audio "https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/services/audio_service.dart"
click node_api_client "https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/services/aligner_api_service.dart"
click node_server_manager "https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/core/server_manager.dart"
click node_localization "https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/core/localization/app_locale.dart"
click node_api "https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_server.py"
click node_zipformer "https://github.com/alinice1998/munajjam-desktop/blob/main/neural_aligner.py"
click node_hybrid "https://github.com/alinice1998/munajjam-desktop/blob/main/hybrid_aligner/hybrid_pipeline.py"
click node_segmenter "https://github.com/alinice1998/munajjam-desktop/blob/main/hybrid_aligner/recitation_segmenter.py"
click node_wav2vec "https://github.com/alinice1998/munajjam-desktop/blob/main/hybrid_aligner/wav2vec2_aligner.py"
click node_gpu "https://github.com/alinice1998/munajjam-desktop/blob/main/hybrid_aligner/gpu_utils.py"
click node_quran_data "https://github.com/alinice1998/munajjam-desktop/blob/main/data/quran_hafsh.json"
click node_batch_items "https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/models/batch_alignment_item.dart"

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_qa,node_alignment_ui,node_waveform,node_player,node_batch,node_audio,node_api_client,node_server_manager,node_localization,node_batch_items toneBlue
class node_api toneAmber
class node_zipformer,node_hybrid,node_segmenter,node_wav2vec,node_gpu toneMint
class node_quran_data toneRose
class node_user toneIndigo
```

## Components

### Desktop workstation

- [QA workspace](https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/views/qa_screen.dart): `munajjam_desktop/lib/views/qa_screen.dart`
- [Alignment controls](https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/views/widgets/hybrid_alignment_modal.dart): `munajjam_desktop/lib/views/widgets/hybrid_alignment_modal.dart`
- [Waveform editor](https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/views/widgets/waveform_editor.dart): `munajjam_desktop/lib/views/widgets/waveform_editor.dart`
- [Karaoke player](https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/views/widgets/karaoke_player.dart): `munajjam_desktop/lib/views/widgets/karaoke_player.dart`
- [Batch alignment](https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/services/batch_alignment_service.dart): `munajjam_desktop/lib/services/batch_alignment_service.dart`
- [Audio services](https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/services/audio_service.dart): `munajjam_desktop/lib/services/audio_service.dart`
- [Alignment API client](https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/services/aligner_api_service.dart): `munajjam_desktop/lib/services/aligner_api_service.dart`
- [Server lifecycle](https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/core/server_manager.dart): `munajjam_desktop/lib/core/server_manager.dart`
- [Localization](https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/core/localization/app_locale.dart): `munajjam_desktop/lib/core/localization/app_locale.dart`
- [Batch item model](https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_desktop/lib/models/batch_alignment_item.dart): `munajjam_desktop/lib/models/batch_alignment_item.dart`

### Local API

- [REST job API](https://github.com/alinice1998/munajjam-desktop/blob/main/munajjam_server.py): `munajjam_server.py`

### Alignment engines

- [Zipformer aligner](https://github.com/alinice1998/munajjam-desktop/blob/main/neural_aligner.py): `neural_aligner.py`
- [Hybrid pipeline](https://github.com/alinice1998/munajjam-desktop/blob/main/hybrid_aligner/hybrid_pipeline.py): `hybrid_aligner/hybrid_pipeline.py`
- [Breath segmenter](https://github.com/alinice1998/munajjam-desktop/blob/main/hybrid_aligner/recitation_segmenter.py): `hybrid_aligner/recitation_segmenter.py`
- [Forced aligner](https://github.com/alinice1998/munajjam-desktop/blob/main/hybrid_aligner/wav2vec2_aligner.py): `hybrid_aligner/wav2vec2_aligner.py`
- [GPU providers](https://github.com/alinice1998/munajjam-desktop/blob/main/hybrid_aligner/gpu_utils.py): `hybrid_aligner/gpu_utils.py`

### Quran resources

- [Quran text data](https://github.com/alinice1998/munajjam-desktop/blob/main/data/quran_hafsh.json): `data/quran_hafsh.json`

### Other components

- **Recitation editor**

## Connections

- Recitation editor → QA workspace: edits recitation (evidence: `README.md`)
- QA workspace → Alignment controls: configures alignment (evidence: `README.md`)
- QA workspace → Waveform editor: reviews timings (evidence: `README.md`)
- QA workspace → Karaoke player: plays audio (evidence: `README.md`)
- QA workspace → Alignment API client: submits jobs (evidence: `README.md`)
- Batch alignment → Alignment API client: requests alignment (evidence: `README.md`)
- Batch alignment → Batch item model: tracks items
- QA workspace → Audio services: loads audio
- Alignment API client → REST job API: calls REST API (evidence: `README.md`)
- Server lifecycle → REST job API: starts server (evidence: `README.md`)
- REST job API → Hybrid pipeline: dispatches alignment (evidence: `README.md`)
- REST job API → Zipformer aligner: dispatches classic mode (evidence: `README.md`)
- Hybrid pipeline → Breath segmenter: segments breaths (evidence: `hybrid_aligner/hybrid_pipeline.py`)
- Hybrid pipeline → Forced aligner: refines words (evidence: `hybrid_aligner/hybrid_pipeline.py`)
- Hybrid pipeline → Zipformer aligner: recognizes speech (evidence: `hybrid_aligner/hybrid_pipeline.py`)
- Breath segmenter → GPU providers: selects providers (evidence: `hybrid_aligner/recitation_segmenter.py`)
- Forced aligner → GPU providers: selects providers (evidence: `hybrid_aligner/wav2vec2_aligner.py`)
- REST job API → Quran text data: serves Quran data (evidence: `munajjam_server.py`)
- REST job API → Alignment API client: returns progress (evidence: `README.md`)
