# mrfanasina/rdp architecture

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

- Interactive diagram: https://gitdiagram.com/mrfanasina/rdp
- Repository: https://github.com/mrfanasina/rdp

## Overview

This React/TypeScript application presents and simulates Petri nets, with the principal workflow taking a user from the project overview into an editable net, then through transition firing and review of the resulting marking and history. The store owns net state, enabled-transition checks, conflict handling and simulation history; the interface exposes those capabilities through the canvas and supporting panels. Preset networks include the parcel-sorting and charging-station subjects as well as Mobile Money and traffic-light examples. The excerpts are partial, so uncertain component-to-store wiring is omitted.

Main entry points: [`src/pages/PetriPage.tsx`](https://github.com/mrfanasina/rdp/blob/main/src/pages/PetriPage.tsx) (Simulator page), [`src/store/petriStore.ts`](https://github.com/mrfanasina/rdp/blob/main/src/store/petriStore.ts) (Petri state and simulation), [`src/App.tsx`](https://github.com/mrfanasina/rdp/blob/main/src/App.tsx) (View router), [`src/pages/PresentationPage.tsx`](https://github.com/mrfanasina/rdp/blob/main/src/pages/PresentationPage.tsx) (Project overview)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and overview"]
  node_app["View router<br/>[App.tsx]"]
  node_presentation["Project overview"]
end

subgraph group_simulation["Net simulation"]
  node_page["Simulator page<br/>[PetriPage.tsx]"]
  node_canvas["Interactive canvas<br/>[PetriCanvas.tsx]"]
  node_controls["Playback controls<br/>[PetriControls.tsx]"]
  node_history["Steps and conflicts"]
end

subgraph group_inspection["Editing and inspection"]
  node_editor["JSON editor<br/>[PetriEditor.tsx]"]
  node_legend["Net legend<br/>[PetriLegend.tsx]"]
  node_matrix["Incidence matrix"]
  node_addform["Add-node form"]
end

subgraph group_domain["Net data and state"]
  node_store["Petri state and simulation<br/>[petriStore.ts]"]
  node_presets["Preset networks<br/>[petriConstants.ts]"]
  node_types["Net domain types<br/>[petri.ts]"]
end

node_user(("User"))
node_jsonfile["JSON net file"]

node_user -->|"opens"| node_app
node_app -->|"shows overview"| node_presentation
node_app -->|"opens simulator"| node_page
node_presentation -->|"loads presets"| node_store
node_presentation -->|"embeds preview"| node_canvas
node_page -->|"renders"| node_canvas
node_page -->|"renders"| node_controls
node_page -->|"renders"| node_history
node_page -->|"renders"| node_editor
node_page -->|"renders"| node_legend
node_page -->|"renders"| node_matrix
node_page -->|"renders"| node_addform
node_page -->|"imports and exports"| node_store
node_page -->|"reads and writes"| node_jsonfile
node_controls -->|"advances simulation"| node_store
node_history -->|"selects and fires"| node_store
node_canvas -->|"edits and fires"| node_store
node_editor -->|"edits net"| node_store
node_legend -->|"reads and updates statement"| node_store
node_matrix -->|"reads net"| node_store
node_addform -->|"adds nodes"| node_store
node_store -->|"loads preset data"| node_presets

click node_app "https://github.com/mrfanasina/rdp/blob/main/src/App.tsx"
click node_presentation "https://github.com/mrfanasina/rdp/blob/main/src/pages/PresentationPage.tsx"
click node_page "https://github.com/mrfanasina/rdp/blob/main/src/pages/PetriPage.tsx"
click node_canvas "https://github.com/mrfanasina/rdp/blob/main/src/components/petri/PetriCanvas.tsx"
click node_controls "https://github.com/mrfanasina/rdp/blob/main/src/components/petri/PetriControls.tsx"
click node_history "https://github.com/mrfanasina/rdp/blob/main/src/components/petri/PetriStepsPanel.tsx"
click node_editor "https://github.com/mrfanasina/rdp/blob/main/src/components/petri/PetriEditor.tsx"
click node_legend "https://github.com/mrfanasina/rdp/blob/main/src/components/petri/PetriLegend.tsx"
click node_matrix "https://github.com/mrfanasina/rdp/blob/main/src/components/petri/PetriIncidenceMatrix.tsx"
click node_addform "https://github.com/mrfanasina/rdp/blob/main/src/components/petri/AddPetriNodeForm.tsx"
click node_store "https://github.com/mrfanasina/rdp/blob/main/src/store/petriStore.ts"
click node_presets "https://github.com/mrfanasina/rdp/blob/main/src/constants/petriConstants.ts"
click node_types "https://github.com/mrfanasina/rdp/blob/main/src/types/petri.ts"

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_app,node_presentation,node_user toneBlue
class node_page,node_canvas,node_controls,node_history toneAmber
class node_editor,node_legend,node_matrix,node_addform toneMint
class node_store,node_presets,node_types toneRose
class node_jsonfile toneIndigo
```

## Components

### Entry and overview

- [View router](https://github.com/mrfanasina/rdp/blob/main/src/App.tsx): `src/App.tsx`
- [Project overview](https://github.com/mrfanasina/rdp/blob/main/src/pages/PresentationPage.tsx): `src/pages/PresentationPage.tsx`

### Net simulation

- [Simulator page](https://github.com/mrfanasina/rdp/blob/main/src/pages/PetriPage.tsx): `src/pages/PetriPage.tsx`
- [Interactive canvas](https://github.com/mrfanasina/rdp/blob/main/src/components/petri/PetriCanvas.tsx): `src/components/petri/PetriCanvas.tsx`
- [Playback controls](https://github.com/mrfanasina/rdp/blob/main/src/components/petri/PetriControls.tsx): `src/components/petri/PetriControls.tsx`
- [Steps and conflicts](https://github.com/mrfanasina/rdp/blob/main/src/components/petri/PetriStepsPanel.tsx): `src/components/petri/PetriStepsPanel.tsx`

### Editing and inspection

- [JSON editor](https://github.com/mrfanasina/rdp/blob/main/src/components/petri/PetriEditor.tsx): `src/components/petri/PetriEditor.tsx`
- [Net legend](https://github.com/mrfanasina/rdp/blob/main/src/components/petri/PetriLegend.tsx): `src/components/petri/PetriLegend.tsx`
- [Incidence matrix](https://github.com/mrfanasina/rdp/blob/main/src/components/petri/PetriIncidenceMatrix.tsx): `src/components/petri/PetriIncidenceMatrix.tsx`
- [Add-node form](https://github.com/mrfanasina/rdp/blob/main/src/components/petri/AddPetriNodeForm.tsx): `src/components/petri/AddPetriNodeForm.tsx`

### Net data and state

- [Petri state and simulation](https://github.com/mrfanasina/rdp/blob/main/src/store/petriStore.ts): `src/store/petriStore.ts`
- [Preset networks](https://github.com/mrfanasina/rdp/blob/main/src/constants/petriConstants.ts): `src/constants/petriConstants.ts`
- [Net domain types](https://github.com/mrfanasina/rdp/blob/main/src/types/petri.ts): `src/types/petri.ts`

### Other components

- **User**
- **JSON net file**

## Connections

- User → View router: opens
- View router → Project overview: shows overview
- View router → Simulator page: opens simulator
- Project overview → Petri state and simulation: loads presets
- Project overview → Interactive canvas: embeds preview
- Simulator page → Interactive canvas: renders
- Simulator page → Playback controls: renders
- Simulator page → Steps and conflicts: renders
- Simulator page → JSON editor: renders
- Simulator page → Net legend: renders
- Simulator page → Incidence matrix: renders
- Simulator page → Add-node form: renders
- Simulator page → Petri state and simulation: imports and exports
- Simulator page → JSON net file: reads and writes
- Playback controls → Petri state and simulation: advances simulation
- Steps and conflicts → Petri state and simulation: selects and fires
- Interactive canvas → Petri state and simulation: edits and fires
- JSON editor → Petri state and simulation: edits net
- Net legend → Petri state and simulation: reads and updates statement
- Incidence matrix → Petri state and simulation: reads net
- Add-node form → Petri state and simulation: adds nodes
- Petri state and simulation → Preset networks: loads preset data
