# iamsrikanthnani/pluely architecture

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

- Interactive diagram: https://gitdiagram.com/iamsrikanthnani/pluely
- Repository: https://github.com/iamsrikanthnani/pluely

## Overview

##### Project Type & Purpose
- This is a cross-platform desktop application (“Pluely”) built with Tauri.
- Frontend: React + TypeScript + Vite, providing a translucent, always-on overlay UI for text, image, and voice input.
- Backend: Rust (via Tauri), handling window management, system integration, IPC, and bundling.
- Purpose: A privacy-first AI assistant that sends API calls directly from the client to various AI (LLM) and STT providers, storing minimal data locally.

##### File-Structure Analysis
- Top level
- index.html, src/, package.json, vite.config.ts → Frontend entry & build config
- src/
- components/, hooks/, contexts/, lib/, config/, types/ → MVC-style separation (UI, state, business logic, utilities, type definitions)
- main.tsx/App.tsx → React entry and root component
- src-tauri/
- src/main.rs & lib.rs → Tauri setup, IPC command handlers
- src/window.rs → Window styling/positioning
- build.rs, tauri.conf.json → Platform bundling and capabilities

##### README & Architecture Insights
- Illustrated “Frontend (React)” vs. “Backend (Tauri + Rust)” in the docs
- Emphasis on:
- Local storage of API keys & chat history
- Direct HTTPS calls from frontend to AI/STT providers
- Rust layer for native performance, window control, packaging

## Diagram (Mermaid)

