# mdn/dom-examples architecture

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

- Interactive diagram: https://gitdiagram.com/mdn/dom-examples
- Repository: https://github.com/mdn/dom-examples

## Overview

dom-examples is a collection of standalone browser DOM and Web API demonstrations, not one integrated application. Its common user-to-result pattern is to open a demo, interact with its page, and observe a browser API effect; the demos do not share a runtime orchestrator. The graph groups the independent examples by capability and includes sampled implementations plus major areas visible in the tree and README. Connections between unsampled demos are intentionally omitted because there is no evidence they call or route to one another.

Main entry points: [`audiocontext-setsinkid/app.js`](https://github.com/mdn/dom-examples/blob/main/audiocontext-setsinkid/app.js) (Audio output), [`media`](https://github.com/mdn/dom-examples/tree/main/media) (Media examples), [`picture-in-picture/main.js`](https://github.com/mdn/dom-examples/blob/main/picture-in-picture/main.js) (Video picture-in-picture), [`document-picture-in-picture/main.js`](https://github.com/mdn/dom-examples/blob/main/document-picture-in-picture/main.js) (Document picture-in-picture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_media["Media and devices"]
  node_audio["Audio output<br/>[app.js]"]
  node_media_examples["Media examples"]
  node_pip["Video picture-in-picture<br/>[main.js]"]
  node_docpip["Document picture-in-picture<br/>[main.js]"]
  node_capture["Screen capture"]
end

subgraph group_graphics["Graphics and presentation"]
  node_canvas["Canvas manipulation"]
  node_css_paint["CSS painting"]
  node_transitions["View transitions"]
  node_webgpu["WebGPU demos<br/>[script.js]"]
end

subgraph group_storage["Storage and files"]
  node_idb["IndexedDB<br/>[main.js]"]
  node_web_storage["Web storage<br/>[main.js]"]
  node_file_system["File system"]
  node_service_worker["Service worker gallery<br/>[app.js]"]
end

subgraph group_interaction["Page interaction"]
  node_forms_editing["Editing and forms"]
  node_popover["Popovers"]
  node_geolocation["Geolocation"]
  node_pointer["Pointer lock<br/>[app.js]"]
end

subgraph group_platform["Platform and communication"]
  node_workers["Web workers"]
  node_crypto["Web cryptography"]
  node_messaging["Network messaging<br/>[main.js]"]
  node_device_examples["Device and window APIs"]
end

node_visitor(("Demo visitor"))

node_visitor -->|"interacts with"| node_audio
node_visitor -->|"explores"| node_media_examples
node_visitor -->|"interacts with"| node_pip
node_visitor -->|"explores"| node_docpip
node_visitor -->|"explores"| node_capture
node_visitor -->|"explores"| node_canvas
node_visitor -->|"explores"| node_css_paint
node_visitor -->|"explores"| node_transitions
node_visitor -->|"explores"| node_webgpu
node_visitor -->|"interacts with"| node_idb
node_visitor -->|"interacts with"| node_web_storage
node_visitor -->|"explores"| node_file_system
node_visitor -->|"explores"| node_service_worker
node_visitor -->|"explores"| node_forms_editing
node_visitor -->|"explores"| node_popover
node_visitor -->|"explores"| node_geolocation
node_visitor -->|"interacts with"| node_pointer
node_visitor -->|"explores"| node_workers
node_visitor -->|"explores"| node_crypto
node_visitor -->|"explores"| node_messaging
node_visitor -->|"explores"| node_device_examples

click node_audio "https://github.com/mdn/dom-examples/blob/main/audiocontext-setsinkid/app.js"
click node_media_examples "https://github.com/mdn/dom-examples/tree/main/media"
click node_pip "https://github.com/mdn/dom-examples/blob/main/picture-in-picture/main.js"
click node_docpip "https://github.com/mdn/dom-examples/blob/main/document-picture-in-picture/main.js"
click node_capture "https://github.com/mdn/dom-examples/tree/main/screen-capture-api"
click node_canvas "https://github.com/mdn/dom-examples/tree/main/canvas"
click node_css_paint "https://github.com/mdn/dom-examples/tree/main/css-painting"
click node_transitions "https://github.com/mdn/dom-examples/tree/main/view-transitions"
click node_webgpu "https://github.com/mdn/dom-examples/blob/main/webgpu-compute-demo/script.js"
click node_idb "https://github.com/mdn/dom-examples/blob/main/indexeddb-api/main.js"
click node_web_storage "https://github.com/mdn/dom-examples/blob/main/web-storage/main.js"
click node_file_system "https://github.com/mdn/dom-examples/tree/main/file-system-api"
click node_service_worker "https://github.com/mdn/dom-examples/blob/main/service-worker/simple-service-worker/app.js"
click node_forms_editing "https://github.com/mdn/dom-examples/tree/main/edit-context"
click node_popover "https://github.com/mdn/dom-examples/tree/main/popover-api"
click node_geolocation "https://github.com/mdn/dom-examples/tree/main/geolocation-element"
click node_pointer "https://github.com/mdn/dom-examples/blob/main/pointer-lock/app.js"
click node_workers "https://github.com/mdn/dom-examples/tree/main/web-workers"
click node_crypto "https://github.com/mdn/dom-examples/tree/main/web-crypto"
click node_messaging "https://github.com/mdn/dom-examples/blob/main/websockets/main.js"
click node_device_examples "https://github.com/mdn/dom-examples/tree/main/device-posture-api"

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_audio,node_media_examples,node_pip,node_docpip,node_capture toneBlue
class node_canvas,node_css_paint,node_transitions,node_webgpu toneAmber
class node_idb,node_web_storage,node_file_system,node_service_worker toneMint
class node_forms_editing,node_popover,node_geolocation,node_pointer toneRose
class node_workers,node_crypto,node_messaging,node_device_examples,node_visitor toneIndigo
```

## Components

### Media and devices

- [Audio output](https://github.com/mdn/dom-examples/blob/main/audiocontext-setsinkid/app.js): `audiocontext-setsinkid/app.js`
- [Media examples](https://github.com/mdn/dom-examples/tree/main/media): `media`
- [Video picture-in-picture](https://github.com/mdn/dom-examples/blob/main/picture-in-picture/main.js): `picture-in-picture/main.js`
- [Document picture-in-picture](https://github.com/mdn/dom-examples/blob/main/document-picture-in-picture/main.js): `document-picture-in-picture/main.js`
- [Screen capture](https://github.com/mdn/dom-examples/tree/main/screen-capture-api): `screen-capture-api`

### Graphics and presentation

- [Canvas manipulation](https://github.com/mdn/dom-examples/tree/main/canvas): `canvas`
- [CSS painting](https://github.com/mdn/dom-examples/tree/main/css-painting): `css-painting`
- [View transitions](https://github.com/mdn/dom-examples/tree/main/view-transitions): `view-transitions`
- [WebGPU demos](https://github.com/mdn/dom-examples/blob/main/webgpu-compute-demo/script.js): `webgpu-compute-demo/script.js`

### Storage and files

- [IndexedDB](https://github.com/mdn/dom-examples/blob/main/indexeddb-api/main.js): `indexeddb-api/main.js`
- [Web storage](https://github.com/mdn/dom-examples/blob/main/web-storage/main.js): `web-storage/main.js`
- [File system](https://github.com/mdn/dom-examples/tree/main/file-system-api): `file-system-api`
- [Service worker gallery](https://github.com/mdn/dom-examples/blob/main/service-worker/simple-service-worker/app.js): `service-worker/simple-service-worker/app.js`

### Page interaction

- [Editing and forms](https://github.com/mdn/dom-examples/tree/main/edit-context): `edit-context`
- [Popovers](https://github.com/mdn/dom-examples/tree/main/popover-api): `popover-api`
- [Geolocation](https://github.com/mdn/dom-examples/tree/main/geolocation-element): `geolocation-element`
- [Pointer lock](https://github.com/mdn/dom-examples/blob/main/pointer-lock/app.js): `pointer-lock/app.js`

### Platform and communication

- [Web workers](https://github.com/mdn/dom-examples/tree/main/web-workers): `web-workers`
- [Web cryptography](https://github.com/mdn/dom-examples/tree/main/web-crypto): `web-crypto`
- [Network messaging](https://github.com/mdn/dom-examples/blob/main/websockets/main.js): `websockets/main.js`
- [Device and window APIs](https://github.com/mdn/dom-examples/tree/main/device-posture-api): `device-posture-api`

### Other components

- **Demo visitor**

## Connections

- Demo visitor → Audio output: interacts with (evidence: `README.md`)
- Demo visitor → Media examples: explores (evidence: `README.md`)
- Demo visitor → Video picture-in-picture: interacts with (evidence: `README.md`)
- Demo visitor → Document picture-in-picture: explores (evidence: `README.md`)
- Demo visitor → Screen capture: explores (evidence: `README.md`)
- Demo visitor → Canvas manipulation: explores (evidence: `README.md`)
- Demo visitor → CSS painting: explores (evidence: `README.md`)
- Demo visitor → View transitions: explores (evidence: `README.md`)
- Demo visitor → WebGPU demos: explores (evidence: `README.md`)
- Demo visitor → IndexedDB: interacts with (evidence: `README.md`)
- Demo visitor → Web storage: interacts with (evidence: `README.md`)
- Demo visitor → File system: explores (evidence: `README.md`)
- Demo visitor → Service worker gallery: explores (evidence: `README.md`)
- Demo visitor → Editing and forms: explores (evidence: `README.md`)
- Demo visitor → Popovers: explores (evidence: `README.md`)
- Demo visitor → Geolocation: explores (evidence: `README.md`)
- Demo visitor → Pointer lock: interacts with (evidence: `README.md`)
- Demo visitor → Web workers: explores (evidence: `README.md`)
- Demo visitor → Web cryptography: explores (evidence: `README.md`)
- Demo visitor → Network messaging: explores (evidence: `README.md`)
- Demo visitor → Device and window APIs: explores (evidence: `README.md`)
