# jeremysnr/cutawan architecture

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

- Interactive diagram: https://gitdiagram.com/jeremysnr/cutawan
- Repository: https://github.com/jeremysnr/cutawan

## Overview

Cutawan is a desktop video repurposing app. The main workflow is to import a local video or link, choose viral-clip discovery or whole-video captioning, review and edit the result, then export an MP4. The README documents those product stages and the available AI and local-caption modes; source-index references and excerpts support several internal calls. Some pipeline implementations were not sampled, so edges for documented capabilities rely on the README rather than implying uninspected implementation details.

Main entry points: [`src/main/ipc.ts`](https://github.com/jeremysnr/cutawan/blob/main/src/main/ipc.ts) (IPC handlers), [`src/renderer/src/components/EditorScreen.tsx`](https://github.com/jeremysnr/cutawan/blob/main/src/renderer/src/components/EditorScreen.tsx) (Clip editor), [`src/main/pipeline/transcribe.ts`](https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/transcribe.ts) (Transcription), [`src/main/pipeline/render.ts`](https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/render.ts) (Render and export)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop app"]
  node_app["App screens<br/>[App.tsx]"]
  node_store["Project state<br/>[store.ts]"]
  node_setup["Setup and settings<br/>[SettingsModal.tsx]"]
  node_preload["Preload bridge<br/>[index.ts]"]
  node_main["Main process<br/>[index.ts]"]
  node_ipc["IPC handlers<br/>[ipc.ts]"]
  node_projects[("Project persistence<br/>[projects.ts]")]
end

subgraph group_media["Media intake"]
  node_source["Source import<br/>[sourceDiscovery.ts]"]
  node_mediaaccess["Media access<br/>[mediaAccess.ts]"]
end

subgraph group_analysis["AI analysis"]
  node_transcribe["Transcription<br/>[transcribe.ts]"]
  node_discover["Clip discovery<br/>[highlights.ts]"]
  node_visual["Visual discovery"]
  node_editorial["Editorial review<br/>[editorialReview.ts]"]
  node_whole["Whole-video mode<br/>[wholeVideo.ts]"]
end

subgraph group_editing["Editing and export"]
  node_reframe["Speaker reframing<br/>[reframe.ts]"]
  node_editor["Clip editor<br/>[EditorScreen.tsx]"]
  node_preview["Video preview<br/>[PreviewPlayer.tsx]"]
  node_render["Render and export<br/>[render.ts]"]
  node_captions["Caption generation<br/>[captions.ts]"]
  node_ffmpeg["Media processing<br/>[ffmpeg.ts]"]
end

subgraph group_services["AI and local services"]
  node_provider["AI providers<br/>[openai.ts]"]
  node_openrouter["OpenRouter setup<br/>[openrouter.ts]"]
  node_inference["Local inference<br/>[client.ts]"]
  node_whisper["Local Whisper<br/>[localWhisper.ts]"]
end

node_creator(("Creator"))
node_external{{"AI API"}}

node_creator -->|"uses"| node_app
node_app -->|"reads state"| node_store
node_creator -->|"imports video"| node_store
node_store -.->|"invokes actions"| node_preload
node_preload -.->|"bridges requests"| node_ipc
node_main -->|"registers handlers"| node_ipc
node_ipc -->|"manages projects"| node_projects
node_ipc -.->|"imports source"| node_source
node_ipc -.->|"runs pipeline"| node_transcribe
node_ipc -.->|"runs pipeline"| node_discover
node_ipc -.->|"runs discovery"| node_visual
node_ipc -->|"reviews clips"| node_editorial
node_ipc -->|"runs mode"| node_whole
node_creator -->|"chooses AI mode"| node_setup
node_setup -.->|"configures provider"| node_openrouter
node_openrouter -->|"lists models"| node_external
node_provider -.->|"requests analysis"| node_external
node_transcribe -->|"supports local speech"| node_whisper
node_transcribe -.->|"uses AI transcription"| node_provider
node_inference -.->|"runs local models"| node_external
node_discover -->|"ranks moments"| node_editorial
node_editorial -->|"extracts frame evidence"| node_visual
node_creator -->|"edits results"| node_editor
node_editor -->|"previews framing"| node_preview
node_editor -->|"adjusts framing"| node_reframe
node_whole -->|"opens whole-video edit"| node_editor
node_editor -->|"exports edit"| node_render
node_render -->|"builds captions"| node_captions
node_render -->|"encodes video"| node_ffmpeg
node_creator -->|"reopens project"| node_projects

click node_app "https://github.com/jeremysnr/cutawan/blob/main/src/renderer/src/App.tsx"
click node_store "https://github.com/jeremysnr/cutawan/blob/main/src/renderer/src/store.ts"
click node_setup "https://github.com/jeremysnr/cutawan/blob/main/src/renderer/src/components/SettingsModal.tsx"
click node_preload "https://github.com/jeremysnr/cutawan/blob/main/src/preload/index.ts"
click node_main "https://github.com/jeremysnr/cutawan/blob/main/src/main/index.ts"
click node_ipc "https://github.com/jeremysnr/cutawan/blob/main/src/main/ipc.ts"
click node_projects "https://github.com/jeremysnr/cutawan/blob/main/src/main/projects.ts"
click node_source "https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/sourceDiscovery.ts"
click node_mediaaccess "https://github.com/jeremysnr/cutawan/blob/main/src/main/mediaAccess.ts"
click node_transcribe "https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/transcribe.ts"
click node_discover "https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/highlights.ts"
click node_visual "https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/visualCandidates.ts"
click node_editorial "https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/editorialReview.ts"
click node_whole "https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/wholeVideo.ts"
click node_reframe "https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/reframe.ts"
click node_editor "https://github.com/jeremysnr/cutawan/blob/main/src/renderer/src/components/EditorScreen.tsx"
click node_preview "https://github.com/jeremysnr/cutawan/blob/main/src/renderer/src/components/PreviewPlayer.tsx"
click node_render "https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/render.ts"
click node_captions "https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/captions.ts"
click node_ffmpeg "https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/ffmpeg.ts"
click node_provider "https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/openai.ts"
click node_openrouter "https://github.com/jeremysnr/cutawan/blob/main/src/main/openrouter.ts"
click node_inference "https://github.com/jeremysnr/cutawan/blob/main/src/main/inference/client.ts"
click node_whisper "https://github.com/jeremysnr/cutawan/blob/main/src/main/localWhisper.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_store,node_setup,node_preload,node_main,node_ipc,node_projects toneBlue
class node_source,node_mediaaccess toneAmber
class node_transcribe,node_discover,node_visual,node_editorial,node_whole,node_external toneMint
class node_reframe,node_editor,node_preview,node_render,node_captions,node_ffmpeg toneRose
class node_provider,node_openrouter,node_inference,node_whisper,node_creator toneIndigo
```

## Components

### Desktop app

- [App screens](https://github.com/jeremysnr/cutawan/blob/main/src/renderer/src/App.tsx): `src/renderer/src/App.tsx`
- [Project state](https://github.com/jeremysnr/cutawan/blob/main/src/renderer/src/store.ts): `src/renderer/src/store.ts`
- [Setup and settings](https://github.com/jeremysnr/cutawan/blob/main/src/renderer/src/components/SettingsModal.tsx): `src/renderer/src/components/SettingsModal.tsx`
- [Preload bridge](https://github.com/jeremysnr/cutawan/blob/main/src/preload/index.ts): `src/preload/index.ts`
- [Main process](https://github.com/jeremysnr/cutawan/blob/main/src/main/index.ts): `src/main/index.ts`
- [IPC handlers](https://github.com/jeremysnr/cutawan/blob/main/src/main/ipc.ts): `src/main/ipc.ts`
- [Project persistence](https://github.com/jeremysnr/cutawan/blob/main/src/main/projects.ts): `src/main/projects.ts`

### Media intake

- [Source import](https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/sourceDiscovery.ts): `src/main/pipeline/sourceDiscovery.ts`
- [Media access](https://github.com/jeremysnr/cutawan/blob/main/src/main/mediaAccess.ts): `src/main/mediaAccess.ts`

### AI analysis

- [Transcription](https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/transcribe.ts): `src/main/pipeline/transcribe.ts`
- [Clip discovery](https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/highlights.ts): `src/main/pipeline/highlights.ts`
- [Visual discovery](https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/visualCandidates.ts): `src/main/pipeline/visualCandidates.ts`
- [Editorial review](https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/editorialReview.ts): `src/main/pipeline/editorialReview.ts`
- [Whole-video mode](https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/wholeVideo.ts): `src/main/pipeline/wholeVideo.ts`

### Editing and export

- [Speaker reframing](https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/reframe.ts): `src/main/pipeline/reframe.ts`
- [Clip editor](https://github.com/jeremysnr/cutawan/blob/main/src/renderer/src/components/EditorScreen.tsx): `src/renderer/src/components/EditorScreen.tsx`
- [Video preview](https://github.com/jeremysnr/cutawan/blob/main/src/renderer/src/components/PreviewPlayer.tsx): `src/renderer/src/components/PreviewPlayer.tsx`
- [Render and export](https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/render.ts): `src/main/pipeline/render.ts`
- [Caption generation](https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/captions.ts): `src/main/pipeline/captions.ts`
- [Media processing](https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/ffmpeg.ts): `src/main/pipeline/ffmpeg.ts`

### AI and local services

- [AI providers](https://github.com/jeremysnr/cutawan/blob/main/src/main/pipeline/openai.ts): `src/main/pipeline/openai.ts`
- [OpenRouter setup](https://github.com/jeremysnr/cutawan/blob/main/src/main/openrouter.ts): `src/main/openrouter.ts`
- [Local inference](https://github.com/jeremysnr/cutawan/blob/main/src/main/inference/client.ts): `src/main/inference/client.ts`
- [Local Whisper](https://github.com/jeremysnr/cutawan/blob/main/src/main/localWhisper.ts): `src/main/localWhisper.ts`

### Other components

- **Creator**
- **AI API**

## Connections

- Creator → App screens: uses
- App screens → Project state: reads state (evidence: `src/renderer/src/App.tsx`)
- Creator → Project state: imports video
- Project state → Preload bridge: invokes actions
- Preload bridge → IPC handlers: bridges requests
- Main process → IPC handlers: registers handlers (evidence: `src/main/index.ts`)
- IPC handlers → Project persistence: manages projects (evidence: `src/main/ipc.ts`)
- IPC handlers → Source import: imports source
- IPC handlers → Transcription: runs pipeline
- IPC handlers → Clip discovery: runs pipeline
- IPC handlers → Visual discovery: runs discovery
- IPC handlers → Editorial review: reviews clips
- IPC handlers → Whole-video mode: runs mode (evidence: `src/main/ipc.ts`)
- Creator → Setup and settings: chooses AI mode
- Setup and settings → OpenRouter setup: configures provider
- OpenRouter setup → AI API: lists models (evidence: `src/main/openrouter.ts`)
- AI providers → AI API: requests analysis
- Transcription → Local Whisper: supports local speech
- Transcription → AI providers: uses AI transcription
- Local inference → AI API: runs local models
- Clip discovery → Editorial review: ranks moments
- Editorial review → Visual discovery: extracts frame evidence (evidence: `src/main/pipeline/editorialReview.ts`)
- Creator → Clip editor: edits results
- Clip editor → Video preview: previews framing (evidence: `src/renderer/src/components/PreviewPlayer.tsx`)
- Clip editor → Speaker reframing: adjusts framing
- Whole-video mode → Clip editor: opens whole-video edit
- Clip editor → Render and export: exports edit
- Render and export → Caption generation: builds captions (evidence: `src/main/pipeline/render.ts`)
- Render and export → Media processing: encodes video (evidence: `src/main/pipeline/render.ts`)
- Creator → Project persistence: reopens project
