# rohit1kumar/shareclaude architecture

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

- Interactive diagram: https://gitdiagram.com/rohit1kumar/shareclaude
- Repository: https://github.com/rohit1kumar/shareclaude

## Overview

##### Main Components

A. Client-Side Components:
- Chrome Extension Component
- Content Script (content.js)
- Extension Manifest
- Web Application (React)
- Frontend UI Components
- Routing System
- Markdown/Code Rendering

B. Server-Side Components:
- Cloudflare Workers (Backend API)
- Cloudflare D1 Database
- Database Migration System

**[Client Layer]**
- ↓↑
**[API Layer]**
- ↓↑
**[Data Layer]**

##### Detailed Component Breakdown

A. Client Layer (Top):
- Content Script (interfaces with Claude.ai)
- Share Button Integration
- Components (Header, ChatViewer, CodeBlock, etc.)
- Pages (Home, Privacy Policy)
- Assets & Styling

B. API Layer (Middle):
- Cloudflare Workers API:
- API Routes (/api/chats/*)
- Middleware
- Request/Response Handling

C. Data Layer (Bottom):
- Cloudflare D1 Database:
- Chat Storage
- Migration System
- Schema Definition

##### Additional Elements

- Security layer (showing private URL generation)
- Static asset handling (Cloudflare Pages)
- Build/Deploy pipeline

##### Technical Details to Note

Annotations for:
- React + TailwindCSS frontend
- Cloudflare Workers serverless architecture
- Database migration system
- API endpoints structure

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        direction TB
        CE[Chrome Extension]
        CS["Content Script"]
        EM["Extension Manifest"]
        CE --> CS
        CE --> EM
        
        WA[Web Application]
        FC[Frontend Components]
        PC[Page Components]
        CV["Chat Viewer"]
        CR["Code Block"]
        MR["Markdown Renderer"]
        WA --> FC
        WA --> PC
        FC --> CV
        FC --> CR
        FC --> MR
    end

    subgraph API
        direction TB
        CW[Cloudflare Workers API]
        AR["API Routes"]
        CE["Chat Endpoints"]
        AM["API Middleware"]
        CW --> AR
        CW --> CE
        CW --> AM
    end

    subgraph Data
        direction TB
        DB[(Cloudflare D1 Database)]
        MS[Migration System]
        SD["Schema Definition"]
        MC["Migration Config"]
        DB --> MS
        DB --> SD
        DB --> MC
    end

    Claude[Claude.ai]:::external

    CS --> Claude
    CS --> CW
    WA --> CW
    CW --> DB

    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef external fill:#f0f0f0,stroke:#666,stroke-width:1px

    click CE "https://github.com/rohit1kumar/shareclaude/tree/main/extension/"
    click CS "https://github.com/rohit1kumar/shareclaude/blob/main/extension/content.js"
    click EM "https://github.com/rohit1kumar/shareclaude/blob/main/extension/manifest.json"
    click WA "https://github.com/rohit1kumar/shareclaude/blob/main/app/src/App.jsx"
    click FC "https://github.com/rohit1kumar/shareclaude/tree/main/app/src/components/"
    click PC "https://github.com/rohit1kumar/shareclaude/tree/main/app/src/pages/"
    click CV "https://github.com/rohit1kumar/shareclaude/blob/main/app/src/components/ChatViewer.jsx"
    click CR "https://github.com/rohit1kumar/shareclaude/blob/main/app/src/components/CodeBlock.jsx"
    click MR "https://github.com/rohit1kumar/shareclaude/blob/main/app/src/components/MarkdownRenderer.jsx"
    click CW "https://github.com/rohit1kumar/shareclaude/tree/main/app/functions/api/"
    click CE "https://github.com/rohit1kumar/shareclaude/tree/main/app/functions/api/chats/"
    click AM "https://github.com/rohit1kumar/shareclaude/blob/main/app/functions/api/_middleware.js"
    click SD "https://github.com/rohit1kumar/shareclaude/blob/main/app/database/schema.js"
    click MS "https://github.com/rohit1kumar/shareclaude/tree/main/app/database/migrations/"
    click MC "https://github.com/rohit1kumar/shareclaude/blob/main/app/drizzle.config.js"
```
