# piyushgarg-dev/leetcode-whisper-chrome-extension architecture

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

- Interactive diagram: https://gitdiagram.com/piyushgarg-dev/leetcode-whisper-chrome-extension
- Repository: https://github.com/piyushgarg-dev/leetcode-whisper-chrome-extension

## Overview

##### Specific Components

Frontend (UI Layer):
- UI Components (from src/components/ui)
- Modal Components (from src/modals)
- Component
- Theme Provider

Service Layer:
- Modal Service
- Chrome Storage Service
- IndexDB Service

Data Management:
- Chrome Storage
- IndexedDB
- Interface Definitions

AI Integration:
- OpenAI 3.5 Turbo
- OpenAI 4.0
- Gemini AI 1.5 Pro

##### Connection Flows

- Content Script ↔ Web Page
- Background Script ↔ Chrome APIs
- UI Components ↔ Modal Service
- Modal Service ↔ AI Services
- Storage Services ↔ Chrome Storage/IndexedDB

##### Component Details

For each major component, include:
- Component name
- Key responsibilities
- Primary dependencies
- Data flow direction

##### Technical Stack Indicators

A tech stack section showing:
- React + TypeScript
- Vite
- Tailwind CSS
- Chrome Extension APIs
- IndexedDB
- External AI APIs

**[Chrome Extension Interface Layer]**
- ↕
**[React Components & UI Layer]**
- ↕
**[Service Layer & Modal System]**
- ↕
**[Storage Layer]**
- ↕
**[External AI Services]**

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph ChromeExtension
        BA[Browser Action]
        CS[Content Script]:::content
        BS[Background Script]:::background
        click CS "https://github.com/piyushgarg-dev/leetcode-whisper-chrome-extension/blob/main/src/content.tsx"
        click BS "https://github.com/piyushgarg-dev/leetcode-whisper-chrome-extension/blob/main/src/background.js"
    end

    subgraph UILayer
        RC[React Components]
        UI[UI Components]:::ui
        MC[Modal Components]:::modal
        SC[Show Component]:::show
        TP[Theme Provider]:::theme
        click UI "https://github.com/piyushgarg-dev/leetcode-whisper-chrome-extension/tree/main/src/components/ui/"
        click SC "https://github.com/piyushgarg-dev/leetcode-whisper-chrome-extension/blob/main/src/components/Show.tsx"
        click TP "https://github.com/piyushgarg-dev/leetcode-whisper-chrome-extension/blob/main/src/providers/theme.tsx"
        click MC "https://github.com/piyushgarg-dev/leetcode-whisper-chrome-extension/tree/main/src/modals/"
    end

    subgraph ServiceLayer
        MS[Modal Service]:::modalService
        CSS[Chrome Storage Service]:::storage
        IDS[IndexDB Service]:::storage
        click MS "https://github.com/piyushgarg-dev/leetcode-whisper-chrome-extension/blob/main/src/services/ModalService.ts"
        click CSS "https://github.com/piyushgarg-dev/leetcode-whisper-chrome-extension/blob/main/src/hooks/useChromeStorage.ts"
        click IDS "https://github.com/piyushgarg-dev/leetcode-whisper-chrome-extension/blob/main/src/hooks/useIndexDB.tsx"
    end

    subgraph DataLayer
        CS_Store[(Chrome Storage)]
        IDB[(IndexedDB)]
        IF[Interface Definitions]:::interface
        click IF "https://github.com/piyushgarg-dev/leetcode-whisper-chrome-extension/tree/main/src/interface/"
    end

    subgraph AIServices
        OAI35[OpenAI 3.5 Turbo]:::ai
        OAI40[OpenAI 4.0]:::ai
        GEM[Gemini AI 1.5 Pro]:::ai
        click OAI35 "https://github.com/piyushgarg-dev/leetcode-whisper-chrome-extension/blob/main/src/modals/modal/OpenAI_3_5_turbo.ts"
        click OAI40 "https://github.com/piyushgarg-dev/leetcode-whisper-chrome-extension/blob/main/src/modals/modal/OpenAI_40.ts"
        click GEM "https://github.com/piyushgarg-dev/leetcode-whisper-chrome-extension/blob/main/src/modals/modal/GeminiAI_1_5_pro.ts"
    end

    %% Connections
    CS --> WebPage[Web Page]
    BS <--> ChromeAPIs[Chrome APIs]
    RC --> MS
    MS --> AIServices
    CSS --> CS_Store
    IDS --> IDB
    BA --> RC
    
    %% Component Relationships
    UILayer --> ServiceLayer
    ServiceLayer --> DataLayer
    ServiceLayer --> AIServices

    %% Styling
    classDef content fill:#2196F3
    classDef background fill:#2196F3
    classDef ui fill:#4CAF50
    classDef modal fill:#4CAF50
    classDef show fill:#4CAF50
    classDef theme fill:#4CAF50
    classDef modalService fill:#9C27B0
    classDef storage fill:#9C27B0
    classDef interface fill:#757575
    classDef ai fill:#FF9800

    %% Legend
    subgraph Legend
        L1[Chrome Extension Components]:::content
        L2[React/UI Components]:::ui
        L3[Services]:::modalService
        L4[External AI Services]:::ai
        L5[Storage/Data]:::interface
    end
```
