# flanker-dev/flanker architecture

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

- Interactive diagram: https://gitdiagram.com/flanker-dev/flanker
- Repository: https://github.com/flanker-dev/flanker

## Overview

##### Main Architecture Components

The system should be represented as a desktop application with two primary layers:

a. Frontend Layer (React/TypeScript)
- Located in the `/src` directory
- Contains UI components, stores, and utilities
- Handles user interactions and state management

b. Backend Layer (Tauri/Rust)
- Located in the `/src-tauri` directory
- Manages system-level operations and file handling
- Provides native functionality

##### Key Components

Frontend Components:
- UI Layer
- Components (src/components/)
- AppSidebar
- BookmarkEditor
- FileManager
- Settings
- UI Elements
- Store (src/store/)
- State Management
- Utils (src/utils/)
- Helper Functions

Backend Modules:
- System Operations (src-tauri/src/modules/)
- File Management
- Media Handling
- System Information
- UI Controls
- Window Management

##### Component Relationships

a. User Interface Flow:
- How user interactions flow from UI components through the store
- How UI components communicate with Tauri backend

b. Data Flow:
- Bookmark data flow between frontend and backend
- File system operations
- Media handling operations

##### Specific Implementation Details

Technical elements:

a. Frontend:
- React Components hierarchy
- State management flow
- UI/UX interaction patterns

b. Backend:
- Tauri IPC bridges
- File system interactions
- System event handlers

##### Key Interactions to Highlight

- Bookmark CRUD operations
- File system interactions
- Window management operations
- Media handling (OGP images, Spotify info, etc.)
- System events and notifications

**[User Interface Layer]**
- ↕
**[React Components Layer]**
- ↕
**[State Management Store]**
- ↕
**[Tauri Bridge Layer]**
- ↕
**[Rust Backend Modules]**
- ↕
**[System Resources]**

##### The modular architecture allowing for easy extensions

Remember to maintain a balance between detail and clarity, focusing on the architectural decisions that make Flanker unique as a local bookmark manager.

