# gsidhu/buzee-tauri architecture

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

- Interactive diagram: https://gitdiagram.com/gsidhu/buzee-tauri
- Repository: https://github.com/gsidhu/buzee-tauri

## Overview

##### Main Components

a. Frontend Layer (Svelte Application):
- User Interface Components
- State Management (Stores)
- Route Management
- Event Handlers

b. Backend Layer (Tauri/Rust):
- File System Integration
- Text Extraction Services
- Database Management
- Search Engine (Tantivy)
- Browser History Integration

c. Storage Layer:
- SQLite Database
- Tantivy Index
- File System Cache

##### Component Relationships

**[Frontend Layer]**
- ↑↓ IPC (Tauri Commands)
**[Backend Layer]**
- ↑↓ Data Flow
**[Storage Layer]**

##### Detailed Component Breakdown

Frontend Components (Blue):
- Search Interface
- Results Display
- Settings Management
- File Type Management
- Statistics View
- Onboarding Flow

Backend Services (Green):
- Text Extraction Module (PDF, DOCX, Images, etc.)
- File System Watcher
- Database Manager
- Search Engine Controller
- Browser History Collector
- Housekeeping Service

Storage Components (Yellow):
- SQLite Tables (documents, metadata, body)
- Full-text Search Index (Tantivy)
- Browser History Cache

##### Data Flow Indicators

- User input flow
- Search query processing
- File indexing pipeline
- Data synchronization
- Browser history collection

##### Implementation Details

- Tauri v2 Framework Integration
- Svelte v4 Frontend
- Rust Backend Services
- SQLite + Tantivy Storage
- Cross-platform Compatibility

##### Additional Elements

Include:
- Version information
- Platform-specific variations
- Key performance paths
- Error handling flows

##### Technical Notes

- Full-text search capabilities
- Real-time file system synchronization
- Cross-platform compatibility
- Performance optimization points
- Security boundaries

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef storage fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef critical fill:#e74c3c,stroke:#c0392b,color:white

    %% Frontend Layer
    subgraph Frontend
        UI["Search Interface"]:::frontend
        RD["Results Display"]:::frontend
        SM["Settings Management"]:::frontend
        SV["Statistics View"]:::frontend
        OF["Onboarding Flow"]:::frontend
        StateM["State Management"]:::frontend
    end

    %% Backend Layer
    subgraph Backend
        TEM["Text Extraction Module"]:::backend
        FSI["File System Integration"]:::backend
        DBM["Database Manager"]:::backend
        SEC["Search Engine Controller"]:::backend
        BHC["Browser History Collector"]:::backend
        HS["Housekeeping Service"]:::backend
        IPC["IPC Communication Layer"]:::backend
        UP["User Preferences"]:::backend
    end

    %% Storage Layer
    subgraph Storage
        DB[(SQLite Database)]:::storage
        TI[(Tantivy Index)]:::storage
        FSC[(File System Cache)]:::storage
        BHCache[(Browser History Cache)]:::storage
    end

    %% Relationships
    UI --> IPC
    RD --> IPC
    SM --> IPC
    SV --> IPC
    OF --> IPC
    StateM --> IPC

    IPC --> TEM
    IPC --> FSI
    IPC --> DBM
    IPC --> SEC
    IPC --> BHC
    IPC --> HS
    IPC --> UP

    TEM --> DB
    FSI --> DB
    DBM --> DB
    SEC --> TI
    BHC --> BHCache
    HS --> FSC

    %% Click Events
    click UI "https://github.com/gsidhu/buzee-tauri/tree/main/src/lib/components/search/"
    click RD "https://github.com/gsidhu/buzee-tauri/tree/main/src/lib/components/results/"
    click SM "https://github.com/gsidhu/buzee-tauri/tree/main/src/lib/components/settings/"
    click SV "https://github.com/gsidhu/buzee-tauri/tree/main/src/routes/magic/stats/"
    click OF "https://github.com/gsidhu/buzee-tauri/tree/main/src/lib/components/onboarding/"
    click StateM "https://github.com/gsidhu/buzee-tauri/blob/main/src/lib/stores.ts"
    click TEM "https://github.com/gsidhu/buzee-tauri/tree/main/src-tauri/src/text_extraction/"
    click FSI "https://github.com/gsidhu/buzee-tauri/blob/main/src-tauri/src/indexing.rs"
    click DBM "https://github.com/gsidhu/buzee-tauri/tree/main/src-tauri/src/database/"
    click SEC "https://github.com/gsidhu/buzee-tauri/blob/main/src-tauri/src/tantivy_index.rs"
    click BHC "https://github.com/gsidhu/buzee-tauri/blob/main/src-tauri/src/chrome_read.rs"
    click HS "https://github.com/gsidhu/buzee-tauri/blob/main/src-tauri/src/housekeeping.rs"
    click IPC "https://github.com/gsidhu/buzee-tauri/blob/main/src-tauri/src/ipc.rs"
    click UP "https://github.com/gsidhu/buzee-tauri/blob/main/src-tauri/src/user_prefs.rs"

    %% Legend
    subgraph Legend
        F[Frontend Components]:::frontend
        B[Backend Services]:::backend
        S[Storage Systems]:::storage
        E[External Services]:::external
        C[Critical Paths]:::critical
    end
```
