# webui-dev/rust-webui architecture

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

- Interactive diagram: https://gitdiagram.com/webui-dev/rust-webui
- Repository: https://github.com/webui-dev/rust-webui

## Overview

Rust-WebUI is a Rust wrapper for a small C library that launches installed browsers as application GUIs. An application creates a window, supplies HTML or content, and waits for windows to close; frontend events and JavaScript/data exchange are exposed through Rust APIs. The wrapper also covers browser selection, window configuration, file serving, and lifecycle control. The excerpts show Rust-to-FFI calls and declarations; the README documents the native-library/browser role, but native implementation details are not present here.

Main entry points: [`src/webui.rs`](https://github.com/webui-dev/rust-webui/blob/main/src/webui.rs) (Window and UI API), [`src/webui/bindgen.rs`](https://github.com/webui-dev/rust-webui/blob/main/src/webui/bindgen.rs) (C FFI declarations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_rust["Rust wrapper"]
  node_window["Window and UI API<br/>[webui.rs]"]
  node_events["Events and JS API<br/>[webui.rs]"]
  node_ffi["C FFI declarations<br/>[bindgen.rs]"]
end

subgraph group_native["Native runtime"]
  node_native["WebUI C library"]
end

subgraph group_frontend["Browser UI"]
  node_browser["Installed browser"]
end

node_app(("Rust application"))

node_app -->|"creates and shows"| node_window
node_app -->|"waits for closure"| node_window
node_window -->|"calls native API"| node_ffi
node_events -->|"calls event API"| node_ffi
node_ffi -->|"declares C interface"| node_native
node_native -->|"launches as GUI"| node_browser

click node_window "https://github.com/webui-dev/rust-webui/blob/main/src/webui.rs"
click node_events "https://github.com/webui-dev/rust-webui/blob/main/src/webui.rs"
click node_ffi "https://github.com/webui-dev/rust-webui/blob/main/src/webui/bindgen.rs"

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_window,node_events,node_ffi toneBlue
class node_native toneAmber
class node_browser toneMint
class node_app toneIndigo
```

## Components

### Rust wrapper

- [Window and UI API](https://github.com/webui-dev/rust-webui/blob/main/src/webui.rs): `src/webui.rs`
- [Events and JS API](https://github.com/webui-dev/rust-webui/blob/main/src/webui.rs): `src/webui.rs`
- [C FFI declarations](https://github.com/webui-dev/rust-webui/blob/main/src/webui/bindgen.rs): `src/webui/bindgen.rs`

### Native runtime

- **WebUI C library**

### Browser UI

- **Installed browser**

### Other components

- **Rust application**

## Connections

- Rust application → Window and UI API: creates and shows (evidence: `README.md`)
- Rust application → Window and UI API: waits for closure (evidence: `README.md`)
- Window and UI API → C FFI declarations: calls native API (evidence: `src/webui.rs`)
- Events and JS API → C FFI declarations: calls event API (evidence: `src/webui.rs`)
- C FFI declarations → WebUI C library: declares C interface (evidence: `README.md`)
- WebUI C library → Installed browser: launches as GUI (evidence: `README.md`)
