# scarab1220/inventario_python architecture

> Architecture diagram of the GitHub repository scarab1220/inventario_python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/scarab1220/inventario_python
- Repository: https://github.com/scarab1220/inventario_python

## Overview

##### Project type and purpose
- This is a lightweight desktop full-stack application (single binary) written in Python, implementing an inventory management system with CRUD operations.
- It uses a Tkinter-based GUI for user interaction and persists data to a local JSON/text file.

##### File structure
- Top-level:
- .gitignore, requirements.txt
- data/ (contains datos.json)
- src/
- src/ breakdown:
- gui.py         → View (Tkinter forms, dialogs, buttons)
- inventario.py  → Controller/Service (CRUD logic + orchestration)
- producto.py    → Domain Model (Product class with id, name, quantity, price)
- storage.py     → Data Access Layer (read/write JSON/text file)
- main.py        → Application bootstrap (initializes storage, model, GUI)
- data/datos.json stores the persistent inventory.

##### README for additional insights
- Confirms functionality: create/read/update/delete products, automatic file save, friendly GUI.
- Lists Python 3.10+, uses only standard libs (`tkinter`, `os`).
- Mentions file “datos.txt” (in practice JSON file under data/).

## Diagram (Mermaid)

```mermaid
flowchart TD
    UB["User Desktop"]:::external
    AB["Application Bootstrap\n(src/main.py)"]:::bootstrap
    GUI["GUI Layer\n(src/gui.py)"]:::gui
    CTRL["Inventory Service\n(src/inventario.py)"]:::ctrl
    MODEL["Product Model\n(src/producto.py)"]:::model
    DAL["Storage Layer\n(src/storage.py)"]:::storage
    FS["Persistent JSON\n(data/datos.json)"]:::fs

    UB --> AB
    AB --> GUI
    AB --> CTRL
    AB --> DAL
    AB --> MODEL

    GUI -->|"user actions"| CTRL
    CTRL -->|"creates/manages instances"| MODEL
    CTRL -->|"load_products() / save(data)"| DAL
    DAL -->|"read/write JSON"| FS

    FS -.->|"(data)"| DAL
    DAL -.->|"(data)"| CTRL
    CTRL -.->|"(data)"| GUI

    click AB "https://github.com/scarab1220/inventario_python/blob/main/src/main.py"
    click GUI "https://github.com/scarab1220/inventario_python/blob/main/src/gui.py"
    click CTRL "https://github.com/scarab1220/inventario_python/blob/main/src/inventario.py"
    click MODEL "https://github.com/scarab1220/inventario_python/blob/main/src/producto.py"
    click DAL "https://github.com/scarab1220/inventario_python/blob/main/src/storage.py"
    click FS "https://github.com/scarab1220/inventario_python/blob/main/data/datos.json"

    classDef gui fill:#ADD8E6,stroke:#000
    classDef ctrl fill:#90EE90,stroke:#000
    classDef model fill:#FFFFE0,stroke:#000
    classDef storage fill:#FFA500,stroke:#000
    classDef fs fill:#D3D3D3,stroke:#000
    classDef bootstrap fill:#D8BFD8,stroke:#000
    classDef external fill:#FFFFFF,stroke:#000,stroke-dasharray: 5 5
```
