# gidragir/tab-clip-manager architecture

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

- Interactive diagram: https://gitdiagram.com/gidragir/tab-clip-manager
- Repository: https://github.com/gidragir/tab-clip-manager

## Overview

##### Main Components
- Frontend: Located in apps/frontend – built using React (with TypeScript), TailwindCSS, and Vite. There are clearly defined windows (main and settings) and supporting assets/components.
- Backend: Found in apps/backend – built with Rust and Tauri. Within this there are submodules:
- The Tauri part (apps/backend/tauri) that handles the desktop integration (native windowing, tray menus, shortcuts, file watchers, etc.).
- A Prisma-based module (apps/backend/prisma) that likely manages database access (SQLite as mentioned in the README).
- A separate Rust subproject (prisma-cli) that perhaps provides command-line support for database schema management.
- Database: Although not directly visible in the file tree (aside from the Prisma schema file), the README confirms the use of SQLite.
- Documentation: Located in apps/docs, which includes configuration for generating and hosting docs and guides (possibly on GitHub Pages).
- Shared Packages: Under the packages directory, providing configuration, linter settings, shared types, and UI components that are reused across the project.
- Build & Dev Tools: The root contains configuration files (pnpm, Turborepo, GitHub workflows, etc.) that manage repository-wide tasks.

##### Relationships and Interactions
- The Frontend (React app) interacts directly with the Backend. Communication likely happens through native Tauri APIs or inter-process calls.
- The Tauri backend (inside apps/backend/tauri) serves as a bridge between the desktop layer and the Rust core functions. It handles system-level operations (shortcuts, file watching, tray menus).
- The Prisma module in the backend communicates with the SQLite database to save and retrieve tab data.
- The frontend may also interact with shared UI utilities and configurations provided by the packages in the monorepo.
- Documentation (apps/docs) is developed as a separate app but ties into overall project usage and support, which can be represented as a peripheral tooling component.

##### Architectural Patterns and Design Principles
- Monorepo Structure: Using Turborepo, the project separates concerns by having dedicated apps (frontend, backend, docs) and shared libraries/configurations (packages).
- Separation of Concerns: Clear separation between UI (frontend), system integration/desktop backend (tauri), and data handling (Prisma and SQLite).
- Modular Design: Each component (frontend, backend modules, shared packages) is independently versioned and configured but integrated into a cohesive whole.
- Cross-Platform & Desktop Capabilities: Utilizes Tauri and Rust to bridge web technologies with native desktop functionalities.

##### Relevant Technologies
- Frontend: React (TypeScript), Vite, TailwindCSS.
- Backend: Rust, Tauri, Prisma.
- Database: SQLite.
- Build Tooling: Turborepo, pnpm.
- Shared Configurations & UI Components: Modules in packages (configs, linter, types, ui).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        FE["Frontend (React + Vite)"]:::frontend
        FE1["Main Window"]:::frontend
        FE2["Settings Window"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        BA["Tauri Integration (Rust/Tauri)"]:::backend
        BP["Prisma/Database Connector"]:::backend
        BC["Prisma CLI Tool"]:::backend
    end

    %% Database Layer
    subgraph "Database Layer"
        DB["SQLite Database"]:::database
    end

    %% Documentation
    subgraph "Documentation"
        DOC["Documentation (Astro/MDX)"]:::doc
    end

    %% Shared Modules
    subgraph "Shared Modules"
        SP["Shared Packages"]:::shared
    end

    %% Deployment/CI
    subgraph "Deployment/CI"
        DEP["CI/Deployment (Turborepo, pnpm)"]:::ci
    end

    %% Connections between layers
    FE -->|"calls"| BA
    BA -->|"queries"| BP
    BP -->|"persists"| DB
    BC -->|"manages-schema"| BP

    %% Shared packages feeding into Frontend and Backend
    SP -->|"provides-resources"| FE
    SP -->|"provides-resources"| BA

    %% Deployment builds
    DEP -->|"builds"| FE
    DEP -->|"builds"| BA
    DEP -->|"builds"| DOC
    DEP -->|"builds"| SP

    %% Click Events
    click FE "https://github.com/gidragir/tab-clip-manager/tree/main/apps/frontend"
    click BA "https://github.com/gidragir/tab-clip-manager/tree/main/apps/backend/tauri"
    click BP "https://github.com/gidragir/tab-clip-manager/tree/main/apps/backend/prisma"
    click BC "https://github.com/gidragir/tab-clip-manager/tree/main/apps/backend/prisma-cli"
    click DOC "https://github.com/gidragir/tab-clip-manager/tree/main/apps/docs"
    click SP "https://github.com/gidragir/tab-clip-manager/tree/main/packages"

    %% Styles
    classDef frontend fill:#ffebcd,stroke:#d2691e,stroke-width:2px;
    classDef backend fill:#add8e6,stroke:#00008b,stroke-width:2px;
    classDef database fill:#90ee90,stroke:#006400,stroke-width:2px;
    classDef doc fill:#ffe4e1,stroke:#ff69b4,stroke-width:2px;
    classDef shared fill:#d3d3d3,stroke:#696969,stroke-width:2px;
    classDef ci fill:#ffc0cb,stroke:#ff1493,stroke-width:2px;
```
