# x007xyz/fly-cut architecture

> Architecture diagram of the GitHub repository x007xyz/fly-cut, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/x007xyz/fly-cut
- Repository: https://github.com/x007xyz/fly-cut

## Overview

##### Project Type and Purpose
- This is a web-based video/audio editing tool implemented with Vue3 and leveraging the WebCodecs API.
- The README emphasizes editing capabilities (inspired by prior projects like WebAV and CcClip) with a focus on browser-based media processing (audio, video, image, and text tracks).
- Its use case centers on processing, editing, and previewing multimedia content directly in the browser.

##### File Structure
- Top-Level Files:
– Dockerfile, nginx.conf, and configuration files (like .eslintrc.* and tsconfig files) indicate that the project is built for a production-ready web application with containerization and deployment in mind.
– package.json and pnpm-lock.yaml indicate package and dependency management.
- Directories of Interest:
– src: Contains the bulk of the application logic.
▪ App.vue: Main Vue component.
▪ class: Defines track classes (AudioTrack, VideoTrack, etc.), encapsulating core logical units for different media types.
▪ data: Contains constant definitions, option templates, and error codes, which hints at configurable, parameterized aspects.
▪ hooks: Custom Vue hooks for scroll and sound functionalities that suggest interactive user interface elements.
▪ pages: Contains routing (Editor and Preview) – indicating distinct views for media editing and previewing the final outcome.
▪ utils: Contains helper methods including file handling, canvas utilities, and track utility functions.
– vite.config.ts and tailwind.config.js: Show use of modern tooling (Vite) and Tailwind CSS for styling.
- Additional directories like .github, viteUtil, and script provide scripts for building and deployment and CI/CD templates.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Entry & Build Setup
    subgraph "Entry & Build Setup"
        B1["index.html"]:::build
        B2["Dockerfile"]:::build
        B3["nginx.conf"]:::build
        B4["build.sh (script)"]:::build
        B5["devlop.sh (script)"]:::build
        B6["vite.config.ts"]:::build
        B7["tailwind.config.js"]:::build
    end

    %% Frontend/UI Layer
    subgraph "Frontend/UI Layer"
        F1["App.vue"]:::ui
        subgraph "Pages"
            F2["Editor Page"]:::ui
            F3["Preview Page"]:::ui
        end
        subgraph "Routers"
            F4["Editor Router"]:::ui
            F5["Preview Router"]:::ui
        end
        subgraph "UI Components"
            %% Panel Components
            U1["AudioPanel"]:::ui
            U2["ImagePanel"]:::ui
            U3["TextPanel"]:::ui
            U4["VideoPanel"]:::ui
            U5["LocalPanel"]:::ui
            %% Container Components
            U6["AttributeContainer"]:::ui
            U7["CanvasPlayer"]:::ui
            U8["HeaderContainer"]:::ui
            U9["ResourcesContainer"]:::ui
            U10["TrackContainer"]:::ui
            %% Item & Player Components
            U11["TrackList"]:::ui
            U12["Player"]:::ui
            U13["PlayerControl"]:::ui
            U14["PlayerMoveable"]:::ui
            U15["TrackItem"]:::ui
        end
    end

    %% Business & Domain Logic
    subgraph "Business & Domain Logic"
        D1["Base (Track)"]:::domain
        D2["AudioTrack"]:::domain
        D3["VideoTrack"]:::domain
        D4["ImageTrack"]:::domain
        D5["TextTrack"]:::domain
        D6["Track"]:::domain
    end

    %% Data & Configuration
    subgraph "Data & Configuration"
        DC1["Constants, Menus & Errors"]:::data
        DC2["TrackConfig"]:::data
    end

    %% Utility Modules & Helpers
    subgraph "Utility Modules & Helpers"
        Utl1["Common Utils"]:::utils
        Utl2["File Utils"]:::utils
        Utl3["FormItem Utils"]:::utils
        Utl4["Store Utils"]:::utils
        Utl5["Canvas Utils"]:::utils
        Utl6["Track Utils"]:::utils
        Utl7["WebCodecs Utils"]:::utils
    end

    %% Hooks & Plugins
    subgraph "Hooks & Plugins"
        H1["useScrollPage"]:::hooks
        H2["useSound"]:::hooks
        H3["Install Icons"]:::hooks
        H4["Install Router"]:::hooks
    end

    %% State Management
    subgraph "State Management"
        S1["Page State"]:::state
        S2["Player State"]:::state
        S3["Resource Store"]:::state
        S4["Track Attribute"]:::state
        S5["Track State"]:::state
    end

    %% Relationships
    %% Entry & Build Setup to Frontend/UI
    B1 -->|"loads"| F1
    B6 -->|"configures"| F1
    B7 -->|"styles via"| F1

    %% Frontend/UI internal navigation
    F1 --> F2
    F1 --> F3
    F2 --> F4
    F3 --> F5

    %% UI Components interactions with State Management
    U8 -->|"updates"| S1
    U7 -->|"controls"| S2
    U10 -->|"manages"| S5
    U11 -->|"triggers"| D6
    U1 & U2 & U3 & U4 & U5 -->|"provide data to"| S3

    %% Domain Logic interaction with Utilities
    D6 -->|"processes via"| Utl7

    %% Hooks influence UI Components
    H1 -.-> U8
    H2 -.-> U7

    %% UI Components invoke common utilities
    U11 -->|"utilizes"| Utl5
    U12 -->|"utilizes"| Utl4

    %% Plugins setup routing and icons for UI
    H3 --> F1
    H4 --> F1

    %% Data & Configuration used by Domain and UI
    DC1 --> D6
    DC2 --> D6

    %% Build & Deployment supportive connection (internal)
    B2 --> B3

    %% Click Events for Entry & Build Setup
    click B1 "https://github.com/x007xyz/fly-cut/blob/main/index.html"
    click B2 "https://github.com/x007xyz/fly-cut/tree/main/Dockerfile"
    click B3 "https://github.com/x007xyz/fly-cut/blob/main/nginx.conf"
    click B4 "https://github.com/x007xyz/fly-cut/blob/main/script/build.sh"
    click B5 "https://github.com/x007xyz/fly-cut/blob/main/script/devlop.sh"
    click B6 "https://github.com/x007xyz/fly-cut/blob/main/vite.config.ts"
    click B7 "https://github.com/x007xyz/fly-cut/blob/main/tailwind.config.js"

    %% Click Events for Frontend/UI Layer
    click F1 "https://github.com/x007xyz/fly-cut/blob/main/src/App.vue"
    click F2 "https://github.com/x007xyz/fly-cut/blob/main/src/pages/views/Editor.vue"
    click F3 "https://github.com/x007xyz/fly-cut/blob/main/src/pages/views/Preview.vue"
    click F4 "https://github.com/x007xyz/fly-cut/blob/main/src/pages/routers/Editor.ts"
    click F5 "https://github.com/x007xyz/fly-cut/blob/main/src/pages/routers/Preview.ts"

    %% Click Events for UI Components
    click U1 "https://github.com/x007xyz/fly-cut/blob/main/src/components/AudioPanel/index.vue"
    click U2 "https://github.com/x007xyz/fly-cut/blob/main/src/components/ImagePanel/index.vue"
    click U3 "https://github.com/x007xyz/fly-cut/blob/main/src/components/TextPanel/index.vue"
    click U4 "https://github.com/x007xyz/fly-cut/blob/main/src/components/VideoPanel/index.vue"
    click U5 "https://github.com/x007xyz/fly-cut/blob/main/src/components/LocalPanel/index.vue"
    click U6 "https://github.com/x007xyz/fly-cut/blob/main/src/components/container/AttributeContainer.vue"
    click U7 "https://github.com/x007xyz/fly-cut/blob/main/src/components/container/CanvasPlayer.vue"
    click U8 "https://github.com/x007xyz/fly-cut/blob/main/src/components/container/HeaderContainer.vue"
    click U9 "https://github.com/x007xyz/fly-cut/blob/main/src/components/container/ResourcesContainer.vue"
    click U10 "https://github.com/x007xyz/fly-cut/blob/main/src/components/container/TrackContainer.vue"
    click U11 "https://github.com/x007xyz/fly-cut/blob/main/src/components/TrackList.vue"
    click U12 "https://github.com/x007xyz/fly-cut/blob/main/src/components/item/player/Player.vue"
    click U13 "https://github.com/x007xyz/fly-cut/blob/main/src/components/item/player/PlayerControl.vue"
    click U14 "https://github.com/x007xyz/fly-cut/blob/main/src/components/item/player/PlayerMoveable.vue"
    click U15 "https://github.com/x007xyz/fly-cut/blob/main/src/components/item/trackItem/TrackItem.vue"

    %% Click Events for Business & Domain Logic
    click D1 "https://github.com/x007xyz/fly-cut/blob/main/src/class/Base.ts"
    click D2 "https://github.com/x007xyz/fly-cut/blob/main/src/class/AudioTrack.ts"
    click D3 "https://github.com/x007xyz/fly-cut/blob/main/src/class/VideoTrack.ts"
    click D4 "https://github.com/x007xyz/fly-cut/blob/main/src/class/ImageTrack.ts"
    click D5 "https://github.com/x007xyz/fly-cut/blob/main/src/class/TextTrack.ts"
    click D6 "https://github.com/x007xyz/fly-cut/blob/main/src/class/Track.ts"

    %% Click Events for Data & Configuration
    click DC2 "https://github.com/x007xyz/fly-cut/blob/main/src/data/trackConfig.ts"

    %% Click Events for Utility Modules & Helpers
    click Utl1 "https://github.com/x007xyz/fly-cut/blob/main/src/utils/common.ts"
    click Utl2 "https://github.com/x007xyz/fly-cut/blob/main/src/utils/file.ts"
    click Utl3 "https://github.com/x007xyz/fly-cut/blob/main/src/utils/formItemUtils.ts"
    click Utl4 "https://github.com/x007xyz/fly-cut/blob/main/src/utils/storeUtil.ts"
    click Utl5 "https://github.com/x007xyz/fly-cut/blob/main/src/utils/canvasUtil.ts"
    click Utl6 "https://github.com/x007xyz/fly-cut/blob/main/src/utils/trackUtils.ts"
    click Utl7 "https://github.com/x007xyz/fly-cut/blob/main/src/utils/webcodecs.ts"

    %% Click Events for Hooks & Plugins
    click H1 "https://github.com/x007xyz/fly-cut/blob/main/src/hooks/useScrollPage.ts"
    click H2 "https://github.com/x007xyz/fly-cut/blob/main/src/hooks/useSound.ts"
    click H3 "https://github.com/x007xyz/fly-cut/blob/main/src/plugins/installIcon.ts"
    click H4 "https://github.com/x007xyz/fly-cut/blob/main/src/plugins/installRouter.ts"

    %% Click Events for State Management
    click S1 "https://github.com/x007xyz/fly-cut/blob/main/src/stores/pageState.ts"
    click S2 "https://github.com/x007xyz/fly-cut/blob/main/src/stores/playerState.ts"
    click S3 "https://github.com/x007xyz/fly-cut/blob/main/src/stores/resourceStore.ts"
    click S4 "https://github.com/x007xyz/fly-cut/blob/main/src/stores/trackAttribute.ts"
    click S5 "https://github.com/x007xyz/fly-cut/blob/main/src/stores/trackState.ts"

    %% Styles
    classDef build fill:#ff9f1c,stroke:#000,stroke-width:1px,color:#000;
    classDef ui fill:#5dade2,stroke:#000,stroke-width:1px,color:#000;
    classDef domain fill:#90be6d,stroke:#000,stroke-width:1px,color:#000;
    classDef data fill:#f984ef,stroke:#000,stroke-width:1px,color:#000;
    classDef utils fill:#f9c74f,stroke:#000,stroke-width:1px,color:#000;
    classDef hooks fill:#f9844a,stroke:#000,stroke-width:1px,color:#000;
    classDef state fill:#9b51e0,stroke:#000,stroke-width:1px,color:#000;
```
