# brannondorsey/chattervox architecture

> Architecture diagram of the GitHub repository brannondorsey/chattervox, 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/brannondorsey/chattervox
- Repository: https://github.com/brannondorsey/chattervox

## Overview

##### Main Components

a. Core Components:
- Terminal Node Controller (TNC) Interface
- Packet Processing System
- Cryptographic System
- Compression System
- Command Line Interface
- Chat UI System

b. External Components:
- Radio Hardware
- Direwolf TNC Software
- File System (for config and keys)

- CLI Tools    |     |    Chat UI      |

- Messenger   |    |    Keystore    |    | Compression  |

- Packet Handler      |

- Direwolf TNC  |    |    Radio     |

##### Important Details

a. Protocol Specifics:
- Packet structure (16-bit magic header, version byte, flags, etc.)
- Compression and digital signature paths

b. File System Integration:
- Config file location (~/.chattervox/config.json)
- Key storage system

c. Subcommand Structure:
- How different commands (chat, send, receive, etc.) interact with the system

##### Implementation Notes

- The modular nature of the codebase (as seen in the src/subcommands structure)
- The separation between UI, core logic, and hardware interfaces
- The security layer with ECDSA signatures
- The compression system's optional nature

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef security fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef storage fill:#9b59b6,stroke:#8e44ad,color:white

    %% User Interface Layer
    subgraph UI
        CLI["Command Line Interface"]
        ChatUI["Chat UI System"]
        KeyCommands["Key Management Commands"]
        CommCommands["Communication Commands"]
    end

    %% Core Services Layer
    subgraph Core
        Messenger["Messenger Service"]
        Keystore["Keystore"]
        Compression["Compression System"]
        PacketHandler["Packet Processing"]
        Config["Configuration Manager"]
    end

    %% External Layer
    subgraph External
        TNC["Direwolf TNC"]
        Radio["Radio Hardware"]
        FileSystem["File System"]
    end

    %% Relationships
    CLI --> KeyCommands
    CLI --> CommCommands
    KeyCommands --> Keystore
    CommCommands --> Messenger
    ChatUI --> Messenger
    Messenger --> PacketHandler
    Messenger --> Compression
    Messenger --> Keystore
    PacketHandler --> TNC
    TNC --> Radio
    Keystore --> FileSystem
    Config --> FileSystem

    %% Click Events
    click CLI "https://github.com/brannondorsey/chattervox/tree/master/src/subcommands/"
    click ChatUI "https://github.com/brannondorsey/chattervox/blob/master/src/ui/chat.ts"
    click Messenger "https://github.com/brannondorsey/chattervox/blob/master/src/Messenger.ts"
    click Keystore "https://github.com/brannondorsey/chattervox/blob/master/src/Keystore.ts"
    click Compression "https://github.com/brannondorsey/chattervox/blob/master/src/compression.ts"
    click PacketHandler "https://github.com/brannondorsey/chattervox/blob/master/src/Packet.ts"
    click Config "https://github.com/brannondorsey/chattervox/blob/master/src/config.ts"
    click KeyCommands "https://github.com/brannondorsey/chattervox/blob/master/src/subcommands/addkey.ts"
    click CommCommands "https://github.com/brannondorsey/chattervox/blob/master/src/subcommands/chat.ts"

    %% Style Applications
    class CLI,ChatUI,KeyCommands,CommCommands ui
    class Messenger,PacketHandler,Compression,Config core
    class Keystore security
    class TNC,Radio,FileSystem external

    %% Legend
    subgraph Legend
        UI_L["UI Components"]:::ui
        Core_L["Core Components"]:::core
        Security_L["Security Components"]:::security
        External_L["External Systems"]:::external
    end
```
