# elastic/docs architecture

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

- Interactive diagram: https://gitdiagram.com/elastic/docs
- Repository: https://github.com/elastic/docs

## Overview

This repository supports the pre-9.0 Elastic Asciidoc documentation workflow: build a book or a set of books into HTML, then preview the result or validate cross-book links. The README documents single/multi-page output, chunking, and alternative-language examples; the source tree also contains browser widgets and Asciidoctor extensions. The build executable itself is not present in the supplied tree, so its internal orchestration is represented only at the documented subsystem level. Edges reflect README statements or relationships shown in the supplied excerpts and SOURCE INDEX.

Main entry points: [`resources/asciidoctor/lib`](https://github.com/elastic/docs/tree/master/resources/asciidoctor/lib) (Book build engine), [`resources/web/docs_js/index-v1.js`](https://github.com/elastic/docs/blob/master/resources/web/docs_js/index-v1.js) (Docs browser entry), [`preview/preview.js`](https://github.com/elastic/docs/blob/master/preview/preview.js) (Preview HTTP server), [`resources/web/docs_js/components/console_widget.jsx`](https://github.com/elastic/docs/blob/master/resources/web/docs_js/components/console_widget.jsx) (Console widget)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Documentation builds"]
  node_build_engine["Book build engine"]
  node_book_sources["Book sources"]
  node_html_output["HTML output"]
  node_all_books["All-books validation"]
end

subgraph group_render["Asciidoc rendering"]
  node_asciidoc_extensions["Asciidoc extensions"]
  node_docbook_compat["DocBook compatibility"]
  node_chunking["Chunking and navigation"]
  node_alternatives["Alternative lookup"]
end

subgraph group_preview["Preview service"]
  node_preview_server["Preview HTTP server<br/>[preview.js]"]
  node_preview_core["Preview file and diff access<br/>[core.js]"]
  node_git_access["Git object and diff access<br/>[git.js]"]
  node_page_template["HTML page templating<br/>[template.js]"]
end

subgraph group_browser["Browser experience"]
  node_web_entry["Docs browser entry<br/>[index-v1.js]"]
  node_alt_picker["Alternative picker"]
  node_alt_switcher["Alternative switcher"]
  node_console_widget["Console widget<br/>[console_widget.jsx]"]
  node_settings_action["Settings actions<br/>[settings.js]"]
  node_modal_action["Modal actions<br/>[modal.js]"]
  node_feedback_widget["Feedback widget"]
  node_feedback_modal["Feedback modal<br/>[feedback_modal.jsx]"]
  node_tabbed_widget["Tabbed content<br/>[tabbed_widget.js]"]
  node_ui_store["UI state store<br/>[store.js]"]
  node_syntax_highlighter["Syntax highlighter<br/>[prettify.js]"]
  node_sql_highlighting["SQL language rules<br/>[lang-sql.js]"]
end

node_author(("Docs author"))
node_preview_user(("Preview user"))

node_author -->|"edits"| node_book_sources
node_author -->|"runs build"| node_build_engine
node_build_engine -->|"builds from"| node_book_sources
node_build_engine -->|"generates"| node_html_output
node_build_engine -->|"checks links"| node_all_books
node_build_engine -.->|"uses"| node_asciidoc_extensions
node_build_engine -->|"applies chunking"| node_chunking
node_build_engine -->|"finds examples"| node_alternatives
node_build_engine -.->|"uses compatibility"| node_docbook_compat
node_preview_user -->|"requests pages"| node_preview_server
node_preview_server -->|"requests files"| node_preview_core
node_preview_server -->|"templates pages"| node_page_template
node_preview_core -->|"reads Git data"| node_git_access
node_html_output -.->|"serves preview"| node_preview_server
node_web_entry -->|"initializes"| node_alt_switcher
node_web_entry -->|"mounts"| node_console_widget
node_web_entry -->|"imports"| node_feedback_modal
node_web_entry -->|"imports"| node_feedback_widget
node_web_entry -->|"imports"| node_tabbed_widget
node_console_widget -->|"renders"| node_alt_picker
node_console_widget -->|"dispatches settings"| node_settings_action
node_settings_action -->|"closes modal"| node_modal_action
node_web_entry -->|"imports"| node_ui_store
node_web_entry -->|"loads highlighter"| node_syntax_highlighter
node_sql_highlighting -->|"registers rules"| node_syntax_highlighter

click node_build_engine "https://github.com/elastic/docs/tree/master/resources/asciidoctor/lib"
click node_all_books "https://github.com/elastic/docs/tree/master/integtest/spec"
click node_asciidoc_extensions "https://github.com/elastic/docs/tree/master/resources/asciidoctor/lib"
click node_docbook_compat "https://github.com/elastic/docs/tree/master/resources/asciidoctor/lib/docbook_compat"
click node_chunking "https://github.com/elastic/docs/tree/master/resources/asciidoctor/lib/chunker"
click node_alternatives "https://github.com/elastic/docs/tree/master/resources/asciidoctor/lib/alternative_language_lookup"
click node_preview_server "https://github.com/elastic/docs/blob/master/preview/preview.js"
click node_preview_core "https://github.com/elastic/docs/blob/master/preview/core.js"
click node_git_access "https://github.com/elastic/docs/blob/master/preview/git.js"
click node_page_template "https://github.com/elastic/docs/blob/master/template/template.js"
click node_web_entry "https://github.com/elastic/docs/blob/master/resources/web/docs_js/index-v1.js"
click node_alt_picker "https://github.com/elastic/docs/blob/master/resources/web/docs_js/components/alternative_picker.jsx"
click node_alt_switcher "https://github.com/elastic/docs/blob/master/resources/web/docs_js/components/alternative_switcher.js"
click node_console_widget "https://github.com/elastic/docs/blob/master/resources/web/docs_js/components/console_widget.jsx"
click node_settings_action "https://github.com/elastic/docs/blob/master/resources/web/docs_js/actions/settings.js"
click node_modal_action "https://github.com/elastic/docs/blob/master/resources/web/docs_js/actions/modal.js"
click node_feedback_widget "https://github.com/elastic/docs/blob/master/resources/web/docs_js/components/feedback_widget.jsx"
click node_feedback_modal "https://github.com/elastic/docs/blob/master/resources/web/docs_js/components/feedback_modal.jsx"
click node_tabbed_widget "https://github.com/elastic/docs/blob/master/resources/web/docs_js/components/tabbed_widget.js"
click node_ui_store "https://github.com/elastic/docs/blob/master/resources/web/docs_js/store.js"
click node_syntax_highlighter "https://github.com/elastic/docs/blob/master/resources/web/lib/prettify/prettify.js"
click node_sql_highlighting "https://github.com/elastic/docs/blob/master/resources/web/lib/prettify/lang-sql.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_build_engine,node_book_sources,node_html_output,node_all_books,node_preview_user toneBlue
class node_asciidoc_extensions,node_docbook_compat,node_chunking,node_alternatives toneAmber
class node_preview_server,node_preview_core,node_git_access,node_page_template toneMint
class node_web_entry,node_alt_picker,node_alt_switcher,node_console_widget,node_settings_action,node_modal_action,node_feedback_widget,node_feedback_modal,node_tabbed_widget,node_ui_store,node_syntax_highlighter,node_sql_highlighting toneRose
class node_author toneIndigo
```

## Components

### Documentation builds

- [Book build engine](https://github.com/elastic/docs/tree/master/resources/asciidoctor/lib): `resources/asciidoctor/lib`
- **Book sources**
- **HTML output**
- [All-books validation](https://github.com/elastic/docs/tree/master/integtest/spec): `integtest/spec`

### Asciidoc rendering

- [Asciidoc extensions](https://github.com/elastic/docs/tree/master/resources/asciidoctor/lib): `resources/asciidoctor/lib`
- [DocBook compatibility](https://github.com/elastic/docs/tree/master/resources/asciidoctor/lib/docbook_compat): `resources/asciidoctor/lib/docbook_compat`
- [Chunking and navigation](https://github.com/elastic/docs/tree/master/resources/asciidoctor/lib/chunker): `resources/asciidoctor/lib/chunker`
- [Alternative lookup](https://github.com/elastic/docs/tree/master/resources/asciidoctor/lib/alternative_language_lookup): `resources/asciidoctor/lib/alternative_language_lookup`

### Preview service

- [Preview HTTP server](https://github.com/elastic/docs/blob/master/preview/preview.js): `preview/preview.js`
- [Preview file and diff access](https://github.com/elastic/docs/blob/master/preview/core.js): `preview/core.js`
- [Git object and diff access](https://github.com/elastic/docs/blob/master/preview/git.js): `preview/git.js`
- [HTML page templating](https://github.com/elastic/docs/blob/master/template/template.js): `template/template.js`

### Browser experience

- [Docs browser entry](https://github.com/elastic/docs/blob/master/resources/web/docs_js/index-v1.js): `resources/web/docs_js/index-v1.js`
- [Alternative picker](https://github.com/elastic/docs/blob/master/resources/web/docs_js/components/alternative_picker.jsx): `resources/web/docs_js/components/alternative_picker.jsx`
- [Alternative switcher](https://github.com/elastic/docs/blob/master/resources/web/docs_js/components/alternative_switcher.js): `resources/web/docs_js/components/alternative_switcher.js`
- [Console widget](https://github.com/elastic/docs/blob/master/resources/web/docs_js/components/console_widget.jsx): `resources/web/docs_js/components/console_widget.jsx`
- [Settings actions](https://github.com/elastic/docs/blob/master/resources/web/docs_js/actions/settings.js): `resources/web/docs_js/actions/settings.js`
- [Modal actions](https://github.com/elastic/docs/blob/master/resources/web/docs_js/actions/modal.js): `resources/web/docs_js/actions/modal.js`
- [Feedback widget](https://github.com/elastic/docs/blob/master/resources/web/docs_js/components/feedback_widget.jsx): `resources/web/docs_js/components/feedback_widget.jsx`
- [Feedback modal](https://github.com/elastic/docs/blob/master/resources/web/docs_js/components/feedback_modal.jsx): `resources/web/docs_js/components/feedback_modal.jsx`
- [Tabbed content](https://github.com/elastic/docs/blob/master/resources/web/docs_js/components/tabbed_widget.js): `resources/web/docs_js/components/tabbed_widget.js`
- [UI state store](https://github.com/elastic/docs/blob/master/resources/web/docs_js/store.js): `resources/web/docs_js/store.js`
- [Syntax highlighter](https://github.com/elastic/docs/blob/master/resources/web/lib/prettify/prettify.js): `resources/web/lib/prettify/prettify.js`
- [SQL language rules](https://github.com/elastic/docs/blob/master/resources/web/lib/prettify/lang-sql.js): `resources/web/lib/prettify/lang-sql.js`

### Other components

- **Docs author**
- **Preview user**

## Connections

- Docs author → Book sources: edits (evidence: `README.asciidoc`)
- Docs author → Book build engine: runs build (evidence: `README.asciidoc`)
- Book build engine → Book sources: builds from (evidence: `README.asciidoc`)
- Book build engine → HTML output: generates (evidence: `README.asciidoc`)
- Book build engine → All-books validation: checks links (evidence: `README.asciidoc`)
- Book build engine → Asciidoc extensions: uses
- Book build engine → Chunking and navigation: applies chunking (evidence: `README.asciidoc`)
- Book build engine → Alternative lookup: finds examples (evidence: `README.asciidoc`)
- Book build engine → DocBook compatibility: uses compatibility (evidence: `resources/asciidoctor/lib/docbook_compat/titleabbrev_handler.rb`)
- Preview user → Preview HTTP server: requests pages (evidence: `preview/preview.js`)
- Preview HTTP server → Preview file and diff access: requests files (evidence: `preview/preview.js`)
- Preview HTTP server → HTML page templating: templates pages (evidence: `preview/preview.js`)
- Preview file and diff access → Git object and diff access: reads Git data (evidence: `preview/core.js`)
- HTML output → Preview HTTP server: serves preview
- Docs browser entry → Alternative switcher: initializes (evidence: `resources/web/docs_js/index-v1.js`)
- Docs browser entry → Console widget: mounts (evidence: `resources/web/docs_js/index-v1.js`)
- Docs browser entry → Feedback modal: imports (evidence: `resources/web/docs_js/index-v1.js`)
- Docs browser entry → Feedback widget: imports (evidence: `resources/web/docs_js/index-v1.js`)
- Docs browser entry → Tabbed content: imports (evidence: `resources/web/docs_js/index-v1.js`)
- Console widget → Alternative picker: renders (evidence: `resources/web/docs_js/components/console_widget.jsx`)
- Console widget → Settings actions: dispatches settings (evidence: `resources/web/docs_js/components/console_widget.jsx`)
- Settings actions → Modal actions: closes modal (evidence: `resources/web/docs_js/actions/settings.js`)
- Docs browser entry → UI state store: imports (evidence: `resources/web/docs_js/index-v1.js`)
- Docs browser entry → Syntax highlighter: loads highlighter (evidence: `resources/web/docs_js/index-v1.js`)
- SQL language rules → Syntax highlighter: registers rules (evidence: `resources/web/lib/prettify/lang-sql.js`)
