# gorules/jdm-editor architecture

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

- Interactive diagram: https://gitdiagram.com/gorules/jdm-editor
- Repository: https://github.com/gorules/jdm-editor

## Overview

JDM Editor is a React component library for authoring JSON Decision Model files. The primary user workflow is editing a decision graph and receiving changed graph data through its documented `onChange` callback. Its documented capabilities also include decision tables; the source tree identifies expression and function editors, simulation, diffing, serialization, and code-editor support. The graph shows these as product subsystems without implying unverified runtime calls between them; sampled excerpts provide only limited internal wiring evidence.

Main entry points: [`packages/jdm-editor/src/components/decision-graph/context/dg-store.context.tsx`](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/context/dg-store.context.tsx) (Graph state), [`packages/jdm-editor/src/components/code-editor/ce-preview.tsx`](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/code-editor/ce-preview.tsx) (Expression preview), [`packages/jdm-editor/src/components/decision-graph/dg.tsx`](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/dg.tsx) (Decision graph), [`packages/jdm-editor/src/components/decision-table/dt.tsx`](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-table/dt.tsx) (Decision table)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Decision authoring"]
  node_decision_graph["Decision graph<br/>[dg.tsx]"]
  node_graph_state["Graph state"]
  node_graph_types["Graph types<br/>[dg-types.ts]"]
  node_node_rendering["Decision nodes<br/>[decision-node.tsx]"]
  node_node_specs["Node specifications"]
  node_table_editor["Decision table<br/>[dt.tsx]"]
  node_table_state["Table state"]
  node_expression_editor["Expression editor"]
  node_expression_state["Expression state"]
  node_function_editor["Function editor<br/>[function.tsx]"]
end

subgraph group_analysis["Model analysis"]
  node_graph_simulator["Graph simulator<br/>[dg-simulator.tsx]"]
  node_simulation_types["Simulation data"]
  node_graph_diff["Graph diff<br/>[utility.ts]"]
  node_graph_serializer["Graph serialization"]
end

subgraph group_editing["Editing tools"]
  node_code_editor["Code editor<br/>[ce.tsx]"]
  node_expression_preview["Expression preview<br/>[ce-preview.tsx]"]
  node_schema_helpers["Schema helpers<br/>[schema.ts]"]
  node_wasm_helpers["WASM bridge<br/>[wasm.ts]"]
end

subgraph group_language["Expression language"]
  node_wasm_expression["Expression runtime"]
  node_wasm_completion["Completion engine<br/>[function.rs]"]
  node_completion_dispatch["Completion dispatch<br/>[mod.rs]"]
  node_zen_parser["ZEN parser<br/>[parser.js]"]
  node_template_parser["Template parser<br/>[parser.js]"]
end

node_user(("Model author"))

node_user -->|"edits model"| node_decision_graph
node_decision_graph -->|"emits changes"| node_user
node_graph_state -->|"uses types"| node_graph_types
node_graph_state -->|"uses specifications"| node_node_specs
node_graph_state -.-> node_graph_diff
node_table_editor -.-> node_table_state
node_expression_editor -->|"updates state"| node_expression_state
node_expression_preview -->|"renders"| node_code_editor
node_expression_preview -->|"evaluates expression"| node_wasm_expression
node_completion_dispatch -->|"builds completions"| node_wasm_completion

