# mxavier-dev/vending-machine architecture

> Architecture diagram of the GitHub repository mxavier-dev/vending-machine, 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/mxavier-dev/vending-machine
- Repository: https://github.com/mxavier-dev/vending-machine

## Overview

This repository is a small vending-machine simulator offered as separate English and Portuguese CustomTkinter applications. In each version, a user selects products, adjusts the cart while stock changes, enters payment, and finalizes a purchase; the purchase handler validates payment, calculates change when due, and resets the cart. The excerpts show the UI callbacks and change-calculation calls. Each node represents responsibilities within a single script, not a separately implemented module.

Main entry points: [`vending_machine_EN.py`](https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_EN.py) (English UI), [`vending_machine_PT-BR.py`](https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_PT-BR.py) (Portuguese UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["User interaction"]
  node_en_ui["English UI"]
  node_pt_ui["Portuguese UI"]
end

subgraph group_purchase["Cart and purchase"]
  node_en_cart["English cart and stock"]
  node_en_checkout["English checkout"]
  node_pt_cart["Portuguese cart and stock"]
  node_pt_checkout["Portuguese checkout"]
end

subgraph group_change["Change calculation"]
  node_en_change["English change helpers"]
  node_pt_change["Portuguese change helpers"]
end

node_user(("Customer"))

node_user -->|"uses"| node_en_ui
node_en_ui -->|"adjusts cart"| node_en_cart
node_en_ui -->|"finalizes purchase"| node_en_checkout
node_en_checkout -->|"calculates change"| node_en_change
node_user -->|"uses"| node_pt_ui
node_pt_ui -->|"adjusts cart"| node_pt_cart
node_pt_ui -->|"finalizes purchase"| node_pt_checkout
node_pt_checkout -->|"calculates change"| node_pt_change

click node_en_ui "https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_EN.py"
click node_en_cart "https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_EN.py"
click node_en_checkout "https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_EN.py"
click node_en_change "https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_EN.py"
click node_pt_ui "https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_PT-BR.py"
click node_pt_cart "https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_PT-BR.py"
click node_pt_checkout "https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_PT-BR.py"
click node_pt_change "https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_PT-BR.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_en_ui,node_pt_ui toneBlue
class node_en_cart,node_en_checkout,node_pt_cart,node_pt_checkout toneAmber
class node_en_change,node_pt_change toneMint
class node_user toneIndigo
```

## Components

### User interaction

- [English UI](https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_EN.py): `vending_machine_EN.py`
- [Portuguese UI](https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_PT-BR.py): `vending_machine_PT-BR.py`

### Cart and purchase

- [English cart and stock](https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_EN.py): `vending_machine_EN.py`
- [English checkout](https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_EN.py): `vending_machine_EN.py`
- [Portuguese cart and stock](https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_PT-BR.py): `vending_machine_PT-BR.py`
- [Portuguese checkout](https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_PT-BR.py): `vending_machine_PT-BR.py`

### Change calculation

- [English change helpers](https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_EN.py): `vending_machine_EN.py`
- [Portuguese change helpers](https://github.com/mxavier-dev/vending-machine/blob/main/vending_machine_PT-BR.py): `vending_machine_PT-BR.py`

### Other components

- **Customer**

## Connections

- Customer → English UI: uses (evidence: `README.md`)
- English UI → English cart and stock: adjusts cart (evidence: `vending_machine_EN.py`)
- English UI → English checkout: finalizes purchase (evidence: `vending_machine_EN.py`)
- English checkout → English change helpers: calculates change (evidence: `vending_machine_EN.py`)
- Customer → Portuguese UI: uses (evidence: `README.md`)
- Portuguese UI → Portuguese cart and stock: adjusts cart (evidence: `vending_machine_PT-BR.py`)
- Portuguese UI → Portuguese checkout: finalizes purchase (evidence: `vending_machine_PT-BR.py`)
- Portuguese checkout → Portuguese change helpers: calculates change (evidence: `vending_machine_PT-BR.py`)
