# minprocess/notessidepanel architecture

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

- Interactive diagram: https://gitdiagram.com/minprocess/notessidepanel
- Repository: https://github.com/minprocess/notessidepanel

## Overview

##### Project type and purpose
- This is a browser extension (Chrome & Edge) that injects a side panel into the browser UI.
- Its purpose is to let users type and save notes per tab, persisting them in local storage.

##### File structure
- manifest.json: registers the extension, grants permissions (storage, tabs, sidePanel) and declares sidepanel.html as the side panel entry point.
- sidepanel.html: the HTML for the UI loaded into the side panel.
- sidepanel.js: the single script controlling UI behavior and API calls.
- styles.css: styling for the panel.
- No background scripts or content scripts—logic lives entirely in the side panel.

##### README for additional insights
- Uses Chrome Extension APIs: sidePanel, storage, tabs.
- On panel load, reads chrome.tabs to get the current tab’s ID, then chrome.storage.local to fetch that tab’s saved note.
- “Save Note” writes the textarea contents to chrome.storage.local under a key derived from the tab ID.
- No worker threads or message-passing beyond direct API calls in sidepanel.js.

##### Components & interactions
a. Main components
- Browser Host (Chrome/Edge)
- Extension Side Panel (UI + JS)
- Chrome Extension APIs (tabs, sidePanel, storage)
- Local Storage (chrome.storage.local)
b. Relationships & data flows
- Side Panel UI ←→ sidepanel.js logic
- sidepanel.js → chrome.tabs.query() to get tab ID
- sidepanel.js → chrome.storage.local.get/ .set() to read/write notes
- chrome.storage.local persists data inside the browser
c. Architectural patterns / principles
- Single-page UI component loaded on demand (sidePanel API)
- Simple client-side MVC: HTML/CSS = view, JS = controller/business logic, storage = model
- Key-based storage partitioned by tab ID
d. Key technologies/frameworks
- Chrome Extension Manifest v3 (permissions, side_panel declaration)
- Chrome Extension APIs: sidePanel, tabs, storage
- Vanilla HTML/CSS/JavaScript

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Browser host layer
    BrowserHost["Browser Host (Chrome/Edge)"]:::host

    %% Configuration and docs
    Manifest["Extension Registration (Manifest)"]:::config
    Docs["Project Documentation & Usage Info (README.md)"]:::doc

    %% Extension side panel components
    subgraph "Extension Side Panel"
        SidePanel["Side Panel UI"]:::ui
        SidePanelJS["UI Controller & Business Logic"]:::ui
        Styles["Stylesheet"]:::ui
    end

    %% API layer
    subgraph "Chrome Extension APIs" 
        TabsAPI["tabs API"]:::api
        StorageAPI["storage API"]:::api
    end

    %% Data layer
    Storage["chrome.storage.local"]:::data

    %% Connections
    BrowserHost -->|"declares sidePanel entry"| Manifest
    Manifest -->|"loads sidePanel.html"| SidePanel
    Manifest -->|"references docs"| Docs

    SidePanel -->|"loads script"| SidePanelJS
    SidePanel -->|"loads styles"| Styles

    SidePanelJS -->|"chrome.tabs.query()"| TabsAPI
    TabsAPI -->|"returns tab ID"| SidePanelJS

    SidePanelJS -->|"chrome.storage.local.get/set()"| StorageAPI
    StorageAPI -->|"persist/retrieve data"| Storage
    Storage -->|"note data"| SidePanelJS

    %% Click Events
    click Manifest "https://github.com/minprocess/notessidepanel/blob/main/manifest.json"
    click SidePanel "https://github.com/minprocess/notessidepanel/blob/main/sidepanel.html"
    click SidePanelJS "https://github.com/minprocess/notessidepanel/blob/main/sidepanel.js"
    click Styles "https://github.com/minprocess/notessidepanel/blob/main/styles.css"
    click Docs "https://github.com/minprocess/notessidepanel/blob/main/README.md"

    %% Styles
    classDef host fill:#CFD8DC,stroke:#607D8B,color:#263238
    classDef config fill:#FFE0B2,stroke:#FB8C00,color:#E65100
    classDef doc fill:#FFF9C4,stroke:#FBC02D,color:#F57F17
    classDef ui fill:#E3F2FD,stroke:#42A5F5,color:#0D47A1
    classDef api fill:#FFF3E0,stroke:#FFA726,color:#E65100
    classDef data fill:#E8F5E9,stroke:#66BB6A,color:#1B5E20
```