click node_decision_graph "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/dg.tsx"
click node_graph_state "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/context/dg-store.context.tsx"
click node_graph_types "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/dg-types.ts"
click node_node_rendering "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/nodes/decision-node.tsx"
click node_node_specs "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/nodes/specifications/specification-types.ts"
click node_table_editor "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-table/dt.tsx"
click node_table_state "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-table/context/dt-store.context.tsx"
click node_expression_editor "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/expression/expression-controller.tsx"
click node_expression_state "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/expression/context/expression-store.context.tsx"
click node_function_editor "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/function/function.tsx"
click node_graph_simulator "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/simulator/dg-simulator.tsx"
click node_simulation_types "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/simulator/simulation.types.ts"
click node_graph_diff "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/diff/utility.ts"
click node_graph_serializer "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/context/serializer.context.tsx"
click node_code_editor "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/code-editor/ce.tsx"
click node_expression_preview "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/code-editor/ce-preview.tsx"
click node_schema_helpers "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/helpers/schema.ts"
click node_wasm_helpers "https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/helpers/wasm.ts"
click node_wasm_expression "https://github.com/gorules/jdm-editor/blob/master/packages/zen-engine-wasm/src/expression/expression_builder.rs"
click node_wasm_completion "https://github.com/gorules/jdm-editor/blob/master/packages/zen-engine-wasm/src/completion/function.rs"
click node_completion_dispatch "https://github.com/gorules/jdm-editor/blob/master/packages/zen-engine-wasm/src/completion/mod.rs"
click node_zen_parser "https://github.com/gorules/jdm-editor/blob/master/packages/lezer-zen/src/parser.js"
click node_template_parser "https://github.com/gorules/jdm-editor/blob/master/packages/lezer-zen-template/src/parser.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_decision_graph,node_graph_state,node_graph_types,node_node_rendering,node_node_specs,node_table_editor,node_table_state,node_expression_editor,node_expression_state,node_function_editor toneBlue
class node_graph_simulator,node_simulation_types,node_graph_diff,node_graph_serializer toneAmber
class node_code_editor,node_expression_preview,node_schema_helpers,node_wasm_helpers toneMint
class node_wasm_expression,node_wasm_completion,node_completion_dispatch,node_zen_parser,node_template_parser toneRose
class node_user toneIndigo
```

## Components

### Decision authoring

- [Decision graph](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/dg.tsx): `packages/jdm-editor/src/components/decision-graph/dg.tsx`
- [Graph state](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/context/dg-store.context.tsx): `packages/jdm-editor/src/components/decision-graph/context/dg-store.context.tsx`
- [Graph types](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/dg-types.ts): `packages/jdm-editor/src/components/decision-graph/dg-types.ts`
- [Decision nodes](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/nodes/decision-node.tsx): `packages/jdm-editor/src/components/decision-graph/nodes/decision-node.tsx`
- [Node specifications](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/nodes/specifications/specification-types.ts): `packages/jdm-editor/src/components/decision-graph/nodes/specifications/specification-types.ts`
- [Decision table](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-table/dt.tsx): `packages/jdm-editor/src/components/decision-table/dt.tsx`
- [Table state](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-table/context/dt-store.context.tsx): `packages/jdm-editor/src/components/decision-table/context/dt-store.context.tsx`
- [Expression editor](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/expression/expression-controller.tsx): `packages/jdm-editor/src/components/expression/expression-controller.tsx`
- [Expression state](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/expression/context/expression-store.context.tsx): `packages/jdm-editor/src/components/expression/context/expression-store.context.tsx`
- [Function editor](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/function/function.tsx): `packages/jdm-editor/src/components/function/function.tsx`

### Model analysis

- [Graph simulator](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/simulator/dg-simulator.tsx): `packages/jdm-editor/src/components/decision-graph/simulator/dg-simulator.tsx`
- [Simulation data](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/simulator/simulation.types.ts): `packages/jdm-editor/src/components/decision-graph/simulator/simulation.types.ts`
- [Graph diff](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/diff/utility.ts): `packages/jdm-editor/src/components/decision-graph/diff/utility.ts`
- [Graph serialization](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/decision-graph/context/serializer.context.tsx): `packages/jdm-editor/src/components/decision-graph/context/serializer.context.tsx`

### Editing tools

- [Code editor](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/code-editor/ce.tsx): `packages/jdm-editor/src/components/code-editor/ce.tsx`
- [Expression preview](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/components/code-editor/ce-preview.tsx): `packages/jdm-editor/src/components/code-editor/ce-preview.tsx`
- [Schema helpers](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/helpers/schema.ts): `packages/jdm-editor/src/helpers/schema.ts`
- [WASM bridge](https://github.com/gorules/jdm-editor/blob/master/packages/jdm-editor/src/helpers/wasm.ts): `packages/jdm-editor/src/helpers/wasm.ts`

### Expression language

- [Expression runtime](https://github.com/gorules/jdm-editor/blob/master/packages/zen-engine-wasm/src/expression/expression_builder.rs): `packages/zen-engine-wasm/src/expression/expression_builder.rs`
- [Completion engine](https://github.com/gorules/jdm-editor/blob/master/packages/zen-engine-wasm/src/completion/function.rs): `packages/zen-engine-wasm/src/completion/function.rs`
- [Completion dispatch](https://github.com/gorules/jdm-editor/blob/master/packages/zen-engine-wasm/src/completion/mod.rs): `packages/zen-engine-wasm/src/completion/mod.rs`
- [ZEN parser](https://github.com/gorules/jdm-editor/blob/master/packages/lezer-zen/src/parser.js): `packages/lezer-zen/src/parser.js`
- [Template parser](https://github.com/gorules/jdm-editor/blob/master/packages/lezer-zen-template/src/parser.js): `packages/lezer-zen-template/src/parser.js`

### Other components

- **Model author**

## Connections

- Model author → Decision graph: edits model
- Decision graph → Model author: emits changes
- Graph state → Graph types: uses types (evidence: `packages/jdm-editor/src/components/decision-graph/context/dg-store.context.tsx`)
- Graph state → Node specifications: uses specifications (evidence: `packages/jdm-editor/src/components/decision-graph/context/dg-store.context.tsx`)
- Graph state → Graph diff
- Decision table → Table state
- Expression editor → Expression state: updates state (evidence: `packages/jdm-editor/src/components/expression/expression-controller.tsx`)
- Expression preview → Code editor: renders (evidence: `packages/jdm-editor/src/components/code-editor/ce-preview.tsx`)
- Expression preview → Expression runtime: evaluates expression (evidence: `packages/jdm-editor/src/components/code-editor/ce-preview.tsx`)
- Completion dispatch → Completion engine: builds completions (evidence: `packages/zen-engine-wasm/src/completion/mod.rs`)
