# nullisxyz/nexum architecture

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

- Interactive diagram: https://gitdiagram.com/nullisxyz/nexum
- Repository: https://github.com/nullisxyz/nexum

## Overview

##### Main Components

a) Browser Extension Components:
- Browser UI (Frontend)
- Worker (Background Service)
- Injected Provider
- Chrome Extension System

b) Terminal Interface:
- RPC Server
- CLI Interface

c) Core Components:
- Primitives (Shared Core Types)
- WebTransport Layer
- Ethereum Interface Layer

- Web Extension |  |  Core Services  |  | Terminal Client |

##### Detailed Component Breakdown

Web Extension Section:

- Browser UI         |
- Components           |
- Panels              |
- Pages               |

- ↕

- Worker             |
- State Management     |
- Event Handling      |
- Provider Logic      |

- ↕

- Injected Provider    |
- EIP-1193 Interface  |
- EIP-6963 Support    |

Core Services Section:

- Primitives         |
- Protocol Definitions |
- Frame Types         |

- ↕

- WebTransport Layer  |

Terminal Client Section:

- RPC Server        |
- ETH Namespace       |
- NET Namespace       |
- Web3 Namespace      |
- Wallet Namespace    |

##### Connection Flow Indicators

- → Synchronous communications
- ⇢ Asynchronous communications
- ⇄ Bidirectional data flow

##### Important Implementation Details to Highlight

- EIP-1193 and EIP-6963 compliance points
- WebTransport connection paths
- State management flow
- Event handling pathways

##### Technical Stack Indicators

- Rust/WASM components
- Chrome Extension APIs
- WebTransport protocol
- Ethereum RPC interfaces

Remember to emphasize the project's unique selling points:
- High-performance Rust/WASM implementation
- Dual-mode operation (web + terminal)
- EIP compliance
- Developer-first approach

This system design should help developers understand both the high-level architecture and the specific implementation details that make Nexum unique in the Ethereum tooling ecosystem.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef comms fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white

    %% Web Extension Section
    subgraph WebExtension
        BrowserUI["Browser UI"]
        subgraph BrowserUIComponents
            Components["Components"]
            Panels["Panels"]
            Pages["Pages"]
        end
        Worker["Worker Service"]
        subgraph WorkerComponents
            StateManagement["State Management"]
            EventHandling["Event Handling"]
            ProviderLogic["Provider Logic"]
        end
        InjectedProvider["Injected Provider"]
        subgraph InjectedComponents
            EIP6963["EIP-6963 Support"]
            ProviderImpl["Provider Implementation"]
        end
        ChromeExt["Chrome Extension System"]
        subgraph ChromeComponents
            Runtime["Runtime Interface"]
            Tabs["Tabs Management"]
        end
    end

    %% Core Services Section
    subgraph CoreServices
        Primitives["Core Primitives"]
        subgraph PrimitivesComponents
            Protocol["Protocol Definitions"]
            Frames["Frame Types"]
        end
        WebTransport["WebTransport Layer"]
    end

    %% Terminal Client Section
    subgraph TerminalClient
        RPCServer["RPC Server"]
        subgraph Namespaces
            ETH["ETH Namespace"]
            NET["NET Namespace"]
            Web3["Web3 Namespace"]
            Wallet["Wallet Namespace"]
        end
        TUI["Terminal Interface"]
    end

    %% Relationships
    BrowserUI --> Worker
    Worker --> InjectedProvider
    Worker --> ChromeExt
    Worker --> WebTransport
    InjectedProvider --> WebTransport
    WebTransport --> RPCServer
    Primitives --> WebTransport
    TUI --> RPCServer

    %% Component Grouping
    BrowserUIComponents --> BrowserUI
    WorkerComponents --> Worker
    InjectedComponents --> InjectedProvider
    ChromeComponents --> ChromeExt
    PrimitivesComponents --> Primitives
    Namespaces --> RPCServer

    %% Click Events
    click BrowserUI "https://github.com/nullisxyz/nexum/tree/main/crates/extension/browser-ui/src"
    click Components "https://github.com/nullisxyz/nexum/tree/main/crates/extension/browser-ui/src/components"
    click Panels "https://github.com/nullisxyz/nexum/tree/main/crates/extension/browser-ui/src/panels"
    click Pages "https://github.com/nullisxyz/nexum/tree/main/crates/extension/browser-ui/src/pages"
    click Worker "https://github.com/nullisxyz/nexum/tree/main/crates/extension/worker/src"
    click StateManagement "https://github.com/nullisxyz/nexum/blob/main/crates/extension/worker/src/state.rs"
    click EventHandling "https://github.com/nullisxyz/nexum/tree/main/crates/extension/worker/src/events"
    click ProviderLogic "https://github.com/nullisxyz/nexum/blob/main/crates/extension/worker/src/provider.rs"
    click InjectedProvider "https://github.com/nullisxyz/nexum/tree/main/crates/extension/injected/src"
    click EIP6963 "https://github.com/nullisxyz/nexum/blob/main/crates/extension/injected/src/eip6963.rs"
    click ProviderImpl "https://github.com/nullisxyz/nexum/blob/main/crates/extension/injected/src/provider.rs"
    click ChromeExt "https://github.com/nullisxyz/nexum/tree/main/crates/extension/chrome-sys/src"
    click Runtime "https://github.com/nullisxyz/nexum/blob/main/crates/extension/chrome-sys/src/runtime.rs"
    click Tabs "https://github.com/nullisxyz/nexum/blob/main/crates/extension/chrome-sys/src/tabs.rs"
    click RPCServer "https://github.com/nullisxyz/nexum/blob/main/bin/rpc/src/main.rs"
    click ETH "https://github.com/nullisxyz/nexum/blob/main/bin/rpc/src/namespaces/eth.rs"
    click NET "https://github.com/nullisxyz/nexum/blob/main/bin/rpc/src/namespaces/net.rs"
    click Web3 "https://github.com/nullisxyz/nexum/blob/main/bin/rpc/src/namespaces/web3.rs"
    click Wallet "https://github.com/nullisxyz/nexum/blob/main/bin/rpc/src/namespaces/wallet.rs"
    click Primitives "https://github.com/nullisxyz/nexum/tree/main/crates/primitives/src"
    click Protocol "https://github.com/nullisxyz/nexum/blob/main/crates/primitives/src/protocol.rs"
    click Frames "https://github.com/nullisxyz/nexum/blob/main/crates/primitives/src/frame.rs"
    click TUI "https://github.com/nullisxyz/nexum/tree/main/crates/tui"

    %% Style Applications
    class BrowserUI,Components,Panels,Pages ui
    class Primitives,Protocol,Frames core
    class WebTransport comms
    class ChromeExt,Runtime,Tabs external

    %% Legend
    subgraph Legend
        UI["UI Components"]:::ui
        Core["Core Services"]:::core
        Comms["Communication Layer"]:::comms
        Ext["External Systems"]:::external
    end
```
