# habuskid/recordly architecture

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

- Interactive diagram: https://gitdiagram.com/habuskid/recordly
- Repository: https://github.com/habuskid/recordly

## Overview

#### Purpose and Runtime
Recordly is an AGPL desktop screen-recording and video-editing application for macOS, Windows, and Linux. It combines capture, non-linear editing, motion/cursor composition, project persistence, and MP4/GIF export in an Electron application. The renderer is a React/Vite UI; the Electron main process owns OS integration, files, native helpers, and IPC.

Entry points: `electron/main.ts`, `electron/preload.ts`, `src/main.tsx`, and `src/App.tsx`.

#### Process and IPC Boundary
Electron main initializes windows, media serving, updater behavior, and IPC handlers. The preload layer exposes approved native capabilities to the renderer; renderer code should not directly invoke filesystem, capture binaries, or OS APIs. IPC registration is organized by domain, with shared state/types beneath it.

Paths: `electron/main.ts`, `electron/preload.ts`, `electron/ipc/handlers.ts`.

#### Recording and Platform Capture
The launch/HUD UI selects capture sources and audio options, then invokes recording IPC. Main-process recording coordinates FFmpeg and platform-specific capture behavior. macOS uses ScreenCaptureKit Swift helpers; supported Windows uses native WGC/WASAPI helpers with Electron fallbacks; Linux relies on Electron capture. Cursor monitoring/hiding is separate so the editor can render a polished cursor overlay.

Paths: `src/components/launch/LaunchWindow.tsx`, `electron/ipc/register/recording.ts`, `electron/ipc/recording/ffmpeg.ts`.

#### Project Lifecycle
A completed or imported recording becomes a project containing source-media references plus editor state. The project manager/session IPC layer persists and reopens `.recordly` projects, bridging renderer edits to local files. This is the durable boundary between capture and later editing/export.

Paths: `electron/ipc/project/manager.ts`, `electron/ipc/project/session.ts`, `src/components/video-editor/projectPersistence.ts`.

#### Editor and Timeline Model
`VideoEditor` is the renderer’s primary editing composition. Its timeline represents temporal regions for trims, zooms, speed changes, captions, annotations, and added audio. Playback applies cursor, webcam, crop, motion, and layout state to preview; PixiJS is the stated scene-composition runtime. Editor history/preferences and project-dirty behavior support interactive mutation and persistence.

Paths: `src/components/video-editor/VideoEditor.tsx`, `src/components/video-editor/timeline/model/timelineModel.ts`, `src/components/video-editor/videoPlayback/cursorRenderer.ts`.

#### Captions, Extensions, and Media Processing
Caption generation/parsing/segmentation runs behind Electron IPC and uses bundled Whisper tooling where available. Extensions are loaded and managed in the Electron process, while renderer extension-host/render-hook code integrates their UI and scene behavior. The marketplace is an external service at `marketplace.recordly.dev`.

Paths: `electron/ipc/captions/whisper.ts`, `electron/extensions/extensionLoader.ts`, `src/lib/extensions/extensionHost.ts`.

#### Export Pipeline
Renderer export logic derives an output plan from editor state and renders the same visual concepts used for preview: backgrounds, annotations, captions, webcam, cursor, and audio routing. It selects browser/renderer or native paths, then delegates file production to Electron IPC. Main process uses FFmpeg and can route supported Windows static-layout exports through GPU/CUDA-native executables. Outputs are MP4 or GIF and are written/revealed through native APIs.

Paths: `src/lib/exporter/modernVideoExporter.ts`, `electron/ipc/register/export.ts`, `electron/ipc/export/native-video.ts`.

#### Native Delivery Infrastructure
Packaged Electron builds include platform entitlements and native binaries. Native components are Swift on macOS and C++/CUDA/CMake on Windows; bundled executables include capture, cursor monitoring, GPU composition, and Whisper. GitHub Actions build/release workflows and `electron-builder.json5` produce distributable artifacts, including Homebrew and Winget release flows.

Paths: `electron/native/ScreenCaptureKitRecorder.swift`, `electron/native/wgc-capture/src/main.cpp`, `electron-builder.json5`.

