# yessglory17/programmer-browser architecture

> Architecture diagram of the GitHub repository yessglory17/programmer-browser, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yessglory17/programmer-browser
- Repository: https://github.com/yessglory17/programmer-browser

## Overview

##### Main System Components

a) Application Shell Layer
- Electron main process and renderer process separation
- IPC (Inter-Process Communication) channels between them

b) Frontend Architecture Layer
- Renderer process components
- React component hierarchy
- Context providers for state management

c) Core Features Layer
- Browser functionality
- Search capabilities
- Tab management
- Shortcuts system

##### Component Relationships

a) Main Process Components (Top Level):
**[Main Process]**
- Window Management
- Menu System
- IPC Handlers

b) Renderer Process Components (Middle Level):
**[Renderer Process]**
- Context Providers
- TabContext
- SearchContext
- FindInPageContext
- Core Components
- BrowserCollapse
- Webview
- TabList
- Searchbar
- Settings
- Hooks Layer
- Shortcut System
- Webview Handlers

##### Key Interactions to Highlight

Specific flows:
- Search engine switching flow
- Tab management operations
- Shortcut system integration
- Browser collapse functionality
- Find in page feature

##### Technical Stack Indicators

Technology badges:
- Electron
- React
- TypeScript
- Webpack
- Node.js

##### Implementation Details

- The shortcut system implementation
- The webview component architecture
- The context provider hierarchy
- The IPC communication channels

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Main Process Layer"
        MP["Main Process"]
        MS["Menu System"]
        IPC["IPC Handlers"]
        
        MP --> MS
        MP --> IPC
    end

    subgraph "Renderer Process Layer"
        RP["Renderer Process"]
        
        subgraph "Context Providers"
            TC["Tab Context"]
            SC["Search Context"]
            FPC["FindInPage Context"]
        end
        
        subgraph "Core Components"
            BC["Browser Collapse"]
            WV["Webview"]
            TL["Tab List"]
            SB["Searchbar"]
            ST["Settings"]
        end
        
        subgraph "Hooks Layer"
            SS["Shortcut System"]
            WH["Webview Handlers"]
        end
        
        BV["Browser View"]
    end

    subgraph "API Services"
        HA["History API"]
        SA["Settings API"]
        NA["Notebook API"]
    end

    %% Component Relationships
    MP <--> |"IPC Communication"| RP
    RP --> TC & SC & FPC
    TC --> TL
    SC --> SB
    BV --> BC & WV & TL & SB & ST
    WV --> WH
    BC & TL & SB --> SS

    %% API Relationships
    BV --> HA & SA & NA

    %% Click Events
    click MP "https://github.com/yessGlory17/programmer-browser/blob/main/src/main/main.ts"
    click MS "https://github.com/yessGlory17/programmer-browser/blob/main/src/main/menu.ts"
    click IPC "https://github.com/yessGlory17/programmer-browser/blob/main/src/main/preload.ts"
    click TC "https://github.com/yessGlory17/programmer-browser/blob/main/src/renderer/context/TabContext.tsx"
    click SC "https://github.com/yessGlory17/programmer-browser/blob/main/src/renderer/context/SearchContext.tsx"
    click FPC "https://github.com/yessGlory17/programmer-browser/blob/main/src/renderer/context/FindInPageContext.tsx"
    click BC "https://github.com/yessGlory17/programmer-browser/blob/main/src/renderer/components/BrowserCollapse/BrowserCollapse.tsx"
    click WV "https://github.com/yessGlory17/programmer-browser/blob/main/src/renderer/components/Webview/Webview.tsx"
    click TL "https://github.com/yessGlory17/programmer-browser/blob/main/src/renderer/components/TabList/TabList.tsx"
    click SB "https://github.com/yessGlory17/programmer-browser/blob/main/src/renderer/components/Searchbar/Searchbar.tsx"
    click ST "https://github.com/yessGlory17/programmer-browser/blob/main/src/renderer/components/Settings/SearchEngineModal.tsx"
    click SS "https://github.com/yessGlory17/programmer-browser/blob/main/src/renderer/hooks/shortcut/useHotkeys.tsx"
    click WH "https://github.com/yessGlory17/programmer-browser/blob/main/src/renderer/hooks/webview/useWebviewReady.tsx"
    click BV "https://github.com/yessGlory17/programmer-browser/blob/main/src/renderer/views/Browser/BrowserPage.tsx"
    click HA "https://github.com/yessGlory17/programmer-browser/blob/main/src/api/history/index.ts"
    click SA "https://github.com/yessGlory17/programmer-browser/blob/main/src/api/settings/index.ts"
    click NA "https://github.com/yessGlory17/programmer-browser/blob/main/src/api/notebook/index.ts"

    classDef main fill:#2374ab
    classDef renderer fill:#48a9a6
    classDef context fill:#e4fde1
    classDef component fill:#8ac4ff
    classDef hooks fill:#ffbf69
    classDef api fill:#db5461

    class MP,MS,IPC main
    class RP renderer
    class TC,SC,FPC context
    class BC,WV,TL,SB,ST,BV component
    class SS,WH hooks
    class HA,SA,NA api
```
