# gbasin/ichrome architecture

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

- Interactive diagram: https://gitdiagram.com/gbasin/ichrome
- Repository: https://github.com/gbasin/ichrome

## Overview

##### Main Components

a. Browser Integration Layer
- Chrome Extension Interface
- Background Scripts
- Content Scripts (Inject folder)

b. Core Application Components
- Authentication System
- Settings Manager
- Theme Controller
- Widget Registry
- Internationalization (i18n) System
- Storage System

c. Widget System
- Widget Framework
- Individual Widgets (30+ widgets)
- Widget Communication Layer

d. User Interface Components
- Main UI
- Settings Interface
- Search Interface
- Toolbar
- Onboarding System

##### Component Relationships

- Chrome Browser <-> Browser Integration Layer
- Browser Integration Layer <-> Core Components
- Core Components <-> Widget System
- All Components <-> User Interface Layer

##### Specific Implementation Details

Key architectural elements:
**Chrome Extension**
- Background Process
- Authentication
- Storage Sync
- Extension APIs
- Content Scripts
- Site-specific Integrations
- Core Framework
- Settings Manager
- Theme Controller
- Widget Registry
- Widget System
- Widget Framework
- Widget Store
- Individual Widgets

##### Data Flow Indicators

Key interactions:
- User interactions -> UI Components
- Widget data requests -> External Services
- Storage operations -> Chrome Storage API
- Theme updates -> Theme Controller
- Authentication flow -> Auth System

##### External Services Integration

Connections to:
- Google Services
- Social Media APIs
- Weather Services
- Other Widget-specific APIs

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Browser
        Chrome[Chrome Browser]
    end

    subgraph BrowserIntegration
        ExtInterface["Chrome Extension Interface"]
        Background["Background Scripts"]:::file
        ContentScripts["Content Scripts"]:::dir
        ChromeAPI["Chrome API Interface"]:::file
    end

    subgraph CoreComponents
        Auth["Authentication System"]:::file
        Settings["Settings Manager"]:::dir
        ThemeCtrl["Theme Controller"]:::file
        WidgetReg["Widget Registry"]:::dir
        I18N["i18n System"]:::dir
        Storage["Storage System"]:::dir
        Analytics["Analytics"]:::file
        Templates["Templates System"]:::file
        Status["Status Management"]:::file
    end

    subgraph WidgetSystem
        WF["Widget Framework"]:::dir
        WR["Widget Registry"]:::dir
        IW["Individual Widgets"]:::dir
        WS["Widget Settings"]:::dir
    end

    subgraph UIComponents
        MainUI["Main UI"]:::file
        SettingsUI["Settings Interface"]:::dir
        SearchUI["Search Interface"]:::dir
        Toolbar["Toolbar"]:::file
        Onboarding["Onboarding System"]:::dir
    end

    subgraph ExternalServices
        Google["Google Services"]
        Social["Social Media APIs"]
        Weather["Weather Services"]
        OtherAPIs["Other Widget APIs"]
    end

    %% Connections
    Chrome <--> ExtInterface
    ExtInterface --> Background
    ExtInterface --> ContentScripts
    ExtInterface --> ChromeAPI

    Background --> Auth
    Background --> Storage
    ChromeAPI --> CoreComponents

    CoreComponents <--> WidgetSystem
    WidgetSystem <--> ExternalServices
    CoreComponents <--> UIComponents

    %% Click Events
    click Background "https://github.com/gbasin/iChrome/blob/master/app/js/background.js"
    click ContentScripts "https://github.com/gbasin/iChrome/tree/master/app/inject/"
    click ChromeAPI "https://github.com/gbasin/iChrome/blob/master/app/js/browser/chrome.js"
    click Auth "https://github.com/gbasin/iChrome/blob/master/app/js/core/auth.js"
    click Settings "https://github.com/gbasin/iChrome/tree/master/app/js/settings/"
    click ThemeCtrl "https://github.com/gbasin/iChrome/blob/master/app/js/themes/controller.js"
    click WidgetReg "https://github.com/gbasin/iChrome/tree/master/app/js/widgets/registry/"
    click I18N "https://github.com/gbasin/iChrome/tree/master/app/js/i18n/"
    click Storage "https://github.com/gbasin/iChrome/tree/master/app/js/storage/"
    click WF "https://github.com/gbasin/iChrome/tree/master/app/js/widgets/"
    click WR "https://github.com/gbasin/iChrome/tree/master/app/js/widgets/registry/"
    click IW "https://github.com/gbasin/iChrome/tree/master/app/widgets/"
    click WS "https://github.com/gbasin/iChrome/tree/master/app/js/widgets/settings/"
    click MainUI "https://github.com/gbasin/iChrome/blob/master/app/index.html"
    click SettingsUI "https://github.com/gbasin/iChrome/tree/master/app/js/settings/"
    click SearchUI "https://github.com/gbasin/iChrome/tree/master/app/js/search/"
    click Toolbar "https://github.com/gbasin/iChrome/blob/master/app/js/menu/toolbar.js"
    click Onboarding "https://github.com/gbasin/iChrome/tree/master/app/js/onboarding/"
    click Analytics "https://github.com/gbasin/iChrome/blob/master/app/js/core/analytics.js"
    click Templates "https://github.com/gbasin/iChrome/blob/master/app/js/core/templates.js"
    click Status "https://github.com/gbasin/iChrome/blob/master/app/js/core/status.js"

    %% Styles
    classDef browser fill:#E8E8E8
    classDef integration fill:#D3D3D3
    classDef core fill:#B0C4DE
    classDef widget fill:#90EE90
    classDef ui fill:#FFA07A
    classDef external fill:#DDA0DD
    classDef file fill:#fff,stroke:#333,stroke-width:2px
    classDef dir fill:#fff,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5

    class Chrome browser
    class ExtInterface,Background,ContentScripts,ChromeAPI integration
    class Auth,Settings,ThemeCtrl,WidgetReg,I18N,Storage,Analytics,Templates,Status core
    class WF,WR,IW,WS widget
    class MainUI,SettingsUI,SearchUI,Toolbar,Onboarding ui
    class Google,Social,Weather,OtherAPIs external
```
