# rajpoot-vikas/extension architecture

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

- Interactive diagram: https://gitdiagram.com/rajpoot-vikas/extension
- Repository: https://github.com/rajpoot-vikas/extension

## Overview

##### Project type and purpose
- This is a browser-extension template (“WXT + React”) that scaffolds a WebExtension using React, TypeScript, Tailwind CSS, Vite, and the WXT toolkit.
- It provides three entrypoints: a background script, a content script injected into web pages, and a side-panel React UI.

##### File structure
- Top-level: configuration files (.gitignore, Dockerfile, tsconfig.json, vite.config.ts, wxt.config.ts), package.json, components.json.
- src/entrypoints:
- background.ts – the persistent background service worker
- content.ts – the script running in page context
- sidepanel/ – the React-based UI loaded into the extension side panel, with its own index.html, index.tsx, component tree, and a workflow context provider
- src/components: reusable UI primitives (button, etc.)
- src/lib: shared types, message-bus definitions, utility functions, workflow types

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Runtime Contexts
    subgraph "Browser Extension Runtime"
        subgraph "Background Context"
            BG["Background Service Worker"]:::background
        end
        subgraph "Content Context"
            CT["Content Script"]:::content
        end
        subgraph "Side-Panel UI Context"
            SP["Side-Panel UI"]:::ui
            SPCP["Workflow Context Provider"]:::ui
            SPUI1["Error View"]:::ui
            SPUI2["Event Viewer"]:::ui
            SPUI3["Initial View"]:::ui
            SPUI4["Login A View"]:::ui
            SPUI5["Recording View"]:::ui
            SPUI6["Stopped View"]:::ui
        end
    end

    %% Shared Library
    subgraph "Shared Library"
        ML["Message Bus Types"]:::shared
        WT["Workflow Types"]:::shared
        GT["General Types"]:::shared
        UT["Utility Functions"]:::shared
    end

    %% Build System
    subgraph "Build System"
        VITE["Vite Configuration"]:::build
        WXT["WXT Toolkit Configuration"]:::build
        TS{"TypeScript Configuration"}:::build
        DOCKER["Docker Development Environment"]:::build
    end

    %% External Services
    BrowserAPI["Browser Extension API"]:::external

    %% Relationships
    CT -->|"sendMessage()/onMessage()"| BG
    SP -->|"sendMessage()/onMessage()"| BG
    CT -->|"imports types/utils"| ML
    CT -->|"imports types/utils"| WT
    CT -->|"imports types/utils"| GT
    CT -->|"imports types/utils"| UT
    SP -->|"imports types/utils"| ML
    SP -->|"imports types/utils"| WT
    SP -->|"imports types/utils"| GT
    SP -->|"imports types/utils"| UT
    BG -->|"imports types/utils"| ML
    BG -->|"imports types/utils"| WT
    BG -->|"imports types/utils"| GT
    BG -->|"imports types/utils"| UT
    BG -->|"chrome.* API calls"| BrowserAPI
    CT -->|"DOM & chrome.* API calls"| BrowserAPI
    SP -->|"chrome.* API calls"| BrowserAPI
    VITE -->|"bundles entrypoints"| BG
    VITE -->|"bundles entrypoints"| CT
    VITE -->|"bundles entrypoints"| SP
    WXT -->|"provides boilerplate"| VITE
    TS -->|"type checking"| VITE
    DOCKER -->|"dev environment"| VITE

    %% Side-Panel Internal Structure
    SP --> SPCP
    SPCP --> SPUI1
    SPCP --> SPUI2
    SPCP --> SPUI3
    SPCP --> SPUI4
    SPCP --> SPUI5
    SPCP --> SPUI6

    %% Click Events
    click BG "https://github.com/rajpoot-vikas/extension/blob/main/src/entrypoints/background.ts"
    click CT "https://github.com/rajpoot-vikas/extension/blob/main/src/entrypoints/content.ts"
    click SP "https://github.com/rajpoot-vikas/extension/blob/main/src/entrypoints/sidepanel/index.tsx"
    click SPCP "https://github.com/rajpoot-vikas/extension/blob/main/src/entrypoints/sidepanel/context/workflow-provider.tsx"
    click SPUI1 "https://github.com/rajpoot-vikas/extension/blob/main/src/entrypoints/sidepanel/components/error-view.tsx"
    click SPUI2 "https://github.com/rajpoot-vikas/extension/blob/main/src/entrypoints/sidepanel/components/event-viewer.tsx"
    click SPUI3 "https://github.com/rajpoot-vikas/extension/blob/main/src/entrypoints/sidepanel/components/initial-view.tsx"
    click SPUI4 "https://github.com/rajpoot-vikas/extension/blob/main/src/entrypoints/sidepanel/components/logina-view.tsx"
    click SPUI5 "https://github.com/rajpoot-vikas/extension/blob/main/src/entrypoints/sidepanel/components/recording-view.tsx"
    click SPUI6 "https://github.com/rajpoot-vikas/extension/blob/main/src/entrypoints/sidepanel/components/stopped-view.tsx"
    click ML "https://github.com/rajpoot-vikas/extension/blob/main/src/lib/message-bus-types.ts"
    click WT "https://github.com/rajpoot-vikas/extension/blob/main/src/lib/workflow-types.ts"
    click GT "https://github.com/rajpoot-vikas/extension/blob/main/src/lib/types.ts"
    click UT "https://github.com/rajpoot-vikas/extension/blob/main/src/lib/utils.ts"
    click VITE "https://github.com/rajpoot-vikas/extension/blob/main/vite.config.ts"
    click WXT "https://github.com/rajpoot-vikas/extension/blob/main/wxt.config.ts"
    click TS "https://github.com/rajpoot-vikas/extension/blob/main/tsconfig.json"
    click DOCKER "https://github.com/rajpoot-vikas/extension/tree/main/Dockerfile"

    %% Styles
    classDef background fill:#cce5ff,stroke:#004085
    classDef content fill:#ffe5b4,stroke:#b36b00
    classDef ui fill:#d4edda,stroke:#155724
    classDef shared fill:#f8f9fa,stroke:#6c757d
    classDef build fill:#e2e3e5,stroke:#383d41
    classDef external fill:#fdfdfe,stroke:#d6d8db
```
