# ozcancelik/harfiyen architecture

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

- Interactive diagram: https://gitdiagram.com/ozcancelik/harfiyen
- Repository: https://github.com/ozcancelik/harfiyen

## Overview

Harfiyen is a browser-based, local-processing Turkish transcription and captioned-video editor. The main workflow is to load media or start a microphone, transcribe it into timed words, edit and style the transcript, preview it, then export captioned video. Documented branches include multiple recognition models, punctuation and number formatting, speaker identification, text-to-speech dubbing, and kinetic typography. The graph uses the supplied source index and excerpts for implementation links; README links represent documented capabilities where implementation details were not sampled.

Main entry points: [`src/App.tsx`](https://github.com/ozcancelik/harfiyen/blob/main/src/App.tsx) (App shell), [`src/worker/asr.worker.ts`](https://github.com/ozcancelik/harfiyen/blob/main/src/worker/asr.worker.ts) (ASR worker), [`src/captions/renderer.ts`](https://github.com/ozcancelik/harfiyen/blob/main/src/captions/renderer.ts) (Caption renderer), [`src/components/Viewer.tsx`](https://github.com/ozcancelik/harfiyen/blob/main/src/components/Viewer.tsx) (Preview controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Editing app"]
  node_app["App shell<br/>[App.tsx]"]
  node_media["Media and mic input<br/>[Dropzone.tsx]"]
  node_transcript_ui["Transcript editor<br/>[Transcript.tsx]"]
  node_preview_ui["Preview controls<br/>[Viewer.tsx]"]
end

subgraph group_speech["Speech processing"]
  node_transcriber["Transcription controller<br/>[useTranscriber.ts]"]
  node_asr_worker["ASR worker<br/>[asr.worker.ts]"]
  node_engine["Seda recognition engine<br/>[index.ts]"]
  node_engine_models["ONNX model sessions<br/>[models.ts]"]
  node_whisper["Whisper recognition<br/>[index.ts]"]
  node_duyu["Duyu recognition<br/>[index.ts]"]
  node_models["Model definitions<br/>[models.ts]"]
  node_punct["Punctuation formatter<br/>[formatter.ts]"]
end

subgraph group_project["Project and transcript"]
  node_projects[("Project persistence<br/>[projectStore.ts]")]
  node_cues["Timed caption cues<br/>[cues.ts]"]
  node_crop["Crop and framing<br/>[crop.ts]"]
  node_speakers["Speaker identification<br/>[speakers.ts]"]
end

subgraph group_visual["Caption and video"]
  node_caption_settings["Caption styles<br/>[style.ts]"]
  node_caption_fonts["Caption fonts<br/>[fonts.ts]"]
  node_caption_renderer["Caption renderer<br/>[renderer.ts]"]
  node_aura["Audio-reactive visuals<br/>[aura.ts]"]
  node_kinetic["Kinetic typography<br/>[kinetic.ts]"]
  node_render_worker["Video export worker<br/>[render.worker.ts]"]
end

subgraph group_voice["Translation and voice"]
  node_translator["Machine translation<br/>[translator.ts]"]
  node_dub["Dubbing synthesis<br/>[tts.worker.ts]"]
  node_dub_logic["Dubbing coordination<br/>[useDubber.ts]"]
end

node_user(("User"))

node_user -->|"edits and exports"| node_app
node_app -->|"opens media"| node_media
node_app -.->|"starts transcription"| node_transcriber
node_transcriber -->|"dispatches audio"| node_asr_worker
node_asr_worker -->|"runs recognition"| node_engine
node_asr_worker -->|"runs Whisper"| node_whisper
node_asr_worker -->|"runs Duyu"| node_duyu
node_engine -->|"creates sessions"| node_engine_models
node_engine -->|"uses configuration"| node_models
node_asr_worker -->|"selects model"| node_models
node_asr_worker -->|"formats transcript"| node_punct
node_app -->|"presents transcript"| node_transcript_ui
node_app -->|"loads saved project"| node_projects
node_projects -->|"stores framing"| node_crop
node_projects -->|"stores speaker data"| node_speakers
node_transcript_ui -.->|"edits timed words"| node_cues
node_preview_ui -->|"renders preview"| node_caption_renderer
node_caption_renderer -->|"builds cues"| node_cues
node_caption_renderer -->|"reads presets"| node_caption_settings
node_caption_renderer -->|"loads fonts"| node_caption_fonts
node_preview_ui -->|"uses crop settings"| node_crop
node_preview_ui -->|"renders audio visuals"| node_aura
node_preview_ui -->|"renders kinetic style"| node_kinetic
node_app -.->|"requests video export"| node_render_worker
node_render_worker -->|"burns captions"| node_caption_renderer
node_render_worker -->|"renders kinetic video"| node_kinetic
node_render_worker -->|"applies crop"| node_crop
node_app -.->|"starts dubbing"| node_dub_logic
node_dub_logic -->|"translates transcript"| node_translator
node_dub_logic -->|"requests speech synthesis"| node_dub
node_dub -->|"loads voice model"| node_models
node_user -.->|"identifies speakers"| node_speakers

click node_app "https://github.com/ozcancelik/harfiyen/blob/main/src/App.tsx"
click node_media "https://github.com/ozcancelik/harfiyen/blob/main/src/components/Dropzone.tsx"
click node_transcript_ui "https://github.com/ozcancelik/harfiyen/blob/main/src/components/Transcript.tsx"
click node_preview_ui "https://github.com/ozcancelik/harfiyen/blob/main/src/components/Viewer.tsx"
click node_transcriber "https://github.com/ozcancelik/harfiyen/blob/main/src/lib/useTranscriber.ts"
click node_asr_worker "https://github.com/ozcancelik/harfiyen/blob/main/src/worker/asr.worker.ts"
click node_engine "https://github.com/ozcancelik/harfiyen/blob/main/src/engine/index.ts"
click node_engine_models "https://github.com/ozcancelik/harfiyen/blob/main/src/engine/models.ts"
click node_whisper "https://github.com/ozcancelik/harfiyen/blob/main/src/whisper/index.ts"
click node_duyu "https://github.com/ozcancelik/harfiyen/blob/main/src/duyu/index.ts"
click node_models "https://github.com/ozcancelik/harfiyen/blob/main/src/models.ts"
click node_punct "https://github.com/ozcancelik/harfiyen/blob/main/src/punct/formatter.ts"
click node_projects "https://github.com/ozcancelik/harfiyen/blob/main/src/lib/projectStore.ts"
click node_cues "https://github.com/ozcancelik/harfiyen/blob/main/src/lib/cues.ts"
click node_crop "https://github.com/ozcancelik/harfiyen/blob/main/src/lib/crop.ts"
click node_speakers "https://github.com/ozcancelik/harfiyen/blob/main/src/lib/speakers.ts"
click node_caption_settings "https://github.com/ozcancelik/harfiyen/blob/main/src/captions/style.ts"
click node_caption_fonts "https://github.com/ozcancelik/harfiyen/blob/main/src/captions/fonts.ts"
click node_caption_renderer "https://github.com/ozcancelik/harfiyen/blob/main/src/captions/renderer.ts"
click node_aura "https://github.com/ozcancelik/harfiyen/blob/main/src/render/aura.ts"
click node_kinetic "https://github.com/ozcancelik/harfiyen/blob/main/src/render/kinetic.ts"
click node_render_worker "https://github.com/ozcancelik/harfiyen/blob/main/src/worker/render.worker.ts"
click node_translator "https://github.com/ozcancelik/harfiyen/blob/main/src/mt/translator.ts"
click node_dub "https://github.com/ozcancelik/harfiyen/blob/main/src/worker/tts.worker.ts"
click node_dub_logic "https://github.com/ozcancelik/harfiyen/blob/main/src/lib/useDubber.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,node_media,node_transcript_ui,node_preview_ui,node_user toneBlue
class node_transcriber,node_asr_worker,node_engine,node_engine_models,node_whisper,node_duyu,node_models,node_punct toneAmber
class node_projects,node_cues,node_crop,node_speakers toneMint
class node_caption_settings,node_caption_fonts,node_caption_renderer,node_aura,node_kinetic,node_render_worker toneRose
class node_translator,node_dub,node_dub_logic toneIndigo
```

## Components

### Editing app

- [App shell](https://github.com/ozcancelik/harfiyen/blob/main/src/App.tsx): `src/App.tsx`
- [Media and mic input](https://github.com/ozcancelik/harfiyen/blob/main/src/components/Dropzone.tsx): `src/components/Dropzone.tsx`
- [Transcript editor](https://github.com/ozcancelik/harfiyen/blob/main/src/components/Transcript.tsx): `src/components/Transcript.tsx`
- [Preview controls](https://github.com/ozcancelik/harfiyen/blob/main/src/components/Viewer.tsx): `src/components/Viewer.tsx`

### Speech processing

- [Transcription controller](https://github.com/ozcancelik/harfiyen/blob/main/src/lib/useTranscriber.ts): `src/lib/useTranscriber.ts`
- [ASR worker](https://github.com/ozcancelik/harfiyen/blob/main/src/worker/asr.worker.ts): `src/worker/asr.worker.ts`
- [Seda recognition engine](https://github.com/ozcancelik/harfiyen/blob/main/src/engine/index.ts): `src/engine/index.ts`
- [ONNX model sessions](https://github.com/ozcancelik/harfiyen/blob/main/src/engine/models.ts): `src/engine/models.ts`
- [Whisper recognition](https://github.com/ozcancelik/harfiyen/blob/main/src/whisper/index.ts): `src/whisper/index.ts`
- [Duyu recognition](https://github.com/ozcancelik/harfiyen/blob/main/src/duyu/index.ts): `src/duyu/index.ts`
- [Model definitions](https://github.com/ozcancelik/harfiyen/blob/main/src/models.ts): `src/models.ts`
- [Punctuation formatter](https://github.com/ozcancelik/harfiyen/blob/main/src/punct/formatter.ts): `src/punct/formatter.ts`

### Project and transcript

- [Project persistence](https://github.com/ozcancelik/harfiyen/blob/main/src/lib/projectStore.ts): `src/lib/projectStore.ts`
- [Timed caption cues](https://github.com/ozcancelik/harfiyen/blob/main/src/lib/cues.ts): `src/lib/cues.ts`
- [Crop and framing](https://github.com/ozcancelik/harfiyen/blob/main/src/lib/crop.ts): `src/lib/crop.ts`
- [Speaker identification](https://github.com/ozcancelik/harfiyen/blob/main/src/lib/speakers.ts): `src/lib/speakers.ts`

### Caption and video

- [Caption styles](https://github.com/ozcancelik/harfiyen/blob/main/src/captions/style.ts): `src/captions/style.ts`
- [Caption fonts](https://github.com/ozcancelik/harfiyen/blob/main/src/captions/fonts.ts): `src/captions/fonts.ts`
- [Caption renderer](https://github.com/ozcancelik/harfiyen/blob/main/src/captions/renderer.ts): `src/captions/renderer.ts`
- [Audio-reactive visuals](https://github.com/ozcancelik/harfiyen/blob/main/src/render/aura.ts): `src/render/aura.ts`
- [Kinetic typography](https://github.com/ozcancelik/harfiyen/blob/main/src/render/kinetic.ts): `src/render/kinetic.ts`
- [Video export worker](https://github.com/ozcancelik/harfiyen/blob/main/src/worker/render.worker.ts): `src/worker/render.worker.ts`

### Translation and voice

- [Machine translation](https://github.com/ozcancelik/harfiyen/blob/main/src/mt/translator.ts): `src/mt/translator.ts`
- [Dubbing synthesis](https://github.com/ozcancelik/harfiyen/blob/main/src/worker/tts.worker.ts): `src/worker/tts.worker.ts`
- [Dubbing coordination](https://github.com/ozcancelik/harfiyen/blob/main/src/lib/useDubber.ts): `src/lib/useDubber.ts`

### Other components

- **User**

## Connections

- User → App shell: edits and exports
- App shell → Media and mic input: opens media (evidence: `src/App.tsx`)
- App shell → Transcription controller: starts transcription
- Transcription controller → ASR worker: dispatches audio (evidence: `src/lib/useTranscriber.ts`)
- ASR worker → Seda recognition engine: runs recognition (evidence: `src/worker/asr.worker.ts`)
- ASR worker → Whisper recognition: runs Whisper (evidence: `src/worker/asr.worker.ts`)
- ASR worker → Duyu recognition: runs Duyu (evidence: `src/worker/asr.worker.ts`)
- Seda recognition engine → ONNX model sessions: creates sessions (evidence: `src/engine/index.ts`)
- Seda recognition engine → Model definitions: uses configuration (evidence: `src/engine/index.ts`)
- ASR worker → Model definitions: selects model (evidence: `src/worker/asr.worker.ts`)
- ASR worker → Punctuation formatter: formats transcript (evidence: `src/worker/asr.worker.ts`)
- App shell → Transcript editor: presents transcript (evidence: `src/App.tsx`)
- App shell → Project persistence: loads saved project (evidence: `src/App.tsx`)
- Project persistence → Crop and framing: stores framing (evidence: `src/lib/projectStore.ts`)
- Project persistence → Speaker identification: stores speaker data (evidence: `src/lib/projectStore.ts`)
- Transcript editor → Timed caption cues: edits timed words
- Preview controls → Caption renderer: renders preview (evidence: `src/components/Viewer.tsx`)
- Caption renderer → Timed caption cues: builds cues (evidence: `src/captions/renderer.ts`)
- Caption renderer → Caption styles: reads presets (evidence: `src/captions/renderer.ts`)
- Caption renderer → Caption fonts: loads fonts (evidence: `src/captions/renderer.ts`)
- Preview controls → Crop and framing: uses crop settings (evidence: `src/components/Viewer.tsx`)
- Preview controls → Audio-reactive visuals: renders audio visuals (evidence: `src/components/Viewer.tsx`)
- Preview controls → Kinetic typography: renders kinetic style (evidence: `src/components/Viewer.tsx`)
- App shell → Video export worker: requests video export
- Video export worker → Caption renderer: burns captions (evidence: `src/worker/render.worker.ts`)
- Video export worker → Kinetic typography: renders kinetic video (evidence: `src/worker/render.worker.ts`)
- Video export worker → Crop and framing: applies crop (evidence: `src/worker/render.worker.ts`)
- App shell → Dubbing coordination: starts dubbing
- Dubbing coordination → Machine translation: translates transcript (evidence: `src/lib/useDubber.ts`)
- Dubbing coordination → Dubbing synthesis: requests speech synthesis (evidence: `src/lib/useDubber.ts`)
- Dubbing synthesis → Model definitions: loads voice model (evidence: `src/worker/tts.worker.ts`)
- User → Speaker identification: identifies speakers
