# felipecam-devcs/rpgtoolkit architecture

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

- Interactive diagram: https://gitdiagram.com/felipecam-devcs/rpgtoolkit
- Repository: https://github.com/felipecam-devcs/rpgtoolkit

## Overview

This is a small RPG dice-generation package: a controller validates requests, the model rolls dice and maintains history in several orderings, and a separate helper persists history as text. The sampled files do not show an application entry point wiring these pieces together; the Flet view is empty, and export formats are placeholders. The graph therefore shows only relationships visible in the excerpts, not a complete user-interface flow.

Main entry points: [`models/gen_dice_model.py`](https://github.com/felipecam-devcs/rpgtoolkit/blob/main/models/gen_dice_model.py) (Dice and history model), [`controllers/gen_dice_controller.py`](https://github.com/felipecam-devcs/rpgtoolkit/blob/main/controllers/gen_dice_controller.py) (Dice controller), [`models/export_import_historical_model.py`](https://github.com/felipecam-devcs/rpgtoolkit/blob/main/models/export_import_historical_model.py) (History file I/O)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_generation["Dice generation"]
  node_controller["Dice controller"]
end

subgraph group_history["History management"]
  node_dice_model["Dice and history model<br/>[gen_dice_model.py]"]
end

subgraph group_persistence["Persistence and errors"]
  node_historical_io["History file I/O"]
  node_save_file["Text history file"]
  node_io_errors["I/O error types<br/>[excepts.py]"]
end

node_random["Python random"]

node_controller -->|"requests rolls"| node_dice_model
node_controller -->|"clears history"| node_dice_model
node_dice_model -->|"rolls with"| node_random
node_historical_io -->|"reads history"| node_dice_model
node_historical_io -->|"appends history"| node_save_file

click node_controller "https://github.com/felipecam-devcs/rpgtoolkit/blob/main/controllers/gen_dice_controller.py"
click node_dice_model "https://github.com/felipecam-devcs/rpgtoolkit/blob/main/models/gen_dice_model.py"
click node_historical_io "https://github.com/felipecam-devcs/rpgtoolkit/blob/main/models/export_import_historical_model.py"
click node_io_errors "https://github.com/felipecam-devcs/rpgtoolkit/blob/main/excepts/excepts.py"

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_controller toneBlue
class node_dice_model toneAmber
class node_historical_io,node_save_file,node_io_errors toneMint
class node_random toneIndigo
```

## Components

### Dice generation

- [Dice controller](https://github.com/felipecam-devcs/rpgtoolkit/blob/main/controllers/gen_dice_controller.py): `controllers/gen_dice_controller.py`

### History management

- [Dice and history model](https://github.com/felipecam-devcs/rpgtoolkit/blob/main/models/gen_dice_model.py): `models/gen_dice_model.py`

### Persistence and errors

- [History file I/O](https://github.com/felipecam-devcs/rpgtoolkit/blob/main/models/export_import_historical_model.py): `models/export_import_historical_model.py`
- **Text history file**
- [I/O error types](https://github.com/felipecam-devcs/rpgtoolkit/blob/main/excepts/excepts.py): `excepts/excepts.py`

### Other components

- **Python random**

## Connections

- Dice controller → Dice and history model: requests rolls (evidence: `controllers/gen_dice_controller.py`)
- Dice controller → Dice and history model: clears history (evidence: `controllers/gen_dice_controller.py`)
- Dice and history model → Python random: rolls with (evidence: `models/gen_dice_model.py`)
- History file I/O → Dice and history model: reads history (evidence: `models/export_import_historical_model.py`)
- History file I/O → Text history file: appends history (evidence: `models/export_import_historical_model.py`)
