# lencx/noi architecture

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

- Interactive diagram: https://gitdiagram.com/lencx/noi
- Repository: https://github.com/lencx/noi

## Overview

##### Main Components Structure

a) Core Application Layer
- Main browser engine (Electron-based)
- Cache management system for the "Noi Cache Mode"
- Cookie isolation system

b) Extension System
- Five main extensions as separate modules:
- noi-ask
- noi-ask-custom
- noi-export-chatgpt
- noi-reset
- thinking-claude

c) Configuration Management
- Configs system showing:
- Mode management
- Proxy settings
- User configurations

d) Internationalization Layer
- Localization system supporting 15+ languages
- To the respective language resource files

##### Data Flow and Interactions

- User interface → Browser core
- Extension system → Core features
- Configuration system → Application settings
- I18n system → UI components

##### External Integration Points

Connections to:
- AI services (ChatGPT, Claude, etc.)
- GitHub for updates
- Custom sync URLs for modes
- External websites

##### Technical Details

Annotations for:
- Electron framework base
- Local storage mechanisms
- Extension API limitations
- Cookie isolation boundaries
- Cache management system

##### Component Details

For each major component, include:
**Core Browser:**
- URL handling
- Cache management
- Cookie isolation
- Theme system

**Extensions Framework:**
- API limitations
- Local storage
- Extension management

**Configuration System:**
- Mode sync
- Proxy settings
- User preferences

**I18n System:**
- Language detection
- Resource loading
- Translation management

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Core["Core Application Layer"]
        Browser["Noi Browser Core"]
        Cache["Cache Management"]
        Cookie["Cookie Isolation"]
        Theme["Theme System"]
    end

    subgraph Extensions["Extension System"]
        ExtFrame["Extension Framework"]
        Ask["noi-ask"]:::ext
        AskCustom["noi-ask-custom"]:::ext
        Export["noi-export-chatgpt"]:::ext
        Reset["noi-reset"]:::ext
        Claude["thinking-claude"]:::ext
        ExtConfig["Extension Config"]:::ext
    end

    subgraph Config["Configuration Management"]
        MainConf["Main Configuration"]:::conf
        DefaultMode["Default Mode Settings"]:::conf
        UserMode["User Mode Settings"]:::conf
        ChinaMode["China Region Settings"]:::conf
    end

    subgraph I18n["Internationalization Layer"]
        LangConfig["Language Configuration"]:::i18n
        LangRes["Language Resources"]:::i18n
        En["English"]:::i18n
        Zh["Chinese"]:::i18n
        Ja["Japanese"]:::i18n
        Ko["Korean"]:::i18n
    end

    subgraph AI["AI Integration"]
        ClaudeP["Claude Prompts"]:::ai
        ChatGPTP["ChatGPT Prompts"]:::ai
    end

    subgraph External["External Services"]
        ChatGPT["ChatGPT API"]:::ext
        ClaudeAPI["Claude API"]:::ext
        GitHub["GitHub Updates"]:::ext
        SyncURL["Custom Sync URLs"]:::ext
    end

    Browser --> Cache
    Browser --> Cookie
    Browser --> Theme
    
    ExtFrame --> Ask
    ExtFrame --> AskCustom
    ExtFrame --> Export
    ExtFrame --> Reset
    ExtFrame --> Claude
    ExtFrame --> ExtConfig
    
    MainConf --> Browser
    DefaultMode --> Browser
    UserMode --> Browser
    ChinaMode --> Browser
    
    LangConfig --> LangRes
    LangRes --> En
    LangRes --> Zh
    LangRes --> Ja
    LangRes --> Ko
    
    Ask --> ChatGPT
    Claude --> ClaudeAPI
    Browser --> GitHub
    Config --> SyncURL
    
    ClaudeP --> Claude
    ChatGPTP --> Ask

    %% Click Events
    click ExtFrame "https://github.com/lencx/Noi/tree/main/extensions"
    click Ask "https://github.com/lencx/Noi/tree/main/extensions/noi-ask"
    click AskCustom "https://github.com/lencx/Noi/tree/main/extensions/noi-ask-custom"
    click Export "https://github.com/lencx/Noi/tree/main/extensions/noi-export-chatgpt"
    click Reset "https://github.com/lencx/Noi/tree/main/extensions/noi-reset"
    click Claude "https://github.com/lencx/Noi/tree/main/extensions/thinking-claude"
    click ExtConfig "https://github.com/lencx/Noi/blob/main/extensions/noi.extensions.json"
    click MainConf "https://github.com/lencx/Noi/blob/main/configs/noi.conf.json"
    click DefaultMode "https://github.com/lencx/Noi/blob/main/configs/noi.mode.json"
    click UserMode "https://github.com/lencx/Noi/blob/main/configs/user.mode.json"
    click ChinaMode "https://github.com/lencx/Noi/blob/main/configs/noi.mode.cn.json"
    click LangConfig "https://github.com/lencx/Noi/blob/main/locales/noi.lang.json"
    click En "https://github.com/lencx/Noi/tree/main/locales/en"
    click Zh "https://github.com/lencx/Noi/tree/main/locales/zh"
    click Ja "https://github.com/lencx/Noi/tree/main/locales/ja"
    click Ko "https://github.com/lencx/Noi/tree/main/locales/ko"
    click ClaudeP "https://github.com/lencx/Noi/blob/main/prompts/claude.json"
    click ChatGPTP "https://github.com/lencx/Noi/blob/main/prompts/awesome-chatgpt.zh.json"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef ext fill:#90EE90,stroke:#333
    classDef conf fill:#FFE5B4,stroke:#333
    classDef i18n fill:#E6E6FA,stroke:#333
    classDef ai fill:#ADD8E6,stroke:#333

    %% Legend
    subgraph Legend
        L1["Core Components"]
        L2["Extensions"]:::ext
        L3["Configuration"]:::conf
        L4["Internationalization"]:::i18n
        L5["AI Integration"]:::ai
    end
```
