# vrushang1234/frnd architecture

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

- Interactive diagram: https://gitdiagram.com/vrushang1234/frnd
- Repository: https://github.com/vrushang1234/frnd

## Overview

FRND connects victims and rescue operators over a local WiFi mesh and WebSocket relay, with a local LLM providing overflow auto-replies. The main workflow is victim connection and messaging, relay routing, operator monitoring/reply, and optional AI assistance. The README documents mesh setup and edge AI, while the provided source samples show terminal and relay behavior; no mesh setup call into the relay is evidenced, so that link is omitted.

Main entry points: [`emergency-terminal/src/App.jsx`](https://github.com/vrushang1234/frnd/blob/main/emergency-terminal/src/App.jsx) (Rescue session state), [`mesh-network/websocket.py`](https://github.com/vrushang1234/frnd/blob/main/mesh-network/websocket.py) (WebSocket relay), [`frnd-terminal/src/Components/ChatBox/ChatBox.jsx`](https://github.com/vrushang1234/frnd/blob/main/frnd-terminal/src/Components/ChatBox/ChatBox.jsx) (Victim chat UI), [`frnd-terminal/src/App.jsx`](https://github.com/vrushang1234/frnd/blob/main/frnd-terminal/src/App.jsx) (Victim terminal shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_network["Mesh and Relay"]
  node_mesh["WiFi mesh access points<br/>[hotspot_linux.py]"]
  node_relay["WebSocket relay<br/>[websocket.py]"]
end

subgraph group_victim["Victim Terminal"]
  node_victim_app["Victim chat UI<br/>[ChatBox.jsx]"]
  node_victim_shell["Victim terminal shell<br/>[App.jsx]"]
  node_victim_nav["Victim status bar<br/>[navbar.jsx]"]
end

subgraph group_rescue["Rescue Terminal"]
  node_rescue_app["Rescue session state<br/>[App.jsx]"]
  node_user_list["Victim roster<br/>[UserList.jsx]"]
  node_chat_panel["Operator chat panel<br/>[ChatPanel.jsx]"]
  node_rescue_nav["Rescue status bar<br/>[navbar.jsx]"]
end

subgraph group_ai["Edge Assistance"]
  node_llm_service["Local LLM HTTP service<br/>[llm-server.py]"]
  node_edge_ai["On-device LLM inference"]
end

node_victim(("Victim"))
node_operator(("Rescue operator"))

node_victim -->|"sends messages"| node_victim_app
node_victim_app -->|"sends WebSocket"| node_relay
node_relay -->|"relays replies"| node_victim_app
node_victim_app -->|"reports status"| node_victim_shell
node_victim_shell -->|"passes status"| node_victim_nav
node_operator -->|"monitors and replies"| node_rescue_app
node_rescue_app -->|"sends WebSocket"| node_relay
node_relay -->|"relays messages"| node_rescue_app
node_rescue_app -->|"supplies roster"| node_user_list
node_rescue_app -->|"supplies chat state"| node_chat_panel
node_rescue_app -->|"supplies status"| node_rescue_nav
node_mesh -.->|"provides WiFi access"| node_victim
node_rescue_app -->|"requests auto-reply"| node_llm_service
node_llm_service -->|"queries inference"| node_edge_ai
node_rescue_app -->|"sends AI reply"| node_relay

click node_mesh "https://github.com/vrushang1234/frnd/blob/main/mesh-network/hotspot_linux.py"
click node_relay "https://github.com/vrushang1234/frnd/blob/main/mesh-network/websocket.py"
click node_victim_app "https://github.com/vrushang1234/frnd/blob/main/frnd-terminal/src/Components/ChatBox/ChatBox.jsx"
click node_victim_shell "https://github.com/vrushang1234/frnd/blob/main/frnd-terminal/src/App.jsx"
click node_victim_nav "https://github.com/vrushang1234/frnd/blob/main/frnd-terminal/src/Components/Navbar/navbar.jsx"
click node_rescue_app "https://github.com/vrushang1234/frnd/blob/main/emergency-terminal/src/App.jsx"
click node_user_list "https://github.com/vrushang1234/frnd/blob/main/emergency-terminal/src/Components/UserList/UserList.jsx"
click node_chat_panel "https://github.com/vrushang1234/frnd/blob/main/emergency-terminal/src/Components/ChatPanel/ChatPanel.jsx"
click node_rescue_nav "https://github.com/vrushang1234/frnd/blob/main/emergency-terminal/src/Components/Navbar/navbar.jsx"
click node_llm_service "https://github.com/vrushang1234/frnd/blob/main/emergency-terminal/llm-server.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mesh,node_relay toneBlue
class node_victim_app,node_victim_shell,node_victim_nav toneAmber
class node_rescue_app,node_user_list,node_chat_panel,node_rescue_nav toneMint
class node_llm_service,node_edge_ai toneRose
class node_victim,node_operator toneIndigo
```

## Components

### Mesh and Relay

- [WiFi mesh access points](https://github.com/vrushang1234/frnd/blob/main/mesh-network/hotspot_linux.py): `mesh-network/hotspot_linux.py`
- [WebSocket relay](https://github.com/vrushang1234/frnd/blob/main/mesh-network/websocket.py): `mesh-network/websocket.py`

### Victim Terminal

- [Victim chat UI](https://github.com/vrushang1234/frnd/blob/main/frnd-terminal/src/Components/ChatBox/ChatBox.jsx): `frnd-terminal/src/Components/ChatBox/ChatBox.jsx`
- [Victim terminal shell](https://github.com/vrushang1234/frnd/blob/main/frnd-terminal/src/App.jsx): `frnd-terminal/src/App.jsx`
- [Victim status bar](https://github.com/vrushang1234/frnd/blob/main/frnd-terminal/src/Components/Navbar/navbar.jsx): `frnd-terminal/src/Components/Navbar/navbar.jsx`

### Rescue Terminal

- [Rescue session state](https://github.com/vrushang1234/frnd/blob/main/emergency-terminal/src/App.jsx): `emergency-terminal/src/App.jsx`
- [Victim roster](https://github.com/vrushang1234/frnd/blob/main/emergency-terminal/src/Components/UserList/UserList.jsx): `emergency-terminal/src/Components/UserList/UserList.jsx`
- [Operator chat panel](https://github.com/vrushang1234/frnd/blob/main/emergency-terminal/src/Components/ChatPanel/ChatPanel.jsx): `emergency-terminal/src/Components/ChatPanel/ChatPanel.jsx`
- [Rescue status bar](https://github.com/vrushang1234/frnd/blob/main/emergency-terminal/src/Components/Navbar/navbar.jsx): `emergency-terminal/src/Components/Navbar/navbar.jsx`

### Edge Assistance

- [Local LLM HTTP service](https://github.com/vrushang1234/frnd/blob/main/emergency-terminal/llm-server.py): `emergency-terminal/llm-server.py`
- **On-device LLM inference**

### Other components

- **Victim**
- **Rescue operator**

## Connections

- Victim → Victim chat UI: sends messages (evidence: `frnd-terminal/src/Components/ChatBox/ChatBox.jsx`)
- Victim chat UI → WebSocket relay: sends WebSocket (evidence: `frnd-terminal/src/Components/ChatBox/ChatBox.jsx`)
- WebSocket relay → Victim chat UI: relays replies (evidence: `mesh-network/websocket.py`)
- Victim chat UI → Victim terminal shell: reports status (evidence: `frnd-terminal/src/App.jsx`)
- Victim terminal shell → Victim status bar: passes status (evidence: `frnd-terminal/src/App.jsx`)
- Rescue operator → Rescue session state: monitors and replies (evidence: `emergency-terminal/src/App.jsx`)
- Rescue session state → WebSocket relay: sends WebSocket (evidence: `emergency-terminal/src/App.jsx`)
- WebSocket relay → Rescue session state: relays messages (evidence: `mesh-network/websocket.py`)
- Rescue session state → Victim roster: supplies roster (evidence: `emergency-terminal/src/App.jsx`)
- Rescue session state → Operator chat panel: supplies chat state (evidence: `emergency-terminal/src/App.jsx`)
- Rescue session state → Rescue status bar: supplies status (evidence: `emergency-terminal/src/App.jsx`)
- WiFi mesh access points → Victim: provides WiFi access (evidence: `README.md`)
- Rescue session state → Local LLM HTTP service: requests auto-reply (evidence: `emergency-terminal/src/App.jsx`)
- Local LLM HTTP service → On-device LLM inference: queries inference (evidence: `emergency-terminal/llm-server.py`)
- Rescue session state → WebSocket relay: sends AI reply (evidence: `emergency-terminal/src/App.jsx`)