```mermaid
flowchart TD
  subgraph "UI Layer (React App)"  
    UI1["src/main.tsx"]:::frontend
    UI2["src/App.tsx"]:::frontend
    UI3["index.html"]:::frontend
  end

  subgraph "State & Business Logic"  
    C1["src/contexts/app.context.tsx"]:::logic
    C2["src/contexts/theme.context.tsx"]:::logic
    H1["src/hooks/useCompletion.ts"]:::logic
    H2["src/hooks/useCustomProvider.ts"]:::logic
    H3["src/hooks/useCustomSttProviders.ts"]:::logic
    H4["src/hooks/useSettings.ts"]:::logic
    H5["src/hooks/useVersion.ts"]:::logic
    H6["src/hooks/useWindow.ts"]:::logic
    B1["src/lib/functions/ai-models.function.ts"]:::logic
    B2["src/lib/functions/ai-response.function.ts"]:::logic
    B3["src/lib/functions/stt.function.ts"]:::logic
    B4["src/lib/functions/common.function.ts"]:::logic
  end

  LocalStorage["Local Storage (Browser & Chat History)"]:::storage

  subgraph "Tauri Host (Rust IPC Layer)"  
    TMain["src-tauri/src/main.rs"]:::backend
    TLib["src-tauri/src/lib.rs"]:::backend
    TConf["src-tauri/tauri.conf.json"]:::backend
  end

  OSWindow["src-tauri/src/window.rs"]:::backend

  subgraph "Packaging & Platform Bundles"  
    BRS["src-tauri/build.rs"]:::backend
    Cargo["src-tauri/Cargo.toml"]:::backend
    PLIST["src-tauri/info.plist"]:::backend
    DESK["src-tauri/pluely.desktop"]:::backend
    ICON["src-tauri/icons/icon.icns"]:::backend
  end

  subgraph "External AI Providers"  
    AI["AI Providers"]:::cloud
    CUSTOM_PROVIDER["Custom Provider"]:::cloud
  end

  subgraph "External STT Providers"  
    STT["STT Providers"]:::cloud
  end

  User["User"]:::actor
  User --> UI2
  UI2 --> C1
  UI2 --> C2
  C1 --> H1
  C1 --> H2
  C1 --> H3
  C1 --> H4
  C1 --> H5
  C1 --> H6
  H1 --> B1
  H1 --> B2
  H3 --> B3
  B1 --> LocalStorage
  B2 --> LocalStorage
  B3 --> LocalStorage
  B4 --> LocalStorage
  UI2 <-->|"save/load"| LocalStorage
  UI2 -->|"fetch() calls"| AI
  UI2 -->|"fetch() calls"| STT
  UI2 --> TIPC["Tauri IPC"]:::ipc
  TIPC --> UI2
  TIPC --> TMain
  TMain --> OSWindow
  TMain --> TLib
  TMain --> TConf
  TMain --> BRS
  TMain --> Cargo
  TMain --> PLIST
  TMain --> DESK
  TMain --> ICON
  AI -->|"streaming"| UI2
  STT -->|"streaming"| UI2
  CUSTOM_PROVIDER -.-> AI
  CUSTOM_PROVIDER -.-> STT

  click UI1 "https://github.com/iamsrikanthnani/pluely/blob/master/src/main.tsx"
  click UI2 "https://github.com/iamsrikanthnani/pluely/blob/master/src/App.tsx"
  click UI3 "https://github.com/iamsrikanthnani/pluely/blob/master/index.html"
  click C1 "https://github.com/iamsrikanthnani/pluely/blob/master/src/contexts/app.context.tsx"
  click C2 "https://github.com/iamsrikanthnani/pluely/blob/master/src/contexts/theme.context.tsx"
  click H1 "https://github.com/iamsrikanthnani/pluely/blob/master/src/hooks/useCompletion.ts"
  click H2 "https://github.com/iamsrikanthnani/pluely/blob/master/src/hooks/useCustomProvider.ts"
  click H3 "https://github.com/iamsrikanthnani/pluely/blob/master/src/hooks/useCustomSttProviders.ts"
  click H4 "https://github.com/iamsrikanthnani/pluely/blob/master/src/hooks/useSettings.ts"
  click H5 "https://github.com/iamsrikanthnani/pluely/blob/master/src/hooks/useVersion.ts"
  click H6 "https://github.com/iamsrikanthnani/pluely/blob/master/src/hooks/useWindow.ts"
  click B1 "https://github.com/iamsrikanthnani/pluely/blob/master/src/lib/functions/ai-models.function.ts"
  click B2 "https://github.com/iamsrikanthnani/pluely/blob/master/src/lib/functions/ai-response.function.ts"
  click B3 "https://github.com/iamsrikanthnani/pluely/blob/master/src/lib/functions/stt.function.ts"
  click B4 "https://github.com/iamsrikanthnani/pluely/blob/master/src/lib/functions/common.function.ts"
  click LocalStorage "https://github.com/iamsrikanthnani/pluely/blob/master/src/lib/storage/index.ts"
  click TMain "https://github.com/iamsrikanthnani/pluely/blob/master/src-tauri/src/main.rs"
  click TLib "https://github.com/iamsrikanthnani/pluely/blob/master/src-tauri/src/lib.rs"
  click TConf "https://github.com/iamsrikanthnani/pluely/blob/master/src-tauri/tauri.conf.json"
  click OSWindow "https://github.com/iamsrikanthnani/pluely/blob/master/src-tauri/src/window.rs"
  click BRS "https://github.com/iamsrikanthnani/pluely/blob/master/src-tauri/build.rs"
  click Cargo "https://github.com/iamsrikanthnani/pluely/blob/master/src-tauri/Cargo.toml"
  click PLIST "https://github.com/iamsrikanthnani/pluely/blob/master/src-tauri/info.plist"
  click DESK "https://github.com/iamsrikanthnani/pluely/blob/master/src-tauri/pluely.desktop"
  click ICON "https://github.com/iamsrikanthnani/pluely/blob/master/src-tauri/icons/icon.icns"

  classDef frontend fill:#D0E6FF,stroke:#004080
  classDef logic fill:#E6F7D0,stroke:#407300
  classDef storage fill:#FFD0B0,stroke:#804000
  classDef backend fill:#D0FFD6,stroke:#006600
  classDef cloud fill:#F0F0F0,stroke:#888888,stroke-dasharray: 5 5
  classDef ipc fill:#FFE6FF,stroke:#800040
  classDef actor fill:#FFF0B0,stroke:#806600,stroke-width:2px,stroke-dasharray: 2 2
```
