# liriliri/eruda architecture

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

- Interactive diagram: https://gitdiagram.com/liriliri/eruda
- Repository: https://github.com/liriliri/eruda

## Overview

Eruda is an in-page console and debugging interface for mobile browsers. The documented workflow is to load the library and call `eruda.init()`, then use its tool-based UI to inspect console output, network activity, page elements, resources, and source code, or run snippets and adjust settings. The graph includes documented tools whose wiring is not fully shown in the excerpts; those links are marked unverified rather than asserting specific calls. The sampled code confirms the UI shell, settings and styling layers, and Network’s use of the protocol adapter.

Main entry points: [`src/eruda.js`](https://github.com/liriliri/eruda/blob/master/src/eruda.js) (Eruda API), [`src/DevTools/DevTools.js`](https://github.com/liriliri/eruda/blob/master/src/DevTools/DevTools.js) (Tool Shell), [`src/Console/Console.js`](https://github.com/liriliri/eruda/blob/master/src/Console/Console.js) (Console), [`src/Network/Network.js`](https://github.com/liriliri/eruda/blob/master/src/Network/Network.js) (Network)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and UI"]
  node_eruda["Eruda API<br/>[eruda.js]"]
  node_entry["Entry Button<br/>[EntryBtn.js]"]
  node_devtools["Tool Shell<br/>[DevTools.js]"]
  node_toolbase["Tool Base<br/>[Tool.js]"]
  node_settings["Settings<br/>[Settings.js]"]
end

subgraph group_inspect["Inspection Tools"]
  node_console["Console<br/>[Console.js]"]
  node_network["Network<br/>[Network.js]"]
  node_networkdetail["Request Detail<br/>[Detail.js]"]
  node_elements["Elements<br/>[Elements.js]"]
  node_elementdetail["Element Detail<br/>[Detail.js]"]
  node_info["Page Info<br/>[Info.js]"]
end

subgraph group_resources["Resources and Code"]
  node_resources["Resources<br/>[Resources.js]"]
  node_storage["Storage<br/>[Storage.js]"]
  node_cookies["Cookies<br/>[Cookie.js]"]
  node_sources["Sources<br/>[Sources.js]"]
  node_snippets["Snippets<br/>[Snippets.js]"]
end

subgraph group_support["Shared Services"]
  node_protocol["Protocol Adapter<br/>[chobitsu.js]"]
  node_emitter["Event Bus<br/>[emitter.js]"]
  node_logger["Logger<br/>[logger.js]"]
  node_styling["Theme and CSS<br/>[evalCss.js]"]
  node_theme["Theme Definitions<br/>[themes.js]"]
  node_util["Shared Utilities<br/>[util.js]"]
end

node_developer(("Page Developer"))

node_developer -->|"calls init"| node_eruda
node_eruda -.->|"initializes"| node_entry
node_eruda -.->|"initializes"| node_devtools
node_eruda -.->|"registers tool"| node_console
node_eruda -.->|"registers tool"| node_network
node_eruda -.->|"registers tool"| node_elements
node_eruda -.->|"registers tool"| node_resources
node_eruda -.->|"registers tool"| node_sources
node_eruda -.->|"registers tool"| node_snippets
node_eruda -.->|"registers tool"| node_info
node_eruda -.->|"registers tool"| node_settings
node_devtools -->|"normalizes tools"| node_toolbase
node_network -->|"reads response body"| node_protocol
node_network -->|"uses detail view"| node_networkdetail
node_elements -->|"uses detail view"| node_elementdetail
node_resources -.->|"uses storage"| node_storage
node_resources -.->|"uses cookie view"| node_cookies
node_devtools -->|"configures shell"| node_settings
node_devtools -->|"sets theme"| node_styling
node_styling -->|"loads theme data"| node_theme
node_console -->|"configures logger"| node_logger
node_console -->|"shows on errors"| node_devtools

click node_eruda "https://github.com/liriliri/eruda/blob/master/src/eruda.js"
click node_entry "https://github.com/liriliri/eruda/blob/master/src/EntryBtn/EntryBtn.js"
click node_devtools "https://github.com/liriliri/eruda/blob/master/src/DevTools/DevTools.js"
click node_toolbase "https://github.com/liriliri/eruda/blob/master/src/DevTools/Tool.js"
click node_console "https://github.com/liriliri/eruda/blob/master/src/Console/Console.js"
click node_network "https://github.com/liriliri/eruda/blob/master/src/Network/Network.js"
click node_networkdetail "https://github.com/liriliri/eruda/blob/master/src/Network/Detail.js"
click node_elements "https://github.com/liriliri/eruda/blob/master/src/Elements/Elements.js"
click node_elementdetail "https://github.com/liriliri/eruda/blob/master/src/Elements/Detail.js"
click node_resources "https://github.com/liriliri/eruda/blob/master/src/Resources/Resources.js"
click node_storage "https://github.com/liriliri/eruda/blob/master/src/Resources/Storage.js"
click node_cookies "https://github.com/liriliri/eruda/blob/master/src/Resources/Cookie.js"
click node_sources "https://github.com/liriliri/eruda/blob/master/src/Sources/Sources.js"
click node_snippets "https://github.com/liriliri/eruda/blob/master/src/Snippets/Snippets.js"
click node_info "https://github.com/liriliri/eruda/blob/master/src/Info/Info.js"
click node_settings "https://github.com/liriliri/eruda/blob/master/src/Settings/Settings.js"
click node_protocol "https://github.com/liriliri/eruda/blob/master/src/lib/chobitsu.js"
click node_emitter "https://github.com/liriliri/eruda/blob/master/src/lib/emitter.js"
click node_logger "https://github.com/liriliri/eruda/blob/master/src/lib/logger.js"
click node_styling "https://github.com/liriliri/eruda/blob/master/src/lib/evalCss.js"
click node_theme "https://github.com/liriliri/eruda/blob/master/src/lib/themes.js"
click node_util "https://github.com/liriliri/eruda/blob/master/src/lib/util.js"

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_eruda,node_entry,node_devtools,node_toolbase,node_settings toneBlue
class node_console,node_network,node_networkdetail,node_elements,node_elementdetail,node_info toneAmber
class node_resources,node_storage,node_cookies,node_sources,node_snippets toneMint
class node_protocol,node_emitter,node_logger,node_styling,node_theme,node_util toneRose
class node_developer toneIndigo
```

## Components

### Runtime and UI

- [Eruda API](https://github.com/liriliri/eruda/blob/master/src/eruda.js): `src/eruda.js`
- [Entry Button](https://github.com/liriliri/eruda/blob/master/src/EntryBtn/EntryBtn.js): `src/EntryBtn/EntryBtn.js`
- [Tool Shell](https://github.com/liriliri/eruda/blob/master/src/DevTools/DevTools.js): `src/DevTools/DevTools.js`
- [Tool Base](https://github.com/liriliri/eruda/blob/master/src/DevTools/Tool.js): `src/DevTools/Tool.js`
- [Settings](https://github.com/liriliri/eruda/blob/master/src/Settings/Settings.js): `src/Settings/Settings.js`

### Inspection Tools

- [Console](https://github.com/liriliri/eruda/blob/master/src/Console/Console.js): `src/Console/Console.js`
- [Network](https://github.com/liriliri/eruda/blob/master/src/Network/Network.js): `src/Network/Network.js`
- [Request Detail](https://github.com/liriliri/eruda/blob/master/src/Network/Detail.js): `src/Network/Detail.js`
- [Elements](https://github.com/liriliri/eruda/blob/master/src/Elements/Elements.js): `src/Elements/Elements.js`
- [Element Detail](https://github.com/liriliri/eruda/blob/master/src/Elements/Detail.js): `src/Elements/Detail.js`
- [Page Info](https://github.com/liriliri/eruda/blob/master/src/Info/Info.js): `src/Info/Info.js`

### Resources and Code

- [Resources](https://github.com/liriliri/eruda/blob/master/src/Resources/Resources.js): `src/Resources/Resources.js`
- [Storage](https://github.com/liriliri/eruda/blob/master/src/Resources/Storage.js): `src/Resources/Storage.js`
- [Cookies](https://github.com/liriliri/eruda/blob/master/src/Resources/Cookie.js): `src/Resources/Cookie.js`
- [Sources](https://github.com/liriliri/eruda/blob/master/src/Sources/Sources.js): `src/Sources/Sources.js`
- [Snippets](https://github.com/liriliri/eruda/blob/master/src/Snippets/Snippets.js): `src/Snippets/Snippets.js`

### Shared Services

- [Protocol Adapter](https://github.com/liriliri/eruda/blob/master/src/lib/chobitsu.js): `src/lib/chobitsu.js`
- [Event Bus](https://github.com/liriliri/eruda/blob/master/src/lib/emitter.js): `src/lib/emitter.js`
- [Logger](https://github.com/liriliri/eruda/blob/master/src/lib/logger.js): `src/lib/logger.js`
- [Theme and CSS](https://github.com/liriliri/eruda/blob/master/src/lib/evalCss.js): `src/lib/evalCss.js`
- [Theme Definitions](https://github.com/liriliri/eruda/blob/master/src/lib/themes.js): `src/lib/themes.js`
- [Shared Utilities](https://github.com/liriliri/eruda/blob/master/src/lib/util.js): `src/lib/util.js`

### Other components

- **Page Developer**

## Connections

- Page Developer → Eruda API: calls init (evidence: `README.md`)
- Eruda API → Entry Button: initializes (evidence: `src/eruda.js`)
- Eruda API → Tool Shell: initializes (evidence: `src/eruda.js`)
- Eruda API → Console: registers tool (evidence: `src/eruda.js`)
- Eruda API → Network: registers tool (evidence: `src/eruda.js`)
- Eruda API → Elements: registers tool (evidence: `src/eruda.js`)
- Eruda API → Resources: registers tool (evidence: `src/eruda.js`)
- Eruda API → Sources: registers tool (evidence: `src/eruda.js`)
- Eruda API → Snippets: registers tool (evidence: `src/eruda.js`)
- Eruda API → Page Info: registers tool (evidence: `src/eruda.js`)
- Eruda API → Settings: registers tool (evidence: `src/eruda.js`)
- Tool Shell → Tool Base: normalizes tools (evidence: `src/DevTools/DevTools.js`)
- Network → Protocol Adapter: reads response body (evidence: `src/Network/Network.js`)
- Network → Request Detail: uses detail view (evidence: `src/Network/Network.js`)
- Elements → Element Detail: uses detail view (evidence: `src/Elements/Elements.js`)
- Resources → Storage: uses storage (evidence: `src/Resources/Resources.js`)
- Resources → Cookies: uses cookie view (evidence: `src/Resources/Resources.js`)
- Tool Shell → Settings: configures shell (evidence: `src/DevTools/DevTools.js`)
- Tool Shell → Theme and CSS: sets theme (evidence: `src/DevTools/DevTools.js`)
- Theme and CSS → Theme Definitions: loads theme data (evidence: `src/lib/evalCss.js`)
- Console → Logger: configures logger (evidence: `src/Console/Console.js`)
- Console → Tool Shell: shows on errors (evidence: `src/Console/Console.js`)
