# callaginn/menu-schema-generator architecture

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

- Interactive diagram: https://gitdiagram.com/callaginn/menu-schema-generator
- Repository: https://github.com/callaginn/menu-schema-generator

## Overview

This is a small browser-side library: a host page calls `build()`, which reads the live DOM menu, constructs schema.org menu data, and attaches it to an existing or new JSON-LD script. The README documents price-to-Offer conversion, bar departments, merge behavior, and completion callbacks. Internal stages are shown at a high level; the excerpt is partial, so finer call relationships are not inferred.

Main entry points: [`MenuSchemaGenerator.js`](https://github.com/callaginn/menu-schema-generator/blob/main/MenuSchemaGenerator.js) (Build workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_host(("Host page"))
node_live_dom["Live menu DOM"]
node_build["Build workflow"]
node_menu_parse["Menu parsing"]
node_schema_build["Schema assembly"]
node_script_attach["JSON-LD attachment"]
node_completion["Completion callback"]

node_host -->|"calls build"| node_build
node_build -->|"reads menu"| node_live_dom
node_build -->|"parses page"| node_menu_parse
node_menu_parse -->|"emits menu data"| node_schema_build
node_schema_build -->|"attaches schema"| node_script_attach
node_build -->|"fires callback"| node_completion

click node_build "https://github.com/callaginn/menu-schema-generator/blob/main/MenuSchemaGenerator.js"
click node_menu_parse "https://github.com/callaginn/menu-schema-generator/blob/main/MenuSchemaGenerator.js"
click node_schema_build "https://github.com/callaginn/menu-schema-generator/blob/main/MenuSchemaGenerator.js"
click node_script_attach "https://github.com/callaginn/menu-schema-generator/blob/main/MenuSchemaGenerator.js"
click node_completion "https://github.com/callaginn/menu-schema-generator/blob/main/MenuSchemaGenerator.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_host,node_live_dom toneIndigo
class node_build,node_menu_parse,node_schema_build,node_script_attach,node_completion toneTeal
```

## Components

### Other components

- **Host page**
- **Live menu DOM**
- [Build workflow](https://github.com/callaginn/menu-schema-generator/blob/main/MenuSchemaGenerator.js): `MenuSchemaGenerator.js`
- [Menu parsing](https://github.com/callaginn/menu-schema-generator/blob/main/MenuSchemaGenerator.js): `MenuSchemaGenerator.js`
- [Schema assembly](https://github.com/callaginn/menu-schema-generator/blob/main/MenuSchemaGenerator.js): `MenuSchemaGenerator.js`
- [JSON-LD attachment](https://github.com/callaginn/menu-schema-generator/blob/main/MenuSchemaGenerator.js): `MenuSchemaGenerator.js`
- [Completion callback](https://github.com/callaginn/menu-schema-generator/blob/main/MenuSchemaGenerator.js): `MenuSchemaGenerator.js`

## Connections

- Host page → Build workflow: calls build (evidence: `README.md`)
- Build workflow → Live menu DOM: reads menu (evidence: `README.md`)
- Build workflow → Menu parsing: parses page (evidence: `README.md`)
- Menu parsing → Schema assembly: emits menu data (evidence: `README.md`)
- Schema assembly → JSON-LD attachment: attaches schema (evidence: `README.md`)
- Build workflow → Completion callback: fires callback (evidence: `README.md`)