Main entry points: [`src/components/video-editor/VideoEditor.tsx`](https://github.com/habuskid/recordly/blob/main/src/components/video-editor/VideoEditor.tsx) (Video editor), [`electron/ipc/handlers.ts`](https://github.com/habuskid/recordly/blob/main/electron/ipc/handlers.ts) (IPC handlers), [`electron/ipc/register/recording.ts`](https://github.com/habuskid/recordly/blob/main/electron/ipc/register/recording.ts) (Recording IPC), [`src/App.tsx`](https://github.com/habuskid/recordly/blob/main/src/App.tsx) (Application shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_renderer["Renderer UI"]
  node_renderer_entry["Renderer entry<br/>React bootstrap<br/>[main.tsx]"]
  node_app["Application shell<br/>React app<br/>[App.tsx]"]
  node_launch["Launch and HUD<br/>capture UI<br/>[LaunchWindow.tsx]"]
end

subgraph group_electron["Electron Main"]
  node_preload{{"Preload bridge<br/>capability bridge<br/>[preload.ts]"}}
  node_main["Electron main<br/>process entry<br/>[main.ts]"]
  node_ipc_handlers["IPC handlers<br/>IPC registry<br/>[handlers.ts]"]
end

subgraph group_capture["Capture"]
  node_recording_ipc["Recording IPC<br/>capture service<br/>[recording.ts]"]
  node_ffmpeg_capture["FFmpeg capture<br/>recording engine<br/>[ffmpeg.ts]"]
end

subgraph group_project["Project and Editing"]
  node_project_manager[("Project manager<br/>project persistence<br/>[manager.ts]")]
  node_project_session["Project session IPC<br/>editing bridge<br/>[session.ts]"]
  node_project_persistence["Renderer persistence<br/>project client"]
  node_video_editor["Video editor<br/>editing composition<br/>[VideoEditor.tsx]"]
  node_timeline["Timeline model<br/>editing model<br/>[timelineModel.ts]"]
  node_cursor_renderer["Cursor renderer<br/>PixiJS scene layer<br/>[cursorRenderer.ts]"]
end

subgraph group_export["Export and Extensions"]
  node_exporter["Export planner<br/>renderer exporter"]
  node_export_ipc["Export IPC<br/>output service<br/>[export.ts]"]
  node_native_export["Native video export<br/>FFmpeg output engine<br/>[native-video.ts]"]
  node_whisper["Whisper captions<br/>caption service<br/>[whisper.ts]"]
  node_extension_loader["Extension loader<br/>main extension runtime<br/>[extensionLoader.ts]"]
  node_extension_host["Extension host<br/>renderer extension runtime<br/>[extensionHost.ts]"]
end

subgraph group_native["Native Delivery"]
  node_native_capture{{"Platform capture helpers<br/>Swift and C++ native"}}
  node_builder["Desktop packaging<br/>electron-builder config"]
end

node_renderer_entry -->|"mounts"| node_app
node_app -->|"shows"| node_launch
node_app -->|"hosts"| node_video_editor
node_renderer_entry -.->|"uses approved APIs"| node_preload
node_preload -->|"invokes"| node_ipc_handlers
node_main -->|"registers"| node_ipc_handlers
node_ipc_handlers -->|"routes recording"| node_recording_ipc
node_ipc_handlers -->|"routes projects"| node_project_session
node_ipc_handlers -->|"routes export"| node_export_ipc
node_launch -->|"starts capture"| node_recording_ipc
node_recording_ipc -->|"coordinates"| node_ffmpeg_capture
node_ffmpeg_capture -->|"uses when supported"| node_native_capture
node_recording_ipc -->|"creates source project"| node_project_manager
node_project_persistence -->|"saves and reopens"| node_project_session
node_project_session -->|"persists"| node_project_manager
node_video_editor -->|"edits"| node_timeline
node_video_editor -->|"composes preview"| node_cursor_renderer
node_video_editor -->|"persists changes"| node_project_persistence
node_video_editor -->|"supplies editor state"| node_exporter
node_exporter -->|"delegates output"| node_export_ipc
node_export_ipc -->|"produces files"| node_native_export
node_whisper -.->|"provides captions"| node_timeline
node_extension_loader -->|"loads extensions for"| node_extension_host
node_extension_host -.->|"adds UI and scene hooks"| node_video_editor
node_builder -->|"packages"| node_native_capture
node_builder -->|"packages binaries"| node_native_export

click node_renderer_entry "https://github.com/habuskid/recordly/blob/main/src/main.tsx"
click node_app "https://github.com/habuskid/recordly/blob/main/src/App.tsx"
click node_launch "https://github.com/habuskid/recordly/blob/main/src/components/launch/LaunchWindow.tsx"
click node_preload "https://github.com/habuskid/recordly/blob/main/electron/preload.ts"
click node_main "https://github.com/habuskid/recordly/blob/main/electron/main.ts"
click node_ipc_handlers "https://github.com/habuskid/recordly/blob/main/electron/ipc/handlers.ts"
click node_recording_ipc "https://github.com/habuskid/recordly/blob/main/electron/ipc/register/recording.ts"
click node_ffmpeg_capture "https://github.com/habuskid/recordly/blob/main/electron/ipc/recording/ffmpeg.ts"
click node_native_capture "https://github.com/habuskid/recordly/blob/main/electron/native/ScreenCaptureKitRecorder.swift"
click node_project_manager "https://github.com/habuskid/recordly/blob/main/electron/ipc/project/manager.ts"
click node_project_session "https://github.com/habuskid/recordly/blob/main/electron/ipc/project/session.ts"
click node_project_persistence "https://github.com/habuskid/recordly/blob/main/src/components/video-editor/projectPersistence.ts"
click node_video_editor "https://github.com/habuskid/recordly/blob/main/src/components/video-editor/VideoEditor.tsx"
click node_timeline "https://github.com/habuskid/recordly/blob/main/src/components/video-editor/timeline/model/timelineModel.ts"
click node_cursor_renderer "https://github.com/habuskid/recordly/blob/main/src/components/video-editor/videoPlayback/cursorRenderer.ts"
click node_exporter "https://github.com/habuskid/recordly/blob/main/src/lib/exporter/modernVideoExporter.ts"
click node_export_ipc "https://github.com/habuskid/recordly/blob/main/electron/ipc/register/export.ts"
click node_native_export "https://github.com/habuskid/recordly/blob/main/electron/ipc/export/native-video.ts"
click node_whisper "https://github.com/habuskid/recordly/blob/main/electron/ipc/captions/whisper.ts"
click node_extension_loader "https://github.com/habuskid/recordly/blob/main/electron/extensions/extensionLoader.ts"
click node_extension_host "https://github.com/habuskid/recordly/blob/main/src/lib/extensions/extensionHost.ts"
click node_builder "https://github.com/habuskid/recordly/blob/main/electron-builder.json5"

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_renderer_entry,node_app,node_launch toneBlue
class node_preload,node_main,node_ipc_handlers toneAmber
class node_recording_ipc,node_ffmpeg_capture toneMint
class node_project_manager,node_project_session,node_project_persistence,node_video_editor,node_timeline,node_cursor_renderer toneRose
class node_exporter,node_export_ipc,node_native_export,node_whisper,node_extension_loader,node_extension_host toneIndigo
class node_native_capture,node_builder toneTeal
```

## Components

### Renderer UI

React/Vite application running in the Electron renderer.

- [Renderer entry](https://github.com/habuskid/recordly/blob/main/src/main.tsx): React bootstrap · `src/main.tsx`
- [Application shell](https://github.com/habuskid/recordly/blob/main/src/App.tsx): React app · `src/App.tsx`
- [Launch and HUD](https://github.com/habuskid/recordly/blob/main/src/components/launch/LaunchWindow.tsx): capture UI · Selects capture sources and audio options. · `src/components/launch/LaunchWindow.tsx`

### Electron Main

Privileged process that owns native integration and IPC.

- [Preload bridge](https://github.com/habuskid/recordly/blob/main/electron/preload.ts): capability bridge · Exposes approved IPC capabilities to renderer code. · `electron/preload.ts`
- [Electron main](https://github.com/habuskid/recordly/blob/main/electron/main.ts): process entry · Initializes windows, media serving, updater behavior, and IPC. · `electron/main.ts`
- [IPC handlers](https://github.com/habuskid/recordly/blob/main/electron/ipc/handlers.ts): IPC registry · Registers domain-specific main-process handlers. · `electron/ipc/handlers.ts`

### Capture

Recording orchestration and platform capture backends.

- [Recording IPC](https://github.com/habuskid/recordly/blob/main/electron/ipc/register/recording.ts): capture service · `electron/ipc/register/recording.ts`
- [FFmpeg capture](https://github.com/habuskid/recordly/blob/main/electron/ipc/recording/ffmpeg.ts): recording engine · Coordinates FFmpeg and platform capture behavior. · `electron/ipc/recording/ffmpeg.ts`

### Project and Editing

Durable project state and non-linear editor model.

- [Project manager](https://github.com/habuskid/recordly/blob/main/electron/ipc/project/manager.ts): project persistence · Persists and reopens .recordly projects and source-media references. · `electron/ipc/project/manager.ts`
- [Project session IPC](https://github.com/habuskid/recordly/blob/main/electron/ipc/project/session.ts): editing bridge · Bridges renderer edits to the durable project manager. · `electron/ipc/project/session.ts`
- [Renderer persistence](https://github.com/habuskid/recordly/blob/main/src/components/video-editor/projectPersistence.ts): project client · `src/components/video-editor/projectPersistence.ts`
- [Video editor](https://github.com/habuskid/recordly/blob/main/src/components/video-editor/VideoEditor.tsx): editing composition · Primary editor for preview, mutation, history, and dirty state. · `src/components/video-editor/VideoEditor.tsx`
- [Timeline model](https://github.com/habuskid/recordly/blob/main/src/components/video-editor/timeline/model/timelineModel.ts): editing model · Represents trims, zooms, speed, captions, annotations, and audio regions. · `src/components/video-editor/timeline/model/timelineModel.ts`
- [Cursor renderer](https://github.com/habuskid/recordly/blob/main/src/components/video-editor/videoPlayback/cursorRenderer.ts): PixiJS scene layer · Composes polished cursor playback overlays. · `src/components/video-editor/videoPlayback/cursorRenderer.ts`

### Export and Extensions

Media output, captions, and extension integration.

- [Export planner](https://github.com/habuskid/recordly/blob/main/src/lib/exporter/modernVideoExporter.ts): renderer exporter · Derives an output plan from editor state and visual layers. · `src/lib/exporter/modernVideoExporter.ts`
- [Export IPC](https://github.com/habuskid/recordly/blob/main/electron/ipc/register/export.ts): output service · `electron/ipc/register/export.ts`
- [Native video export](https://github.com/habuskid/recordly/blob/main/electron/ipc/export/native-video.ts): FFmpeg output engine · Produces MP4/GIF and routes supported Windows layouts to native GPU paths. · `electron/ipc/export/native-video.ts`
- [Whisper captions](https://github.com/habuskid/recordly/blob/main/electron/ipc/captions/whisper.ts): caption service · Generates, parses, and segments captions through IPC. · `electron/ipc/captions/whisper.ts`
- [Extension loader](https://github.com/habuskid/recordly/blob/main/electron/extensions/extensionLoader.ts): main extension runtime · Loads and manages extensions in Electron. · `electron/extensions/extensionLoader.ts`
- [Extension host](https://github.com/habuskid/recordly/blob/main/src/lib/extensions/extensionHost.ts): renderer extension runtime · Integrates extension UI and scene hooks. · `src/lib/extensions/extensionHost.ts`

### Native Delivery

Platform helpers packaged with desktop builds.

- [Platform capture helpers](https://github.com/habuskid/recordly/blob/main/electron/native/ScreenCaptureKitRecorder.swift): Swift and C++ native · ScreenCaptureKit on macOS and WGC/WASAPI on Windows. · `electron/native/ScreenCaptureKitRecorder.swift`
- [Desktop packaging](https://github.com/habuskid/recordly/blob/main/electron-builder.json5): electron-builder config · Packages entitlements and native binaries into distributable builds. · `electron-builder.json5`

## Connections

- Renderer entry → Application shell: mounts
- Application shell → Launch and HUD: shows
- Application shell → Video editor: hosts
- Renderer entry → Preload bridge: uses approved APIs
- Preload bridge → IPC handlers: invokes
- Electron main → IPC handlers: registers
- IPC handlers → Recording IPC: routes recording
- IPC handlers → Project session IPC: routes projects
- IPC handlers → Export IPC: routes export
- Launch and HUD → Recording IPC: starts capture
- Recording IPC → FFmpeg capture: coordinates
- FFmpeg capture → Platform capture helpers: uses when supported
- Recording IPC → Project manager: creates source project
- Renderer persistence → Project session IPC: saves and reopens
- Project session IPC → Project manager: persists
- Video editor → Timeline model: edits
- Video editor → Cursor renderer: composes preview
- Video editor → Renderer persistence: persists changes
- Video editor → Export planner: supplies editor state
- Export planner → Export IPC: delegates output
- Export IPC → Native video export: produces files
- Whisper captions → Timeline model: provides captions
- Extension loader → Extension host: loads extensions for
- Extension host → Video editor: adds UI and scene hooks
- Desktop packaging → Platform capture helpers: packages
- Desktop packaging → Native video export: packages binaries
