# designcombo/react-video-editor architecture

> Architecture diagram of the GitHub repository designcombo/react-video-editor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/designcombo/react-video-editor
- Repository: https://github.com/designcombo/react-video-editor

## Overview

##### Project type and purpose
- This is a single-page React application written in TypeScript that implements an in-browser video editor.
- Key features: timeline editing, multi-track support, effects/transitions, real-time preview, export.

##### File structure
- Top-level:
- public/index.html + static images
- src/main.tsx + src/app.tsx → entry points
- src/features/editor → domain-specific editor modules (timeline, player, control-items, crop modal, etc.)
- config files: vite.config.ts, tailwind.config.js, tsconfig.json

##### README for additional insights
- Confirms client-only architecture (no backend).
- Highlights dependencies on React, Vite, Tailwind, TypeScript.
- Describes key editor flows: editing timeline, applying effects, preview, and export.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction
    User(("User")):::external
    User -->|"interacts via clicks/drags"| UI

    %% UI Layer
    subgraph "Browser UI Layer"
        UI["UI Layer"]:::ui
        Components["Components (src/components)"]:::ui
        UIComponents["UI Primitives (src/components/ui)"]:::ui
        ColorPicker["Color Picker (src/components/color-picker)"]:::ui
        Scene["Scene Components (src/features/editor/scene)"]:::ui
    end

    %% Entry Points
    subgraph "Entry Points"
        Main["main.tsx"]:::ui
        App["app.tsx"]:::ui
        IndexHTML["index.html (public/)"]:::ui
    end

    %% Editor Core
    subgraph "Editor Core" 
        subgraph "Timeline Manager" 
            TimelineFolder["src/features/editor/timeline"]:::core
            TimelineIndex["index.ts"]:::core
            TimelineUI["timeline.tsx"]:::core
            TimelineItems["items/"]:::core
            TimelineControls["controls/"]:::core
        end
        subgraph "Player Engine"
            PlayerFolder["src/features/editor/player"]:::core
            PlayerUI["player.tsx"]:::core
            Composition["composition.tsx"]:::core
            Animated["animated/"]:::core
            MediaBG["media-background.tsx"]:::core
        end
        subgraph "Control-Item Handlers"
            ControlFolder["src/features/editor/control-item"]:::core
            ControlItem["control-item.tsx"]:::core
            BasicItems["basic-*.tsx"]:::core
            TransformCommon["common/transform.tsx"]:::core
        end
        subgraph "Crop & Transform"
            CropModal["crop-modal.tsx"]:::core
            ElementCrop["element-crop.tsx"]:::core
            TransformModule["common/transform.tsx"]:::core
        end
    end

    %% State Management
    subgraph "State Management"
        StoreFolder["src/features/editor/store"]:::state
        UseStore["use-store.ts"]:::state
        DataState["use-data-state.ts"]:::state
        CropStore["use-crop-store.ts"]:::state
        LayoutStore["use-layout-store.ts"]:::state
        DownloadState["use-download-state.ts"]:::state
    end

    %% Utility Layer
    subgraph "Utility Layer"
        UtilsFolder["src/features/editor/utils"]:::util
        LibUtils["src/lib/utils.ts"]:::util
        DownloadUtil["src/utils/download.ts"]:::util
        UploadUtil["src/utils/upload.ts"]:::util
        BrowserAPIs["Browser File & HTML5 Video/Audio APIs"]:::util
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        ViteConfig["vite.config.ts"]:::build
        TailwindConfig["tailwind.config.js"]:::build
        PostCSS["postcss.config.js"]:::build
        TSConfig["tsconfig.json"]:::build
        StaticHost["GitHub Pages / CDN (public/)"]:::build
    end

    %% Data Flows & Relationships
    UI -->|"dispatch control commands"| TimelineFolder
    UI -->|"dispatch control commands"| PlayerFolder
    UI -->|"dispatch control commands"| ControlFolder
    UI -->|"open crop modal"| CropModal

    TimelineFolder <-->|"read/write state"| UseStore
    PlayerFolder <-->|"read state"| DataState
    ControlFolder <-->|"update layout/crop"| LayoutStore
    CropModal -->|"write crop data"| CropStore

    TimelineFolder -->|"render frames"| PlayerFolder
    PlayerFolder -->|"update canvas/video DOM"| UI

    UI -->|"request export/download"| DownloadUtil
    DownloadUtil -->|"uses"| BrowserAPIs
    UploadUtil -->|"uses"| BrowserAPIs

    Build & Deployment -->|"serves bundle"| UI
    Main --> UI
    App --> UI
    IndexHTML --> UI

    ColorPicker -->|"used by"| UIComponents
    ColorPicker -->|"used by core modules"| TimelineFolder
    ColorPicker -->|"used by core modules"| ControlFolder

    %% Click Events
    click Components "https://github.com/designcombo/react-video-editor/tree/main/src/components"
    click UIComponents "https://github.com/designcombo/react-video-editor/tree/main/src/components/ui"
    click ColorPicker "https://github.com/designcombo/react-video-editor/tree/main/src/components/color-picker"
    click Scene "https://github.com/designcombo/react-video-editor/tree/main/src/features/editor/scene"
    click Main "https://github.com/designcombo/react-video-editor/blob/main/src/main.tsx"
    click App "https://github.com/designcombo/react-video-editor/blob/main/src/app.tsx"
    click IndexHTML "https://github.com/designcombo/react-video-editor/blob/main/public/index.html"
    click TimelineFolder "https://github.com/designcombo/react-video-editor/tree/main/src/features/editor/timeline"
    click TimelineIndex "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/timeline/index.ts"
    click TimelineUI "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/timeline/timeline.tsx"
    click TimelineItems "https://github.com/designcombo/react-video-editor/tree/main/src/features/editor/timeline/items"
    click TimelineControls "https://github.com/designcombo/react-video-editor/tree/main/src/features/editor/timeline/controls"
    click PlayerFolder "https://github.com/designcombo/react-video-editor/tree/main/src/features/editor/player"
    click PlayerUI "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/player/player.tsx"
    click Composition "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/player/composition.tsx"
    click Animated "https://github.com/designcombo/react-video-editor/tree/main/src/features/editor/player/animated"
    click MediaBG "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/player/media-background.tsx"
    click ControlFolder "https://github.com/designcombo/react-video-editor/tree/main/src/features/editor/control-item"
    click ControlItem "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/control-item/control-item.tsx"
    click BasicItems "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/control-item/basic-*.tsx"
    click TransformCommon "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/control-item/common/transform.tsx"
    click CropModal "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/crop-modal/crop-modal.tsx"
    click ElementCrop "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/crop-modal/element-crop.tsx"
    click StoreFolder "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/store/use-store.ts"
    click UseStore "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/store/use-store.ts"
    click DataState "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/store/use-data-state.ts"
    click CropStore "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/store/use-crop-store.ts"
    click LayoutStore "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/store/use-layout-store.ts"
    click DownloadState "https://github.com/designcombo/react-video-editor/blob/main/src/features/editor/store/use-download-state.ts"
    click UtilsFolder "https://github.com/designcombo/react-video-editor/tree/main/src/features/editor/utils"
    click LibUtils "https://github.com/designcombo/react-video-editor/blob/main/src/lib/utils.ts"
    click DownloadUtil "https://github.com/designcombo/react-video-editor/blob/main/src/utils/download.ts"
    click UploadUtil "https://github.com/designcombo/react-video-editor/blob/main/src/utils/upload.ts"
    click ViteConfig "https://github.com/designcombo/react-video-editor/blob/main/vite.config.ts"
    click TailwindConfig "https://github.com/designcombo/react-video-editor/blob/main/tailwind.config.js"
    click PostCSS "https://github.com/designcombo/react-video-editor/blob/main/postcss.config.js"
    click TSConfig "https://github.com/designcombo/react-video-editor/blob/main/tsconfig.json"
    click StaticHost "https://github.com/designcombo/react-video-editor/tree/main/public/"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef core fill:#90EE90,stroke:#333,stroke-width:1px
    classDef state fill:#FFFF99,stroke:#333,stroke-width:1px
    classDef util fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef build fill:#E6E6FA,stroke:#333,stroke-width:1px
    classDef external fill:#fff,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
```
