# jjasmine202/minimart-inventory architecture

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

- Interactive diagram: https://gitdiagram.com/jjasmine202/minimart-inventory
- Repository: https://github.com/jjasmine202/minimart-inventory

## Overview

MiniMart-Inventory is a Java console application for staff inventory management and customer checkout. Staff use the console to maintain products, adjust stock, and view low-stock, inventory, and transaction reports. Customers browse or search products, build a cart, confirm a purchase, optionally receive a loyalty discount, and get a printed and saved receipt. Inventory and transaction history are held in application memory. The excerpts show the main calls; some checkout-to-inventory sale handling is not visible, so that link is marked unverified.

Main entry points: [`src/Inventory.java`](https://github.com/jjasmine202/minimart-inventory/blob/main/src/Inventory.java) (Inventory and reports), [`src/InventoryApp.java`](https://github.com/jjasmine202/minimart-inventory/blob/main/src/InventoryApp.java) (Console application), [`src/Product.java`](https://github.com/jjasmine202/minimart-inventory/blob/main/src/Product.java) (Product base), [`src/Cart.java`](https://github.com/jjasmine202/minimart-inventory/blob/main/src/Cart.java) (Customer cart)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Console workflow"]
  node_app["Console application<br/>[InventoryApp.java]"]
end

subgraph group_inventory["Inventory operations"]
  node_inventory_service["Inventory and reports<br/>[Inventory.java]"]
  node_transaction["Stock transaction"]
end

subgraph group_products["Product model"]
  node_product["Product base<br/>[Product.java]"]
  node_food["Food item<br/>[FoodItem.java]"]
  node_beverage["Beverage item<br/>[BeverageItem.java]"]
  node_toiletry["Toiletry item<br/>[ToiletryItem.java]"]
end

subgraph group_checkout["Checkout"]
  node_cart["Customer cart<br/>[Cart.java]"]
  node_loyalty["Loyalty discount"]
  node_receipt["Receipt output<br/>[ReceiptWriter.java]"]
end

node_user(("Staff or customer"))

node_user -->|"uses"| node_app
node_app -->|"manages inventory"| node_inventory_service
node_app -->|"builds cart"| node_cart
node_app -->|"checks discount"| node_loyalty
node_app -->|"creates receipt"| node_receipt
node_inventory_service -->|"records changes"| node_transaction
node_inventory_service -->|"manages products"| node_product
node_inventory_service -->|"loads samples"| node_food
node_inventory_service -->|"loads samples"| node_beverage
node_inventory_service -->|"loads samples"| node_toiletry
node_food -->|"extends"| node_product
node_beverage -->|"extends"| node_product
node_toiletry -->|"extends"| node_product
node_cart -->|"prices items"| node_product
node_receipt -->|"formats lines"| node_cart
node_app -.->|"records sale"| node_inventory_service

click node_app "https://github.com/jjasmine202/minimart-inventory/blob/main/src/InventoryApp.java"
click node_inventory_service "https://github.com/jjasmine202/minimart-inventory/blob/main/src/Inventory.java"
click node_transaction "https://github.com/jjasmine202/minimart-inventory/blob/main/src/StockTransaction.java"
click node_product "https://github.com/jjasmine202/minimart-inventory/blob/main/src/Product.java"
click node_food "https://github.com/jjasmine202/minimart-inventory/blob/main/src/FoodItem.java"
click node_beverage "https://github.com/jjasmine202/minimart-inventory/blob/main/src/BeverageItem.java"
click node_toiletry "https://github.com/jjasmine202/minimart-inventory/blob/main/src/ToiletryItem.java"
click node_cart "https://github.com/jjasmine202/minimart-inventory/blob/main/src/Cart.java"
click node_loyalty "https://github.com/jjasmine202/minimart-inventory/blob/main/src/LoyaltyProgram.java"
click node_receipt "https://github.com/jjasmine202/minimart-inventory/blob/main/src/ReceiptWriter.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_app toneBlue
class node_inventory_service,node_transaction toneAmber
class node_product,node_food,node_beverage,node_toiletry toneMint
class node_cart,node_loyalty,node_receipt toneRose
class node_user toneIndigo
```

## Components

### Console workflow

- [Console application](https://github.com/jjasmine202/minimart-inventory/blob/main/src/InventoryApp.java): `src/InventoryApp.java`

### Inventory operations

- [Inventory and reports](https://github.com/jjasmine202/minimart-inventory/blob/main/src/Inventory.java): `src/Inventory.java`
- [Stock transaction](https://github.com/jjasmine202/minimart-inventory/blob/main/src/StockTransaction.java): `src/StockTransaction.java`

### Product model

- [Product base](https://github.com/jjasmine202/minimart-inventory/blob/main/src/Product.java): `src/Product.java`
- [Food item](https://github.com/jjasmine202/minimart-inventory/blob/main/src/FoodItem.java): `src/FoodItem.java`
- [Beverage item](https://github.com/jjasmine202/minimart-inventory/blob/main/src/BeverageItem.java): `src/BeverageItem.java`
- [Toiletry item](https://github.com/jjasmine202/minimart-inventory/blob/main/src/ToiletryItem.java): `src/ToiletryItem.java`

### Checkout

- [Customer cart](https://github.com/jjasmine202/minimart-inventory/blob/main/src/Cart.java): `src/Cart.java`
- [Loyalty discount](https://github.com/jjasmine202/minimart-inventory/blob/main/src/LoyaltyProgram.java): `src/LoyaltyProgram.java`
- [Receipt output](https://github.com/jjasmine202/minimart-inventory/blob/main/src/ReceiptWriter.java): `src/ReceiptWriter.java`

### Other components

- **Staff or customer**

## Connections

- Staff or customer → Console application: uses (evidence: `README.md`)
- Console application → Inventory and reports: manages inventory (evidence: `src/InventoryApp.java`)
- Console application → Customer cart: builds cart (evidence: `src/InventoryApp.java`)
- Console application → Loyalty discount: checks discount (evidence: `src/InventoryApp.java`)
- Console application → Receipt output: creates receipt (evidence: `src/InventoryApp.java`)
- Inventory and reports → Stock transaction: records changes (evidence: `src/Inventory.java`)
- Inventory and reports → Product base: manages products (evidence: `src/Inventory.java`)
- Inventory and reports → Food item: loads samples (evidence: `src/Inventory.java`)
- Inventory and reports → Beverage item: loads samples (evidence: `src/Inventory.java`)
- Inventory and reports → Toiletry item: loads samples (evidence: `src/Inventory.java`)
- Food item → Product base: extends (evidence: `src/FoodItem.java`)
- Beverage item → Product base: extends (evidence: `src/BeverageItem.java`)
- Toiletry item → Product base: extends (evidence: `src/ToiletryItem.java`)
- Customer cart → Product base: prices items (evidence: `src/Cart.java`)
- Receipt output → Customer cart: formats lines (evidence: `src/ReceiptWriter.java`)
- Console application → Inventory and reports: records sale (evidence: `src/InventoryApp.java`)
