# sgasser/website-reader-for-claude architecture

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

- Interactive diagram: https://gitdiagram.com/sgasser/website-reader-for-claude
- Repository: https://github.com/sgasser/website-reader-for-claude

## Overview

##### Main Components

A. Browser Components:
- Chrome Extension Popup UI (represented by popup.html and src/popup/)
- Content Script (src/contentScript/) that interacts with web pages
- Extension Background Service

B. External Services:
- Claude.ai Integration
- Jina.ai Reader API
- Target Websites (for content extraction)

- Chrome Browser                                         |

- Extension UI   |  |  Content Script   |  |        Target Website         |         |
- (Popup.tsx)     |  | (contentScript/)  |  | (Any webpage with URL)        |         |

- ↕                    ↕                           ↕                           |

- ↕                    ↕                           ↕

- External Services                                      |

- Claude.ai     |  |    Jina.ai       |  |     Content Processing         |         |
- Interface     |  |    Reader API     |  |     & Transformation          |         |

##### Key Interactions to Highlight

a. User Flow:
- URL paste detection in Claude.ai interface
- Content script activation
- Webpage content extraction
- Processed content injection

b. Data Flow:
- URL → Content Script → Jina.ai Reader
- Extracted Content → Content Processing
- Processed Content → Claude.ai Interface

##### Technical Details

- TypeScript/React components (src/popup/)
- Content script injection points
- API integration points (utils/claude.ts, utils/jina.ts)

##### Implementation Notes

- Extension's event-driven architecture
- Privacy-focused nature of the processing
- Where content transformation occurs
- Security boundaries between components

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Browser[Chrome Browser Environment]
        direction TB
        subgraph UI[Extension Interface]
            Popup["Popup UI"]
            CSS["Styling Layer"]
        end

        subgraph CS[Content Script Layer]
            ContentScript["Content Script"]
            Loading["Loading State"]
        end

        subgraph Target[Target Environment]
            Webpage["Webpage Content"]
            Claude["Claude.ai Interface"]
        end
    end

    subgraph External[External Services]
        direction TB
        JinaAPI["Jina.ai Reader API"]
        Storage["Extension Storage"]
    end

    %% Relationships
    Popup --> ContentScript
    ContentScript --> Webpage
    ContentScript --> Claude
    ContentScript --> JinaAPI
    Popup --> Storage
    Loading --> ContentScript
    CSS --> Popup

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef interface fill:#ddf1d5,stroke:#59b356
    classDef service fill:#d5e8f1,stroke:#4a90e2
    classDef external fill:#f1e4d5,stroke:#e2a74a
    classDef storage fill:#e4d5f1,stroke:#9a4ae2

    class Popup,CSS interface
    class ContentScript,Loading service
    class JinaAPI,Claude external
    class Storage storage
    class Webpage default

    %% Click Events
    click Popup "https://github.com/sgasser/website-reader-for-claude/blob/main/src/popup/Popup.tsx"
    click CSS "https://github.com/sgasser/website-reader-for-claude/blob/main/src/popup/index.css"
    click ContentScript "https://github.com/sgasser/website-reader-for-claude/blob/main/src/contentScript/index.ts"
    click Loading "https://github.com/sgasser/website-reader-for-claude/blob/main/src/utils/loading.ts"
    click Claude "https://github.com/sgasser/website-reader-for-claude/blob/main/src/utils/claude.ts"
    click JinaAPI "https://github.com/sgasser/website-reader-for-claude/blob/main/src/utils/jina.ts"

    %% Legend
    subgraph Legend
        L1["Interface Components"]:::interface
        L2["Service Components"]:::service
        L3["External Services"]:::external
        L4["Storage Components"]:::storage
    end
```
