# infinc/ascii-generator architecture

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

- Interactive diagram: https://gitdiagram.com/infinc/ascii-generator
- Repository: https://github.com/infinc/ascii-generator

## Overview

This repository combines a Python CLI for image/ASCII-art conversion and two chat modes, plus a browser-based converter and Achex chat client. The main workflow is image input → ASCII-art generation or restoration; users can also join an Achex room or use nearby BLE chat. The graph preserves documented GIF playback, file-sharing, HEIC, and BLE capabilities. Some subsystem links rely on README descriptions or the SOURCE INDEX; unsampled internals are not expanded beyond that evidence.

Main entry points: [`web/public/js/main.js`](https://github.com/infinc/ascii-generator/blob/main/web/public/js/main.js) (App Controller), [`web/public/js/commands.js`](https://github.com/infinc/ascii-generator/blob/main/web/public/js/commands.js) (Chat Commands), [`main.py`](https://github.com/infinc/ascii-generator/blob/main/main.py) (Python CLI), [`chat_functions.py`](https://github.com/infinc/ascii-generator/blob/main/chat_functions.py) (Chat Commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_python_art["Python Art Tools"]
  node_python_entry["Python CLI<br/>[main.py]"]
  node_python_art_ops["Art Operations<br/>[functions.py]"]
end

subgraph group_python_chat["Python Chat"]
  node_chat_loop["Chat Commands<br/>[chat_functions.py]"]
  node_transport_api["Transport API<br/>[chat_transport.py]"]
  node_ble_chat["BLE Chat<br/>[ble_chat.py]"]
  node_ble_link["BLE Link<br/>[ble_link.py]"]
end

subgraph group_browser["Browser App"]
  node_web_main["App Controller<br/>[main.js]"]
  node_web_landing["Landing UI<br/>[landing.js]"]
  node_web_commands["Chat Commands<br/>[commands.js]"]
  node_web_protocol["Chat Protocol<br/>[protocol.js]"]
  node_web_achex["Achex Client<br/>[achex.js]"]
  node_web_image["Image Pipeline<br/>[image.js]"]
  node_web_heic["HEIC Decoder<br/>[heic.js]"]
  node_web_ascii["ASCII Conversion<br/>[ascii.js]"]
  node_web_ui["Chat UI<br/>[ui.js]"]
  node_web_ansi["ANSI Renderer<br/>[ansi.js]"]
end

subgraph group_ble_security["BLE Security"]
  node_room_crypto["Room Crypto<br/>[RoomCrypto.swift]"]
end

node_cli_user(("CLI User"))
node_chat_user(("Chat User"))
node_achex_service{{"Achex Service"}}
node_web_user(("Browser User"))

node_cli_user -->|"starts"| node_python_entry
node_python_entry -->|"uses"| node_python_art_ops
node_python_entry -->|"starts chat"| node_chat_loop
node_python_entry -->|"starts BLE"| node_ble_chat
node_python_entry -->|"requests conversion"| node_python_art_ops
node_chat_user -->|"sends commands"| node_chat_loop
node_chat_loop -->|"uses transport"| node_transport_api
node_transport_api -->|"connects by WebSocket"| node_achex_service
node_chat_loop -->|"generates or restores"| node_python_art_ops
node_ble_chat -->|"reuses commands"| node_chat_loop
node_ble_chat -->|"implements transport"| node_transport_api
node_ble_chat -->|"uses BLE link"| node_ble_link
node_web_user -->|"uses app"| node_web_main
node_web_main -->|"starts landing"| node_web_landing
node_web_main -->|"dispatches commands"| node_web_commands
node_web_main -->|"routes incoming data"| node_web_protocol
node_web_main -->|"connects and authenticates"| node_web_achex
node_web_main -->|"updates interface"| node_web_ui
node_web_main -->|"checks image files"| node_web_image
node_web_commands -->|"sends payloads"| node_web_protocol
node_web_commands -->|"converts images"| node_web_image
node_web_commands -->|"restores PNG"| node_web_ascii
node_web_commands -->|"checks HEIC"| node_web_heic
node_web_commands -->|"renders command results"| node_web_ui
node_web_protocol -->|"renders incoming messages"| node_web_ui
node_web_image -->|"generates art"| node_web_ascii
node_web_image -->|"decodes HEIC"| node_web_heic
node_web_ui -->|"renders ANSI"| node_web_ansi
node_web_achex -->|"connects by WebSocket"| node_achex_service

click node_python_entry "https://github.com/infinc/ascii-generator/blob/main/main.py"
click node_python_art_ops "https://github.com/infinc/ascii-generator/blob/main/functions.py"
click node_chat_loop "https://github.com/infinc/ascii-generator/blob/main/chat_functions.py"
click node_transport_api "https://github.com/infinc/ascii-generator/blob/main/chat_transport.py"
click node_ble_chat "https://github.com/infinc/ascii-generator/blob/main/ble_chat.py"
click node_ble_link "https://github.com/infinc/ascii-generator/blob/main/ble_link.py"
click node_web_main "https://github.com/infinc/ascii-generator/blob/main/web/public/js/main.js"
click node_web_landing "https://github.com/infinc/ascii-generator/blob/main/web/public/js/landing.js"
click node_web_commands "https://github.com/infinc/ascii-generator/blob/main/web/public/js/commands.js"
click node_web_protocol "https://github.com/infinc/ascii-generator/blob/main/web/public/js/protocol.js"
click node_web_achex "https://github.com/infinc/ascii-generator/blob/main/web/public/js/achex.js"
click node_web_image "https://github.com/infinc/ascii-generator/blob/main/web/public/js/image.js"
click node_web_heic "https://github.com/infinc/ascii-generator/blob/main/web/public/js/heic.js"
click node_web_ascii "https://github.com/infinc/ascii-generator/blob/main/web/public/js/ascii.js"
click node_web_ui "https://github.com/infinc/ascii-generator/blob/main/web/public/js/ui.js"
click node_web_ansi "https://github.com/infinc/ascii-generator/blob/main/web/public/js/ansi.js"
click node_room_crypto "https://github.com/infinc/ascii-generator/blob/main/ios/BLEChat/BLEChat/Protocol/RoomCrypto.swift"

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_python_entry,node_python_art_ops,node_cli_user,node_chat_user,node_web_user toneBlue
class node_chat_loop,node_transport_api,node_ble_chat,node_ble_link toneAmber
class node_web_main,node_web_landing,node_web_commands,node_web_protocol,node_web_achex,node_web_image,node_web_heic,node_web_ascii,node_web_ui,node_web_ansi toneMint
class node_room_crypto toneRose
class node_achex_service toneIndigo
```

## Components

### Python Art Tools

- [Python CLI](https://github.com/infinc/ascii-generator/blob/main/main.py): `main.py`
- [Art Operations](https://github.com/infinc/ascii-generator/blob/main/functions.py): `functions.py`

### Python Chat

- [Chat Commands](https://github.com/infinc/ascii-generator/blob/main/chat_functions.py): `chat_functions.py`
- [Transport API](https://github.com/infinc/ascii-generator/blob/main/chat_transport.py): `chat_transport.py`
- [BLE Chat](https://github.com/infinc/ascii-generator/blob/main/ble_chat.py): `ble_chat.py`
- [BLE Link](https://github.com/infinc/ascii-generator/blob/main/ble_link.py): `ble_link.py`

### Browser App

- [App Controller](https://github.com/infinc/ascii-generator/blob/main/web/public/js/main.js): `web/public/js/main.js`
- [Landing UI](https://github.com/infinc/ascii-generator/blob/main/web/public/js/landing.js): `web/public/js/landing.js`
- [Chat Commands](https://github.com/infinc/ascii-generator/blob/main/web/public/js/commands.js): `web/public/js/commands.js`
- [Chat Protocol](https://github.com/infinc/ascii-generator/blob/main/web/public/js/protocol.js): `web/public/js/protocol.js`
- [Achex Client](https://github.com/infinc/ascii-generator/blob/main/web/public/js/achex.js): `web/public/js/achex.js`
- [Image Pipeline](https://github.com/infinc/ascii-generator/blob/main/web/public/js/image.js): `web/public/js/image.js`
- [HEIC Decoder](https://github.com/infinc/ascii-generator/blob/main/web/public/js/heic.js): `web/public/js/heic.js`
- [ASCII Conversion](https://github.com/infinc/ascii-generator/blob/main/web/public/js/ascii.js): `web/public/js/ascii.js`
- [Chat UI](https://github.com/infinc/ascii-generator/blob/main/web/public/js/ui.js): `web/public/js/ui.js`
- [ANSI Renderer](https://github.com/infinc/ascii-generator/blob/main/web/public/js/ansi.js): `web/public/js/ansi.js`

### BLE Security

- [Room Crypto](https://github.com/infinc/ascii-generator/blob/main/ios/BLEChat/BLEChat/Protocol/RoomCrypto.swift): `ios/BLEChat/BLEChat/Protocol/RoomCrypto.swift`

### Other components

- **CLI User**
- **Chat User**
- **Achex Service**
- **Browser User**

## Connections

- CLI User → Python CLI: starts (evidence: `README.md`)
- Python CLI → Art Operations: uses (evidence: `main.py`)
- Python CLI → Chat Commands: starts chat (evidence: `main.py`)
- Python CLI → BLE Chat: starts BLE (evidence: `main.py`)
- Python CLI → Art Operations: requests conversion (evidence: `README.md`)
- Chat User → Chat Commands: sends commands (evidence: `README.md`)
- Chat Commands → Transport API: uses transport (evidence: `chat_functions.py`)
- Transport API → Achex Service: connects by WebSocket (evidence: `README.md`)
- Chat Commands → Art Operations: generates or restores (evidence: `chat_functions.py`)
- BLE Chat → Chat Commands: reuses commands (evidence: `ble_chat.py`)
- BLE Chat → Transport API: implements transport (evidence: `ble_chat.py`)
- BLE Chat → BLE Link: uses BLE link (evidence: `ble_chat.py`)
- Browser User → App Controller: uses app (evidence: `README.md`)
- App Controller → Landing UI: starts landing (evidence: `web/public/js/main.js`)
- App Controller → Chat Commands: dispatches commands (evidence: `web/public/js/main.js`)
- App Controller → Chat Protocol: routes incoming data (evidence: `web/public/js/main.js`)
- App Controller → Achex Client: connects and authenticates (evidence: `web/public/js/main.js`)
- App Controller → Chat UI: updates interface (evidence: `web/public/js/main.js`)
- App Controller → Image Pipeline: checks image files (evidence: `web/public/js/main.js`)
- Chat Commands → Chat Protocol: sends payloads (evidence: `web/public/js/commands.js`)
- Chat Commands → Image Pipeline: converts images (evidence: `web/public/js/commands.js`)
- Chat Commands → ASCII Conversion: restores PNG (evidence: `web/public/js/commands.js`)
- Chat Commands → HEIC Decoder: checks HEIC (evidence: `web/public/js/commands.js`)
- Chat Commands → Chat UI: renders command results (evidence: `web/public/js/commands.js`)
- Chat Protocol → Chat UI: renders incoming messages (evidence: `web/public/js/protocol.js`)
- Image Pipeline → ASCII Conversion: generates art (evidence: `web/public/js/image.js`)
- Image Pipeline → HEIC Decoder: decodes HEIC (evidence: `web/public/js/image.js`)
- Chat UI → ANSI Renderer: renders ANSI (evidence: `web/public/js/ui.js`)
- Achex Client → Achex Service: connects by WebSocket (evidence: `README.md`)
