# h8ngrydev4hire/notate architecture

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

- Interactive diagram: https://gitdiagram.com/h8ngrydev4hire/notate
- Repository: https://github.com/h8ngrydev4hire/notate

## Overview

##### Main System Components

a. Frontend Layer:
- New Tab Interface (Notate.jsx)
- Content Scripts (content.jsx)
- Component System
- Editor
- Related Notes Viewer
- Settings Modal
- Context Menu
- Text Editor

b. Application Layer:
- Background Service Worker
- Core Services
- Management
- Notebook Management
- Configuration Management
- Related Notes Algorithm Engine

c. Data Layer:
- IndexedDB Storage
- Chrome Storage API
- Data Models (Notes, Notebooks, Configuration)

d. Browser Integration Layer:
- Chrome Extension API
- Firefox Extension API (in progress)

##### Component Relationships

**User Interface ←→ Application Layer ←→ Data Layer**
- ↑                 ↑

- ↓                 ↓
**Browser Integration ←→ Background Service**

##### Specific Implementation Details

Key architectural elements:

a. Frontend Components:
- UI state management flow
- Event handling paths

b. Service Architecture:
- Background script communication channels
- Core service interactions
- Browser API integration points

c. Data Flow:
- Storage operations
- Synchronization
- Configuration management

##### Key Features to Highlight

Architectural features:

- Real-time note synchronization
- Related notes algorithm processing
- Browser extension integration points
- Storage reconciliation system

##### Technical Stack Integration

How these technologies interact:
**React.js ←→ Background Services ←→ IndexedDB**
- ↑              ↑                   ↑

**TailwindCSS  Chrome API        Storage Handlers**

##### Development Workflow

A separate section showing:
- Webpack build process
- Development vs Production paths
- Browser-specific compilation

Remember to highlight the extension-specific architecture patterns, particularly the separation between content scripts, background services, and the new tab interface, as these are crucial to understanding the browser extension architecture.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Frontend
        NT["New Tab Interface"]
        CS["Content Scripts"]
        
        subgraph Components
            NE["Note Editor"]
            RNV["Related Notes Viewer"]
            SM["Settings Modal"]
            CM["Context Menu"]
            TE["Text Editor"]
        end
        
        NT --> Components
        CS --> Components
    end

    subgraph Application
        BSW["Background Service Worker"]
        
        subgraph CoreServices
            NM["Note Management"]
            NBM["Notebook Management"]
            CFM["Configuration Management"]
            RNA["Related Notes Algorithm"]
        end
        
        BSW --> CoreServices
    end

    subgraph DataLayer
        IDB[(IndexedDB Storage)]
        CS_API[(Chrome Storage API)]
        
        subgraph DataModels
            Notes[("Notes")]
            Notebooks[("Notebooks")]
            Config[("Configuration")]
        end
    end

    subgraph BrowserIntegration
        CEA["Chrome Extension API"]
        FEA["Firefox Extension API"]
        EM["Environment Management"]
        BT["Browser Type"]
    end

    Frontend <--> Application
    Application <--> DataLayer
    Frontend --> BrowserIntegration
    Application --> BrowserIntegration
    
    %% Component Mappings
    click NT "https://github.com/h8ngrydev4hire/notate/blob/main/src/Notate/Notate.jsx"
    click CS "https://github.com/h8ngrydev4hire/notate/blob/main/src/Content/content.jsx"
    click NE "https://github.com/h8ngrydev4hire/notate/blob/main/src/Content/Components/NoteEditor/NoteEditor.jsx"
    click RNV "https://github.com/h8ngrydev4hire/notate/blob/main/src/Content/Components/RelatedNotesViewer/RelatedNotesViewer.jsx"
    click SM "https://github.com/h8ngrydev4hire/notate/blob/main/src/Content/Components/Modals/SettingsModal/SettingsModal.jsx"
    click CM "https://github.com/h8ngrydev4hire/notate/blob/main/src/Content/Components/ContextMenu/ContextMenu.jsx"
    click TE "https://github.com/h8ngrydev4hire/notate/blob/main/src/Universal/Components/TextEditor/TextEditor.jsx"
    click BSW "https://github.com/h8ngrydev4hire/notate/blob/main/src/Background/background.js"
    click CoreServices "https://github.com/h8ngrydev4hire/notate/blob/main/src/Background/Utils/coreService.js"
    click NM "https://github.com/h8ngrydev4hire/notate/blob/main/src/Universal/Handlers/NoteHandler.js"
    click NBM "https://github.com/h8ngrydev4hire/notate/blob/main/src/Universal/Handlers/NotebookHandler.js"
    click CFM "https://github.com/h8ngrydev4hire/notate/blob/main/src/Universal/Handlers/ConfigurationHandlers/ConfigurationHandler.js"
    click RNA "https://github.com/h8ngrydev4hire/notate/blob/main/src/Content/Components/RelatedNotesViewer/algorithms/RelatedNotesAlgoritm.js"
    click IDB "https://github.com/h8ngrydev4hire/notate/blob/main/src/Universal/Handlers/IdbHandler.js"
    click BT "https://github.com/h8ngrydev4hire/notate/blob/main/src/Background/Utils/browserType.js"
    click EM "https://github.com/h8ngrydev4hire/notate/blob/main/src/Background/Utils/environment.js"

    classDef frontend fill:#3b82f6,color:white
    classDef application fill:#22c55e,color:white
    classDef data fill:#eab308,color:white
    classDef browser fill:#a855f7,color:white
    
    class NT,CS,NE,RNV,SM,CM,TE frontend
    class BSW,NM,NBM,CFM,RNA application
    class IDB,CS_API,Notes,Notebooks,Config data
    class CEA,FEA,EM,BT browser

    %% Legend
    subgraph Legend
        F[Frontend]:::frontend
        A[Application]:::application
        D[Data Storage]:::data
        B[Browser Integration]:::browser
    end
```
