# lbfrandsen/data-extended-petrinet-io architecture

> Architecture diagram of the GitHub repository lbfrandsen/data-extended-petrinet-io, 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/lbfrandsen/data-extended-petrinet-io
- Repository: https://github.com/lbfrandsen/data-extended-petrinet-io

## Overview

This is a browser-based Colored Petri Net editor extended with SQL-backed simulation. The principal workflow is to create and type a net, add arc bindings and transition guards, then simulate token movement with optional database queries and actions; users can persist or export the model. The graph includes rendering, editing, simulation, SQL, and import/export capabilities documented in the README. Some subsystems were not sampled, so documented behavior is shown where implementation-level calls were unavailable.

Main entry points: [`lib/core/editor.js`](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/core/editor.js) (Editor runtime), [`lib/features/simulation/BaseSimulationService.js`](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/simulation/BaseSimulationService.js) (Simulation engine), [`lib/providers/GuardProvider.js`](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/providers/GuardProvider.js) (Guard editing), [`lib/services/SqlDialogService.js`](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/services/SqlDialogService.js) (SQL assignments)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["Editor and modeling"]
  node_editor["Editor runtime<br/>[editor.js]"]
  node_petri_io["PetriNetIO API<br/>[PetriNetIO.js]"]
  node_editing["Diagram editing<br/>[EditingProvider.js]"]
  node_palette["Palette tools<br/>[PaletteProvider.js]"]
  node_context_pad["Context actions"]
  node_keyboard["Keyboard bindings"]
end

subgraph group_semantics["Typed net semantics"]
  node_arc_inscription["Arc inscriptions"]
  node_place_types["Place typing"]
  node_guard_provider["Guard editing<br/>[GuardProvider.js]"]
  node_guard_parser["Guard parser<br/>[GuardParser.js]"]
  node_guard_engine["Guard evaluation<br/>[GuardEngine.js]"]
end

subgraph group_simulation["Simulation and SQL"]
  node_simulation["Simulation engine"]
  node_simulation_ui["Simulation controls"]
  node_sql_dialog["SQL assignments"]
  node_database[("Database service<br/>[DatabaseService.js]")]
  node_db_explorer["Database explorer"]
  node_dialogs["User dialogs<br/>[DialogService.js]"]
end

subgraph group_persistence["Persistence and export"]
  node_pnml_import["PNML import<br/>[PnmlImporter.js]"]
  node_pnml_export["PNML export<br/>[PnmlExporter.js]"]
  node_db_pnml["Combined DB-PNML<br/>[DbPnmlService.js]"]
  node_svg_export["SVG export<br/>[SvgExporter.js]"]
  node_pdf_export["PDF export<br/>[PdfExporter.js]"]
  node_tpn_export["TPN export<br/>[TpnExporter.js]"]
end

subgraph group_presentation["Rendering and guidance"]
  node_renderer["Net renderer<br/>[BaseRender.js]"]
  node_label_renderer["Canvas labels<br/>[LabelRenderer.js]"]
  node_roadmap["Simulation roadmap"]
  node_documentation["In-app guidance"]
end

node_user(("Editor user"))

node_user -->|"uses editor"| node_petri_io
node_petri_io -->|"creates runtime"| node_editor
node_editor -->|"registers module"| node_editing
node_editor -->|"registers module"| node_simulation
node_editor -->|"registers module"| node_pnml_import
node_editor -->|"registers module"| node_pnml_export
node_editor -->|"registers exporter"| node_svg_export
node_editor -->|"registers exporter"| node_pdf_export
node_editor -->|"registers exporter"| node_tpn_export
node_editor -->|"registers renderer"| node_renderer
node_editor -->|"registers provider"| node_palette
node_editor -->|"registers provider"| node_context_pad
node_context_pad -->|"initializes and syncs"| node_arc_inscription
node_context_pad -->|"opens guard editor"| node_guard_provider
node_guard_provider -->|"parses guard"| node_guard_parser
node_guard_provider -->|"validates guard"| node_guard_engine
node_guard_provider -->|"reads query"| node_sql_dialog
node_guard_provider -->|"prompts and alerts"| node_dialogs
node_simulation -->|"parses guards"| node_guard_parser
node_simulation -->|"evaluates guards"| node_guard_engine
node_simulation -->|"requests interaction"| node_dialogs
node_simulation -.->|"evaluates bound SQL"| node_sql_dialog
node_simulation -.->|"queries and applies actions"| node_database
node_sql_dialog -->|"opens explorer"| node_db_explorer
node_sql_dialog -->|"shows query lists"| node_dialogs
node_db_pnml -->|"exports PNML"| node_pnml_export
node_db_pnml -->|"imports PNML"| node_pnml_import
node_db_pnml -->|"bundles database"| node_database
node_renderer -->|"renders labels"| node_label_renderer
node_editor -->|"registers provider"| node_roadmap
node_editor -->|"registers guidance"| node_documentation
node_user -->|"fires transitions"| node_simulation
node_user -->|"imports model"| node_pnml_import
node_user -->|"exports diagram"| node_svg_export
node_user -->|"exports diagram"| node_pdf_export
node_user -->|"exports net"| node_tpn_export

