# lxfater/inpaint-web architecture

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

- Interactive diagram: https://gitdiagram.com/lxfater/inpaint-web
- Repository: https://github.com/lxfater/inpaint-web

## Overview

Inpaint-web is a browser-based image restoration and upscaling application using ONNX models with WebGPU/WASM execution. Users select or drop an image, edit a mask in the editor, run inpainting or super-resolution, review edits, and download results. The graph includes documented modification history and the separate model-download/cache and runtime-capability layers. Relationships are limited to imports and calls visible in excerpts, the source index, or README; unsampled implementation details are not inferred.

Main entry points: [`src/App.tsx`](https://github.com/lxfater/inpaint-web/blob/main/src/App.tsx) (App screen), [`src/Editor.tsx`](https://github.com/lxfater/inpaint-web/blob/main/src/Editor.tsx) (Canvas editor), [`src/adapters/cache.ts`](https://github.com/lxfater/inpaint-web/blob/main/src/adapters/cache.ts) (Model cache), [`src/adapters/inpainting.ts`](https://github.com/lxfater/inpaint-web/blob/main/src/adapters/inpainting.ts) (Inpainting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application flow"]
  node_entry["React entry<br/>[index.tsx]"]
  node_appscreen["App screen<br/>[App.tsx]"]
  node_filepick["Image selection<br/>[FileSelect.tsx]"]
end

subgraph group_editing["Image editing"]
  node_imageutils["Image utilities<br/>[utils.ts]"]
  node_editor["Canvas editor<br/>[Editor.tsx]"]
  node_history["Edit history<br/>[Editor.tsx]"]
end

subgraph group_inference["Model inference"]
  node_inpaint["Inpainting<br/>[inpainting.ts]"]
  node_upscale["Super-resolution<br/>[superResolution.ts]"]
  node_modelcache[("Model cache<br/>[cache.ts]")]
  node_capabilities["Runtime detection<br/>[util.ts]"]
end

subgraph group_interface["Interface components"]
  node_button["Button control<br/>[Button.tsx]"]
  node_slider["Slider control<br/>[Slider.tsx]"]
  node_filemodal["Modal display<br/>[Modal.tsx]"]
  node_progress["Progress display<br/>[Progress.tsx]"]
end

node_user(("Image user"))
node_runtimecdn["ONNX Runtime CDN"]

node_user -->|"opens"| node_appscreen
node_entry -->|"renders"| node_appscreen
node_appscreen -->|"renders"| node_filepick
node_appscreen -->|"resizes"| node_imageutils
node_appscreen -->|"renders"| node_editor
node_filepick -->|"selects image"| node_appscreen
node_editor -->|"runs inpainting"| node_inpaint
node_editor -->|"runs upscale"| node_upscale
node_editor -->|"maintains"| node_history
node_editor -->|"loads and downloads"| node_imageutils
node_editor -->|"renders"| node_button
node_editor -->|"renders"| node_slider
node_appscreen -->|"renders"| node_button
node_appscreen -->|"renders"| node_filemodal
node_appscreen -->|"renders"| node_progress
node_editor -->|"renders"| node_filemodal
node_editor -->|"renders"| node_progress
node_appscreen -->|"downloads model"| node_modelcache
node_inpaint -->|"ensures model"| node_modelcache
node_upscale -->|"ensures model"| node_modelcache
node_inpaint -->|"checks runtime"| node_capabilities
node_upscale -->|"checks runtime"| node_capabilities
node_capabilities -->|"loads runtime"| node_runtimecdn
node_modelcache -->|"fetches model"| node_user

click node_entry "https://github.com/lxfater/inpaint-web/blob/main/src/index.tsx"
click node_appscreen "https://github.com/lxfater/inpaint-web/blob/main/src/App.tsx"
click node_filepick "https://github.com/lxfater/inpaint-web/blob/main/src/components/FileSelect.tsx"
click node_imageutils "https://github.com/lxfater/inpaint-web/blob/main/src/utils.ts"
click node_editor "https://github.com/lxfater/inpaint-web/blob/main/src/Editor.tsx"
click node_history "https://github.com/lxfater/inpaint-web/blob/main/src/Editor.tsx"
click node_inpaint "https://github.com/lxfater/inpaint-web/blob/main/src/adapters/inpainting.ts"
click node_upscale "https://github.com/lxfater/inpaint-web/blob/main/src/adapters/superResolution.ts"
click node_modelcache "https://github.com/lxfater/inpaint-web/blob/main/src/adapters/cache.ts"
click node_capabilities "https://github.com/lxfater/inpaint-web/blob/main/src/adapters/util.ts"
click node_button "https://github.com/lxfater/inpaint-web/blob/main/src/components/Button.tsx"
click node_slider "https://github.com/lxfater/inpaint-web/blob/main/src/components/Slider.tsx"
click node_filemodal "https://github.com/lxfater/inpaint-web/blob/main/src/components/Modal.tsx"
click node_progress "https://github.com/lxfater/inpaint-web/blob/main/src/components/Progress.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_entry,node_appscreen,node_filepick,node_user toneBlue
class node_imageutils,node_editor,node_history toneAmber
class node_inpaint,node_upscale,node_modelcache,node_capabilities toneMint
class node_button,node_slider,node_filemodal,node_progress toneRose
class node_runtimecdn toneIndigo
```

## Components

### Application flow

- [React entry](https://github.com/lxfater/inpaint-web/blob/main/src/index.tsx): `src/index.tsx`
- [App screen](https://github.com/lxfater/inpaint-web/blob/main/src/App.tsx): `src/App.tsx`
- [Image selection](https://github.com/lxfater/inpaint-web/blob/main/src/components/FileSelect.tsx): `src/components/FileSelect.tsx`

### Image editing

- [Image utilities](https://github.com/lxfater/inpaint-web/blob/main/src/utils.ts): `src/utils.ts`
- [Canvas editor](https://github.com/lxfater/inpaint-web/blob/main/src/Editor.tsx): `src/Editor.tsx`
- [Edit history](https://github.com/lxfater/inpaint-web/blob/main/src/Editor.tsx): `src/Editor.tsx`

### Model inference

- [Inpainting](https://github.com/lxfater/inpaint-web/blob/main/src/adapters/inpainting.ts): `src/adapters/inpainting.ts`
- [Super-resolution](https://github.com/lxfater/inpaint-web/blob/main/src/adapters/superResolution.ts): `src/adapters/superResolution.ts`
- [Model cache](https://github.com/lxfater/inpaint-web/blob/main/src/adapters/cache.ts): `src/adapters/cache.ts`
- [Runtime detection](https://github.com/lxfater/inpaint-web/blob/main/src/adapters/util.ts): `src/adapters/util.ts`

### Interface components

- [Button control](https://github.com/lxfater/inpaint-web/blob/main/src/components/Button.tsx): `src/components/Button.tsx`
- [Slider control](https://github.com/lxfater/inpaint-web/blob/main/src/components/Slider.tsx): `src/components/Slider.tsx`
- [Modal display](https://github.com/lxfater/inpaint-web/blob/main/src/components/Modal.tsx): `src/components/Modal.tsx`
- [Progress display](https://github.com/lxfater/inpaint-web/blob/main/src/components/Progress.tsx): `src/components/Progress.tsx`

### Other components

- **Image user**
- **ONNX Runtime CDN**

## Connections

- Image user → App screen: opens (evidence: `README.md`)
- React entry → App screen: renders (evidence: `src/index.tsx`)
- App screen → Image selection: renders (evidence: `src/App.tsx`)
- App screen → Image utilities: resizes (evidence: `src/App.tsx`)
- App screen → Canvas editor: renders (evidence: `src/App.tsx`)
- Image selection → App screen: selects image (evidence: `src/App.tsx`)
- Canvas editor → Inpainting: runs inpainting (evidence: `src/Editor.tsx`)
- Canvas editor → Super-resolution: runs upscale (evidence: `src/Editor.tsx`)
- Canvas editor → Edit history: maintains (evidence: `README.md`)
- Canvas editor → Image utilities: loads and downloads (evidence: `src/Editor.tsx`)
- Canvas editor → Button control: renders (evidence: `src/Editor.tsx`)
- Canvas editor → Slider control: renders (evidence: `src/Editor.tsx`)
- App screen → Button control: renders (evidence: `src/App.tsx`)
- App screen → Modal display: renders (evidence: `src/App.tsx`)
- App screen → Progress display: renders (evidence: `src/App.tsx`)
- Canvas editor → Modal display: renders (evidence: `src/Editor.tsx`)
- Canvas editor → Progress display: renders (evidence: `src/Editor.tsx`)
- App screen → Model cache: downloads model (evidence: `src/App.tsx`)
- Inpainting → Model cache: ensures model (evidence: `src/adapters/inpainting.ts`)
- Super-resolution → Model cache: ensures model (evidence: `src/adapters/superResolution.ts`)
- Inpainting → Runtime detection: checks runtime (evidence: `src/adapters/inpainting.ts`)
- Super-resolution → Runtime detection: checks runtime (evidence: `src/adapters/superResolution.ts`)
- Runtime detection → ONNX Runtime CDN: loads runtime (evidence: `src/adapters/util.ts`)
- Model cache → Image user: fetches model (evidence: `src/adapters/cache.ts`)
