# anup8571/termblitz architecture

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

- Interactive diagram: https://gitdiagram.com/anup8571/termblitz
- Repository: https://github.com/anup8571/termblitz

## Overview

Termblitz is a terminal web browser for mobile and desktop terminals. Its main workflow turns keyboard or touch input into navigation and browsing actions, selects a native or Chromium-backed rendering mode, and draws the resulting page in the terminal. The README also describes ad blocking, mobile reflow, image upscaling, and multiple terminal graphics protocols. The excerpts show the core modules and some wiring; details of unsampled implementation are represented only where the README documents them.

Main entry points: [`src/renderer.rs`](https://github.com/anup8571/termblitz/blob/main/src/renderer.rs) (Cell & graphics renderer), [`src/main.rs`](https://github.com/anup8571/termblitz/blob/main/src/main.rs) (Mode & navigation), [`src/engine.rs`](https://github.com/anup8571/termblitz/blob/main/src/engine.rs) (Chromium hybrid), [`src/input.rs`](https://github.com/anup8571/termblitz/blob/main/src/input.rs) (Keys & gestures)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Input &amp; orchestration"]
  node_input_handler["Keys &amp; gestures<br/>[input.rs]"]
  node_browser_orchestrator["Mode &amp; navigation<br/>[main.rs]"]
end

subgraph group_browsing["Page engines"]
  node_native_engine["Native parser<br/>[engine.rs]"]
  node_cdp_engine["Chromium hybrid<br/>[engine.rs]"]
  node_page_transform["Mobile reflow &amp; shield<br/>[engine.rs]"]
end

subgraph group_output["Terminal output"]
  node_upscaler["Image upscaling<br/>[upscale.rs]"]
  node_terminal_renderer["Cell &amp; graphics renderer<br/>[renderer.rs]"]
end

subgraph group_presentation["Web presentation"]
  node_web_entry["Web app entry<br/>[main.tsx]"]
  node_web_app["Product showcase<br/>[App.tsx]"]
end

node_browser_user(("Browser user"))
node_chromium["Headless Chromium"]
node_terminal(("Terminal display"))

node_browser_user -->|"enters actions"| node_input_handler
node_input_handler -->|"returns actions"| node_browser_orchestrator
node_browser_orchestrator -->|"selects mode"| node_native_engine
node_browser_orchestrator -->|"navigates pages"| node_cdp_engine
node_browser_orchestrator -->|"draws frames"| node_terminal_renderer
node_cdp_engine -->|"uses CDP"| node_chromium
node_cdp_engine -->|"applies reflow &amp; shield"| node_page_transform
node_native_engine -->|"renders page"| node_terminal_renderer
node_cdp_engine -->|"renders page"| node_terminal_renderer
node_terminal_renderer -->|"upscales assets"| node_upscaler
node_terminal_renderer -->|"writes graphics"| node_terminal
node_web_entry -->|"mounts app"| node_web_app

click node_input_handler "https://github.com/anup8571/termblitz/blob/main/src/input.rs"
click node_browser_orchestrator "https://github.com/anup8571/termblitz/blob/main/src/main.rs"
click node_native_engine "https://github.com/anup8571/termblitz/blob/main/src/engine.rs"
click node_cdp_engine "https://github.com/anup8571/termblitz/blob/main/src/engine.rs"
click node_page_transform "https://github.com/anup8571/termblitz/blob/main/src/engine.rs"
click node_upscaler "https://github.com/anup8571/termblitz/blob/main/src/upscale.rs"
click node_terminal_renderer "https://github.com/anup8571/termblitz/blob/main/src/renderer.rs"
click node_web_entry "https://github.com/anup8571/termblitz/blob/main/src/main.tsx"
click node_web_app "https://github.com/anup8571/termblitz/blob/main/src/App.tsx"

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_input_handler,node_browser_orchestrator,node_browser_user toneBlue
class node_native_engine,node_cdp_engine,node_page_transform toneAmber
class node_upscaler,node_terminal_renderer toneMint
class node_web_entry,node_web_app toneRose
class node_chromium,node_terminal toneIndigo
```

## Components

### Input & orchestration

- [Keys & gestures](https://github.com/anup8571/termblitz/blob/main/src/input.rs): `src/input.rs`
- [Mode & navigation](https://github.com/anup8571/termblitz/blob/main/src/main.rs): `src/main.rs`

### Page engines

- [Native parser](https://github.com/anup8571/termblitz/blob/main/src/engine.rs): `src/engine.rs`
- [Chromium hybrid](https://github.com/anup8571/termblitz/blob/main/src/engine.rs): `src/engine.rs`
- [Mobile reflow & shield](https://github.com/anup8571/termblitz/blob/main/src/engine.rs): `src/engine.rs`

### Terminal output

- [Image upscaling](https://github.com/anup8571/termblitz/blob/main/src/upscale.rs): `src/upscale.rs`
- [Cell & graphics renderer](https://github.com/anup8571/termblitz/blob/main/src/renderer.rs): `src/renderer.rs`

### Web presentation

- [Web app entry](https://github.com/anup8571/termblitz/blob/main/src/main.tsx): `src/main.tsx`
- [Product showcase](https://github.com/anup8571/termblitz/blob/main/src/App.tsx): `src/App.tsx`

### Other components

- **Browser user**
- **Headless Chromium**
- **Terminal display**

## Connections

- Browser user → Keys & gestures: enters actions (evidence: `README.md`)
- Keys & gestures → Mode & navigation: returns actions (evidence: `src/main.rs`)
- Mode & navigation → Native parser: selects mode (evidence: `src/main.rs`)
- Mode & navigation → Chromium hybrid: navigates pages (evidence: `src/main.rs`)
- Mode & navigation → Cell & graphics renderer: draws frames (evidence: `src/main.rs`)
- Chromium hybrid → Headless Chromium: uses CDP (evidence: `README.md`)
- Chromium hybrid → Mobile reflow & shield: applies reflow & shield (evidence: `README.md`)
- Native parser → Cell & graphics renderer: renders page (evidence: `src/engine.rs`)
- Chromium hybrid → Cell & graphics renderer: renders page (evidence: `src/engine.rs`)
- Cell & graphics renderer → Image upscaling: upscales assets (evidence: `src/renderer.rs`)
- Cell & graphics renderer → Terminal display: writes graphics (evidence: `README.md`)
- Web app entry → Product showcase: mounts app (evidence: `src/main.tsx`)