click node_editor "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/core/editor.js"
click node_petri_io "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/PetriNetIO.js"
click node_editing "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/editing/EditingProvider.js"
click node_palette "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/providers/PaletteProvider.js"
click node_context_pad "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/providers/ContextPadProvider.js"
click node_keyboard "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/keyboard/PetriNetKeyboardBindings.js"
click node_arc_inscription "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/providers/ArcInscriptionProvider.js"
click node_place_types "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/providers/PlaceTypingProvider.js"
click node_guard_provider "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/providers/GuardProvider.js"
click node_guard_parser "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/helpers/GuardParser.js"
click node_guard_engine "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/helpers/GuardEngine.js"
click node_simulation "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/simulation/BaseSimulationService.js"
click node_simulation_ui "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/simulation/SimulationUiBehavior.js"
click node_sql_dialog "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/services/SqlDialogService.js"
click node_database "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/services/DatabaseService.js"
click node_db_explorer "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/services/DatabaseExplorerDialogService.js"
click node_dialogs "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/services/DialogService.js"
click node_pnml_import "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/export-import-pnml/PnmlImporter.js"
click node_pnml_export "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/export-import-pnml/PnmlExporter.js"
click node_db_pnml "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/export-import-pnml/DbPnmlService.js"
click node_svg_export "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/export-svg/SvgExporter.js"
click node_pdf_export "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/export-pdf/PdfExporter.js"
click node_tpn_export "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/export-tpn/TpnExporter.js"
click node_renderer "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/draw/BaseRender.js"
click node_label_renderer "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/draw/renderers/LabelRenderer.js"
click node_roadmap "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/providers/SimulationRoadmapProvider.js"
click node_documentation "https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/providers/DocumentationProvider.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_editor,node_petri_io,node_editing,node_palette,node_context_pad,node_keyboard,node_user toneBlue
class node_arc_inscription,node_place_types,node_guard_provider,node_guard_parser,node_guard_engine toneAmber
class node_simulation,node_simulation_ui,node_sql_dialog,node_database,node_db_explorer,node_dialogs toneMint
class node_pnml_import,node_pnml_export,node_db_pnml,node_svg_export,node_pdf_export,node_tpn_export toneRose
class node_renderer,node_label_renderer,node_roadmap,node_documentation toneIndigo
```

## Components

### Editor and modeling

- [Editor runtime](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/core/editor.js): `lib/core/editor.js`
- [PetriNetIO API](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/PetriNetIO.js): `lib/PetriNetIO.js`
- [Diagram editing](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/editing/EditingProvider.js): `lib/features/editing/EditingProvider.js`
- [Palette tools](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/providers/PaletteProvider.js): `lib/providers/PaletteProvider.js`
- [Context actions](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/providers/ContextPadProvider.js): `lib/providers/ContextPadProvider.js`
- [Keyboard bindings](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/keyboard/PetriNetKeyboardBindings.js): `lib/features/keyboard/PetriNetKeyboardBindings.js`

### Typed net semantics

- [Arc inscriptions](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/providers/ArcInscriptionProvider.js): `lib/providers/ArcInscriptionProvider.js`
- [Place typing](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/providers/PlaceTypingProvider.js): `lib/providers/PlaceTypingProvider.js`
- [Guard editing](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/providers/GuardProvider.js): `lib/providers/GuardProvider.js`
- [Guard parser](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/helpers/GuardParser.js): `lib/helpers/GuardParser.js`
- [Guard evaluation](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/helpers/GuardEngine.js): `lib/helpers/GuardEngine.js`

### Simulation and SQL

- [Simulation engine](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/simulation/BaseSimulationService.js): `lib/features/simulation/BaseSimulationService.js`
- [Simulation controls](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/simulation/SimulationUiBehavior.js): `lib/features/simulation/SimulationUiBehavior.js`
- [SQL assignments](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/services/SqlDialogService.js): `lib/services/SqlDialogService.js`
- [Database service](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/services/DatabaseService.js): `lib/services/DatabaseService.js`
- [Database explorer](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/services/DatabaseExplorerDialogService.js): `lib/services/DatabaseExplorerDialogService.js`
- [User dialogs](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/services/DialogService.js): `lib/services/DialogService.js`

### Persistence and export

- [PNML import](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/export-import-pnml/PnmlImporter.js): `lib/features/export-import-pnml/PnmlImporter.js`
- [PNML export](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/export-import-pnml/PnmlExporter.js): `lib/features/export-import-pnml/PnmlExporter.js`
- [Combined DB-PNML](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/export-import-pnml/DbPnmlService.js): `lib/features/export-import-pnml/DbPnmlService.js`
- [SVG export](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/export-svg/SvgExporter.js): `lib/features/export-svg/SvgExporter.js`
- [PDF export](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/export-pdf/PdfExporter.js): `lib/features/export-pdf/PdfExporter.js`
- [TPN export](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/features/export-tpn/TpnExporter.js): `lib/features/export-tpn/TpnExporter.js`

### Rendering and guidance

- [Net renderer](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/draw/BaseRender.js): `lib/draw/BaseRender.js`
- [Canvas labels](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/draw/renderers/LabelRenderer.js): `lib/draw/renderers/LabelRenderer.js`
- [Simulation roadmap](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/providers/SimulationRoadmapProvider.js): `lib/providers/SimulationRoadmapProvider.js`
- [In-app guidance](https://github.com/lbfrandsen/data-extended-petrinet-io/blob/main/lib/providers/DocumentationProvider.js): `lib/providers/DocumentationProvider.js`

### Other components

- **Editor user**

## Connections

- Editor user → PetriNetIO API: uses editor
- PetriNetIO API → Editor runtime: creates runtime (evidence: `lib/PetriNetIO.js`)
- Editor runtime → Diagram editing: registers module (evidence: `lib/core/editor.js`)
- Editor runtime → Simulation engine: registers module (evidence: `lib/core/editor.js`)
- Editor runtime → PNML import: registers module (evidence: `lib/core/editor.js`)
- Editor runtime → PNML export: registers module (evidence: `lib/core/editor.js`)
- Editor runtime → SVG export: registers exporter (evidence: `lib/core/editor.js`)
- Editor runtime → PDF export: registers exporter (evidence: `lib/core/editor.js`)
- Editor runtime → TPN export: registers exporter (evidence: `lib/core/editor.js`)
- Editor runtime → Net renderer: registers renderer (evidence: `lib/core/editor.js`)
- Editor runtime → Palette tools: registers provider
- Editor runtime → Context actions: registers provider
- Context actions → Arc inscriptions: initializes and syncs (evidence: `lib/providers/ContextPadProvider.js`)
- Context actions → Guard editing: opens guard editor (evidence: `lib/providers/ContextPadProvider.js`)
- Guard editing → Guard parser: parses guard (evidence: `lib/providers/GuardProvider.js`)
- Guard editing → Guard evaluation: validates guard (evidence: `lib/providers/GuardProvider.js`)
- Guard editing → SQL assignments: reads query (evidence: `lib/providers/GuardProvider.js`)
- Guard editing → User dialogs: prompts and alerts (evidence: `lib/providers/GuardProvider.js`)
- Simulation engine → Guard parser: parses guards (evidence: `lib/features/simulation/BaseSimulationService.js`)
- Simulation engine → Guard evaluation: evaluates guards (evidence: `lib/features/simulation/BaseSimulationService.js`)
- Simulation engine → User dialogs: requests interaction (evidence: `lib/features/simulation/BaseSimulationService.js`)
- Simulation engine → SQL assignments: evaluates bound SQL
- Simulation engine → Database service: queries and applies actions
- SQL assignments → Database explorer: opens explorer (evidence: `lib/services/SqlDialogService.js`)
- SQL assignments → User dialogs: shows query lists (evidence: `lib/services/SqlDialogService.js`)
- Combined DB-PNML → PNML export: exports PNML (evidence: `lib/features/export-import-pnml/DbPnmlService.js`)
- Combined DB-PNML → PNML import: imports PNML (evidence: `lib/features/export-import-pnml/DbPnmlService.js`)
- Combined DB-PNML → Database service: bundles database (evidence: `lib/features/export-import-pnml/DbPnmlService.js`)
- Net renderer → Canvas labels: renders labels (evidence: `lib/draw/BaseRender.js`)
- Editor runtime → Simulation roadmap: registers provider
- Editor runtime → In-app guidance: registers guidance
- Editor user → Simulation engine: fires transitions
- Editor user → PNML import: imports model
- Editor user → SVG export: exports diagram
- Editor user → PDF export: exports diagram
- Editor user → TPN export: exports net