This system design should help developers understand both the high-level architecture and the specific implementation details of Flanker's desktop application architecture.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "User Interface Layer"
        UI_COMP["UI Components"]:::frontend
        SIDEBAR["App Sidebar"]:::frontend
        BOOKMARK_ED["Bookmark Editor"]:::frontend
        FILE_MAN["File Manager"]:::frontend
        SETTINGS["Settings"]:::frontend
        UI_ELEMENTS["UI Elements"]:::frontend

        subgraph "Core Components"
            CORE_BTN["Buttons"]:::frontend
            CORE_INP["Inputs"]:::frontend
            CORE_MODAL["Modals"]:::frontend
            CORE_MENU["Menus"]:::frontend
        end

        subgraph "Layout Components"
            LAY_HEAD["Header"]:::frontend
            LAY_FOOT["Footer"]:::frontend
            LAY_GRID["Grid System"]:::frontend
        end

        subgraph "Feature Components"
            FEAT_SEARCH["Search Bar"]:::frontend
            FEAT_FILTER["Filters"]:::frontend
            FEAT_SORT["Sorting"]:::frontend
        end
    end

    subgraph "State Management Layer"
        STORE["Store"]:::store
        TYPES["Type Definitions"]:::types
    end

    subgraph "Frontend Utilities Layer"
        FILE_OPS["File Operations"]:::utils
        CONFIG_OPS["Configuration Operations"]:::utils
    end

    subgraph "Tauri Bridge Layer"
        IPC["IPC Bridge"]:::bridge
    end

    subgraph "Backend Modules Layer"
        FILE_MGT["File Management"]:::backend
        subgraph "File Management Details"
            FILE_READ["File Reader"]:::backend
            FILE_WRITE["File Writer"]:::backend
            FILE_WATCH["File Watcher"]:::backend
            FILE_CACHE["Cache Manager"]:::backend
        end
        
        MEDIA_HDL["Media Handling"]:::backend
        subgraph "Media Handling Details"
            MEDIA_FETCH["Media Fetcher"]:::backend
            MEDIA_PARSE["Media Parser"]:::backend
            MEDIA_CACHE["Media Cache"]:::backend
            MEDIA_VALID["Media Validator"]:::backend
        end
        
        SYS_OPS["System Operations"]:::backend
        subgraph "System Operations Details"
            SYS_ENV["Environment Manager"]:::backend
            SYS_PERM["Permissions Handler"]:::backend
            SYS_LOG["System Logger"]:::backend
            SYS_CONF["Config Manager"]:::backend
        end
        
        UI_CTRL["UI Controls"]:::backend
        subgraph "UI Controls Details"
            UI_WIN["Window Manager"]:::backend
            UI_NOTIFY["Notification System"]:::backend
            UI_THEME["Theme Manager"]:::backend
            UI_EVENT["Event Handler"]:::backend
        end
    end

    subgraph "System Resources Layer"
        FS["File System"]:::system
        WIN["Window System"]:::system
        NET["Network"]:::system
    end

    UI_COMP --> SIDEBAR
    UI_COMP --> BOOKMARK_ED
    UI_COMP --> FILE_MAN
    UI_COMP --> SETTINGS
    UI_COMP --> UI_ELEMENTS

    UI_ELEMENTS --> CORE_BTN
    UI_ELEMENTS --> CORE_INP
    UI_ELEMENTS --> CORE_MODAL
    UI_ELEMENTS --> CORE_MENU
    UI_ELEMENTS --> LAY_HEAD
    UI_ELEMENTS --> LAY_FOOT
    UI_ELEMENTS --> LAY_GRID
    UI_ELEMENTS --> FEAT_SEARCH
    UI_ELEMENTS --> FEAT_FILTER
    UI_ELEMENTS --> FEAT_SORT

    SIDEBAR --> STORE
    BOOKMARK_ED --> STORE
    FILE_MAN --> STORE
    SETTINGS --> STORE

    STORE --> FILE_OPS
    STORE --> CONFIG_OPS
    STORE --> TYPES

    FILE_OPS --> IPC
    CONFIG_OPS --> IPC

    IPC --> FILE_MGT
    IPC --> MEDIA_HDL
    IPC --> SYS_OPS
    IPC --> UI_CTRL

    FILE_MGT --> FILE_READ
    FILE_MGT --> FILE_WRITE
    FILE_MGT --> FILE_WATCH
    FILE_MGT --> FILE_CACHE

    MEDIA_HDL --> MEDIA_FETCH
    MEDIA_HDL --> MEDIA_PARSE
    MEDIA_HDL --> MEDIA_CACHE
    MEDIA_HDL --> MEDIA_VALID

    SYS_OPS --> SYS_ENV
    SYS_OPS --> SYS_PERM
    SYS_OPS --> SYS_LOG
    SYS_OPS --> SYS_CONF

    UI_CTRL --> UI_WIN
    UI_CTRL --> UI_NOTIFY
    UI_CTRL --> UI_THEME
    UI_CTRL --> UI_EVENT

    FILE_MGT --> FS
    MEDIA_HDL --> NET
    UI_CTRL --> WIN
    SYS_OPS --> WIN

    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef store fill:#f1c40f,stroke:#f39c12,color:black
    classDef utils fill:#2ecc71,stroke:#27ae60,color:white
    classDef bridge fill:#e74c3c,stroke:#c0392b,color:white
    classDef backend fill:#9b59b6,stroke:#8e44ad,color:white
    classDef system fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef types fill:#1abc9c,stroke:#16a085,color:white

    %% Click Events
    click UI_ELEMENTS "https://github.com/Flanker-Dev/Flanker/tree/develop/src/components/ui/"
    click SIDEBAR "https://github.com/Flanker-Dev/Flanker/tree/develop/src/components/AppSidebar/"
    click BOOKMARK_ED "https://github.com/Flanker-Dev/Flanker/tree/develop/src/components/BookmarkEditor/"
    click FILE_MAN "https://github.com/Flanker-Dev/Flanker/tree/develop/src/components/FileManager/"
    click SETTINGS "https://github.com/Flanker-Dev/Flanker/tree/develop/src/components/Setting/"
    click STORE "https://github.com/Flanker-Dev/Flanker/blob/develop/src/store/store.ts"
    click FILE_OPS "https://github.com/Flanker-Dev/Flanker/tree/develop/src/utils/"
    click CONFIG_OPS "https://github.com/Flanker-Dev/Flanker/tree/develop/src/utils/"
    click FILE_MGT "https://github.com/Flanker-Dev/Flanker/tree/develop/src-tauri/src/modules/file_management/"
    click MEDIA_HDL "https://github.com/Flanker-Dev/Flanker/tree/develop/src-tauri/src/modules/media/"
    click SYS_OPS "https://github.com/Flanker-Dev/Flanker/tree/develop/src-tauri/src/modules/system/"
    click UI_CTRL "https://github.com/Flanker-Dev/Flanker/tree/develop/src-tauri/src/modules/ui/"
    click TYPES "https://github.com/Flanker-Dev/Flanker/blob/develop/src/types/types.ts"
```
