# moth-logic/clover-cookbook architecture

> Architecture diagram of the GitHub repository moth-logic/clover-cookbook, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/moth-logic/clover-cookbook
- Repository: https://github.com/moth-logic/clover-cookbook

## Overview

Clover Cookbook is a Java desktop recipe and kitchen-inventory manager. A user enters through the main window, then manages recipes, ingredients, and utensils; recipe discovery filters recipes and shows availability, while recipe details support creating and validating recipes. The central manager holds the cookbook state and delegates save/load to Java-serialization persistence. The graph also preserves the README’s availability and filtering capabilities. Some screens and filter implementations were not excerpted, so their links are included only where the source index or README supports them.

Main entry points: [`src/interfaz/PantallaQueCocinar.java`](https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/PantallaQueCocinar.java) (Recipe finder), [`src/interfaz/PantallaReceta.java`](https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/PantallaReceta.java) (Recipe editor), [`src/control/GestorRecetas.java`](https://github.com/moth-logic/clover-cookbook/blob/main/src/control/GestorRecetas.java) (Cookbook manager), [`src/interfaz/PantallaPrincipal.java`](https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/PantallaPrincipal.java) (Main window)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_home["Main window"]
  node_recipe_ui["Recipe editor"]
  node_discover["Recipe finder"]
  node_pantry["Pantry screen"]
  node_inventory_base["Inventory screen base"]
  node_utensils["Utensils screen"]
  node_window["Window base<br/>[BaseWindow.java]"]
  node_style["UI styling<br/>[EstiloUI.java]"]
end

subgraph group_control["Cookbook services"]
  node_manager["Cookbook manager<br/>[GestorRecetas.java]"]
  node_filters["Recipe filters<br/>[FiltroRecetas.java]"]
  node_difficulty_filter["Difficulty filter"]
  node_duration_filter["Duration filter"]
  node_tag_filter["Tag filter"]
  node_duration_range["Duration range<br/>[RangoDuracion.java]"]
end

subgraph group_domain["Recipe domain"]
  node_recipe["Recipe and validation<br/>[Receta.java]"]
  node_ingredient["Pantry ingredient<br/>[Ingrediente.java]"]
  node_recipe_ingredient["Recipe ingredient amount"]
  node_utensil["Kitchen utensil<br/>[Utensilio.java]"]
  node_difficulty["Difficulty levels<br/>[Dificultad.java]"]
end

subgraph group_storage["Persistence"]
  node_persistence["Serialization persistence<br/>[Persistencia.java]"]
end

node_user(("Cookbook user"))

node_user -->|"uses"| node_home
node_home -->|"opens"| node_recipe_ui
node_home -->|"opens"| node_discover
node_home -->|"opens"| node_pantry
node_home -->|"opens"| node_utensils
node_recipe_ui -->|"manages recipes"| node_manager
node_discover -->|"filters recipes"| node_manager
node_discover -->|"opens details"| node_recipe_ui
node_pantry -->|"reuses"| node_inventory_base
node_utensils -->|"reuses"| node_inventory_base
node_inventory_base -->|"manages inventory"| node_manager
node_recipe_ui -->|"extends"| node_window
node_discover -->|"extends"| node_window
node_inventory_base -->|"extends"| node_window
node_recipe_ui -->|"styles controls"| node_style
node_discover -->|"styles controls"| node_style
node_manager -->|"saves and loads"| node_persistence
node_manager -->|"applies"| node_filters
node_difficulty_filter -->|"implements"| node_filters
node_duration_filter -->|"implements"| node_filters
node_tag_filter -->|"implements"| node_filters
node_discover -->|"selects"| node_difficulty_filter
node_discover -->|"selects"| node_duration_filter
node_discover -->|"selects"| node_tag_filter
node_duration_filter -->|"uses range"| node_duration_range
node_manager -->|"stores and checks"| node_recipe
node_recipe -->|"contains"| node_recipe_ingredient
node_recipe -->|"contains"| node_utensil
node_recipe -->|"uses level"| node_difficulty
node_recipe_ingredient -->|"references"| node_ingredient
node_recipe_ui -->|"edits ingredients"| node_ingredient
node_recipe_ui -->|"edits utensils"| node_utensil
node_recipe_ui -->|"sets difficulty"| node_difficulty
node_discover -->|"shows availability"| node_recipe
node_manager -->|"tracks inventory"| node_ingredient
node_manager -->|"tracks inventory"| node_utensil

click node_home "https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/PantallaPrincipal.java"
click node_recipe_ui "https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/PantallaReceta.java"
click node_discover "https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/PantallaQueCocinar.java"
click node_pantry "https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/PantallaAlacena.java"
click node_inventory_base "https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/PantallaInventarioBase.java"
click node_utensils "https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/PantallaUtensilios.java"
click node_window "https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/BaseWindow.java"
click node_style "https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/EstiloUI.java"
click node_manager "https://github.com/moth-logic/clover-cookbook/blob/main/src/control/GestorRecetas.java"
click node_filters "https://github.com/moth-logic/clover-cookbook/blob/main/src/control/FiltroRecetas.java"
click node_difficulty_filter "https://github.com/moth-logic/clover-cookbook/blob/main/src/control/FiltroPorDificultad.java"
click node_duration_filter "https://github.com/moth-logic/clover-cookbook/blob/main/src/control/FiltroPorDuracion.java"
click node_tag_filter "https://github.com/moth-logic/clover-cookbook/blob/main/src/control/FiltroPorEtiqueta.java"
click node_duration_range "https://github.com/moth-logic/clover-cookbook/blob/main/src/control/RangoDuracion.java"
click node_persistence "https://github.com/moth-logic/clover-cookbook/blob/main/src/control/Persistencia.java"
click node_recipe "https://github.com/moth-logic/clover-cookbook/blob/main/src/logica/Receta.java"
click node_ingredient "https://github.com/moth-logic/clover-cookbook/blob/main/src/logica/Ingrediente.java"
click node_recipe_ingredient "https://github.com/moth-logic/clover-cookbook/blob/main/src/logica/IngredienteReceta.java"
click node_utensil "https://github.com/moth-logic/clover-cookbook/blob/main/src/logica/Utensilio.java"
click node_difficulty "https://github.com/moth-logic/clover-cookbook/blob/main/src/logica/Dificultad.java"

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_home,node_recipe_ui,node_discover,node_pantry,node_inventory_base,node_utensils,node_window,node_style,node_user toneBlue
class node_manager,node_filters,node_difficulty_filter,node_duration_filter,node_tag_filter,node_duration_range toneAmber
class node_recipe,node_ingredient,node_recipe_ingredient,node_utensil,node_difficulty toneMint
class node_persistence toneRose
```

## Components

### Desktop interface

- [Main window](https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/PantallaPrincipal.java): `src/interfaz/PantallaPrincipal.java`
- [Recipe editor](https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/PantallaReceta.java): `src/interfaz/PantallaReceta.java`
- [Recipe finder](https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/PantallaQueCocinar.java): `src/interfaz/PantallaQueCocinar.java`
- [Pantry screen](https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/PantallaAlacena.java): `src/interfaz/PantallaAlacena.java`
- [Inventory screen base](https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/PantallaInventarioBase.java): `src/interfaz/PantallaInventarioBase.java`
- [Utensils screen](https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/PantallaUtensilios.java): `src/interfaz/PantallaUtensilios.java`
- [Window base](https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/BaseWindow.java): `src/interfaz/BaseWindow.java`
- [UI styling](https://github.com/moth-logic/clover-cookbook/blob/main/src/interfaz/EstiloUI.java): `src/interfaz/EstiloUI.java`

### Cookbook services

- [Cookbook manager](https://github.com/moth-logic/clover-cookbook/blob/main/src/control/GestorRecetas.java): `src/control/GestorRecetas.java`
- [Recipe filters](https://github.com/moth-logic/clover-cookbook/blob/main/src/control/FiltroRecetas.java): `src/control/FiltroRecetas.java`
- [Difficulty filter](https://github.com/moth-logic/clover-cookbook/blob/main/src/control/FiltroPorDificultad.java): `src/control/FiltroPorDificultad.java`
- [Duration filter](https://github.com/moth-logic/clover-cookbook/blob/main/src/control/FiltroPorDuracion.java): `src/control/FiltroPorDuracion.java`
- [Tag filter](https://github.com/moth-logic/clover-cookbook/blob/main/src/control/FiltroPorEtiqueta.java): `src/control/FiltroPorEtiqueta.java`
- [Duration range](https://github.com/moth-logic/clover-cookbook/blob/main/src/control/RangoDuracion.java): `src/control/RangoDuracion.java`

### Recipe domain

- [Recipe and validation](https://github.com/moth-logic/clover-cookbook/blob/main/src/logica/Receta.java): `src/logica/Receta.java`
- [Pantry ingredient](https://github.com/moth-logic/clover-cookbook/blob/main/src/logica/Ingrediente.java): `src/logica/Ingrediente.java`
- [Recipe ingredient amount](https://github.com/moth-logic/clover-cookbook/blob/main/src/logica/IngredienteReceta.java): `src/logica/IngredienteReceta.java`
- [Kitchen utensil](https://github.com/moth-logic/clover-cookbook/blob/main/src/logica/Utensilio.java): `src/logica/Utensilio.java`
- [Difficulty levels](https://github.com/moth-logic/clover-cookbook/blob/main/src/logica/Dificultad.java): `src/logica/Dificultad.java`

### Persistence

- [Serialization persistence](https://github.com/moth-logic/clover-cookbook/blob/main/src/control/Persistencia.java): `src/control/Persistencia.java`

### Other components

- **Cookbook user**

## Connections

- Cookbook user → Main window: uses (evidence: `README.md`)
- Main window → Recipe editor: opens (evidence: `src/interfaz/PantallaPrincipal.java`)
- Main window → Recipe finder: opens (evidence: `src/interfaz/PantallaPrincipal.java`)
- Main window → Pantry screen: opens (evidence: `src/interfaz/PantallaPrincipal.java`)
- Main window → Utensils screen: opens (evidence: `src/interfaz/PantallaPrincipal.java`)
- Recipe editor → Cookbook manager: manages recipes (evidence: `src/interfaz/PantallaReceta.java`)
- Recipe finder → Cookbook manager: filters recipes (evidence: `src/interfaz/PantallaQueCocinar.java`)
- Recipe finder → Recipe editor: opens details (evidence: `src/interfaz/PantallaQueCocinar.java`)
- Pantry screen → Inventory screen base: reuses (evidence: `src/interfaz/PantallaAlacena.java`)
- Utensils screen → Inventory screen base: reuses (evidence: `src/interfaz/PantallaUtensilios.java`)
- Inventory screen base → Cookbook manager: manages inventory (evidence: `src/interfaz/PantallaInventarioBase.java`)
- Recipe editor → Window base: extends (evidence: `src/interfaz/PantallaReceta.java`)
- Recipe finder → Window base: extends (evidence: `src/interfaz/PantallaQueCocinar.java`)
- Inventory screen base → Window base: extends (evidence: `src/interfaz/PantallaInventarioBase.java`)
- Recipe editor → UI styling: styles controls (evidence: `src/interfaz/PantallaReceta.java`)
- Recipe finder → UI styling: styles controls (evidence: `src/interfaz/PantallaQueCocinar.java`)
- Cookbook manager → Serialization persistence: saves and loads (evidence: `src/control/GestorRecetas.java`)
- Cookbook manager → Recipe filters: applies (evidence: `src/control/GestorRecetas.java`)
- Difficulty filter → Recipe filters: implements (evidence: `src/control/FiltroPorDificultad.java`)
- Duration filter → Recipe filters: implements (evidence: `src/control/FiltroPorDuracion.java`)
- Tag filter → Recipe filters: implements (evidence: `src/control/FiltroPorEtiqueta.java`)
- Recipe finder → Difficulty filter: selects (evidence: `src/interfaz/PantallaQueCocinar.java`)
- Recipe finder → Duration filter: selects (evidence: `src/interfaz/PantallaQueCocinar.java`)
- Recipe finder → Tag filter: selects (evidence: `src/interfaz/PantallaQueCocinar.java`)
- Duration filter → Duration range: uses range (evidence: `src/control/FiltroPorDuracion.java`)
- Cookbook manager → Recipe and validation: stores and checks (evidence: `src/control/GestorRecetas.java`)
- Recipe and validation → Recipe ingredient amount: contains (evidence: `src/logica/Receta.java`)
- Recipe and validation → Kitchen utensil: contains (evidence: `src/logica/Receta.java`)
- Recipe and validation → Difficulty levels: uses level (evidence: `src/logica/Receta.java`)
- Recipe ingredient amount → Pantry ingredient: references (evidence: `src/logica/IngredienteReceta.java`)
- Recipe editor → Pantry ingredient: edits ingredients (evidence: `src/interfaz/PantallaReceta.java`)
- Recipe editor → Kitchen utensil: edits utensils (evidence: `src/interfaz/PantallaReceta.java`)
- Recipe editor → Difficulty levels: sets difficulty (evidence: `src/interfaz/PantallaReceta.java`)
- Recipe finder → Recipe and validation: shows availability (evidence: `src/interfaz/PantallaQueCocinar.java`)
- Cookbook manager → Pantry ingredient: tracks inventory (evidence: `src/control/GestorRecetas.java`)
- Cookbook manager → Kitchen utensil: tracks inventory (evidence: `src/control/GestorRecetas.java`)
