# jhinico/grocery-project architecture

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

- Interactive diagram: https://gitdiagram.com/jhinico/grocery-project
- Repository: https://github.com/jhinico/grocery-project

## Overview

Grocery-Project is a small, console-based Java grocery-store OOP exercise. A user enters through the Java application, selects a role, and then manages inventory or uses a shopping cart to review and check out products; store state also gates customer access and product removal. The active Java files are mapped, while Old-files contains a separate earlier version. The README gives no further capability detail, and the dispatcher and restocker implementation were not excerpted, so those connections are left unverified rather than inferred.

Main entry points: [`Java/Logic_Gate.java`](https://github.com/jhinico/grocery-project/blob/updated-version/Java/Logic_Gate.java) (Role dispatcher), [`Java/Inventory.java`](https://github.com/jhinico/grocery-project/blob/updated-version/Java/Inventory.java) (Inventory management), [`Java/Manager_Admin.java`](https://github.com/jhinico/grocery-project/blob/updated-version/Java/Manager_Admin.java) (Manager workflow), [`Java/StoreState.java`](https://github.com/jhinico/grocery-project/blob/updated-version/Java/StoreState.java) (Store state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_grocery["Application entry<br/>[Grocery.java]"]
  node_dispatcher["Role dispatcher<br/>[Logic_Gate.java]"]
end

subgraph group_roles["Store roles"]
  node_manager["Manager workflow<br/>[Manager_Admin.java]"]
  node_customer["Customer workflow<br/>[Customer.java]"]
  node_restocker["Restocker workflow<br/>[Re_stocker.java]"]
  node_storestate["Store state<br/>[StoreState.java]"]
end

subgraph group_commerce["Shopping and stock"]
  node_inventory["Inventory management<br/>[Inventory.java]"]
  node_cart["Shopping cart<br/>[ShoppingCart.java]"]
  node_cartitem["Cart item<br/>[CartItem.java]"]
end

subgraph group_domain["Store domain"]
  node_product["Product model<br/>[Product.java]"]
end

node_user(("Console user"))

node_user -->|"starts"| node_grocery
node_grocery -->|"runs"| node_dispatcher
node_dispatcher -.->|"dispatches"| node_manager
node_dispatcher -.->|"dispatches"| node_customer
node_dispatcher -.->|"dispatches"| node_restocker
node_manager -->|"manages"| node_inventory
node_manager -->|"controls"| node_storestate
node_customer -->|"operates"| node_cart
node_storestate -->|"allows"| node_customer
node_storestate -->|"gates removal"| node_inventory
node_cart -->|"reads products"| node_inventory
node_cart -->|"creates"| node_cartitem
node_inventory -->|"creates"| node_product

click node_grocery "https://github.com/jhinico/grocery-project/blob/updated-version/Java/Grocery.java"
click node_dispatcher "https://github.com/jhinico/grocery-project/blob/updated-version/Java/Logic_Gate.java"
click node_manager "https://github.com/jhinico/grocery-project/blob/updated-version/Java/Manager_Admin.java"
click node_customer "https://github.com/jhinico/grocery-project/blob/updated-version/Java/Customer.java"
click node_restocker "https://github.com/jhinico/grocery-project/blob/updated-version/Java/Re_stocker.java"
click node_storestate "https://github.com/jhinico/grocery-project/blob/updated-version/Java/StoreState.java"
click node_inventory "https://github.com/jhinico/grocery-project/blob/updated-version/Java/Inventory.java"
click node_cart "https://github.com/jhinico/grocery-project/blob/updated-version/Java/ShoppingCart.java"
click node_cartitem "https://github.com/jhinico/grocery-project/blob/updated-version/Java/CartItem.java"
click node_product "https://github.com/jhinico/grocery-project/blob/updated-version/Java/Product.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_grocery,node_dispatcher,node_user toneBlue
class node_manager,node_customer,node_restocker,node_storestate toneAmber
class node_inventory,node_cart,node_cartitem toneMint
class node_product toneRose
```

## Components

### Application entry

- [Application entry](https://github.com/jhinico/grocery-project/blob/updated-version/Java/Grocery.java): `Java/Grocery.java`
- [Role dispatcher](https://github.com/jhinico/grocery-project/blob/updated-version/Java/Logic_Gate.java): `Java/Logic_Gate.java`

### Store roles

- [Manager workflow](https://github.com/jhinico/grocery-project/blob/updated-version/Java/Manager_Admin.java): `Java/Manager_Admin.java`
- [Customer workflow](https://github.com/jhinico/grocery-project/blob/updated-version/Java/Customer.java): `Java/Customer.java`
- [Restocker workflow](https://github.com/jhinico/grocery-project/blob/updated-version/Java/Re_stocker.java): `Java/Re_stocker.java`
- [Store state](https://github.com/jhinico/grocery-project/blob/updated-version/Java/StoreState.java): `Java/StoreState.java`

### Shopping and stock

- [Inventory management](https://github.com/jhinico/grocery-project/blob/updated-version/Java/Inventory.java): `Java/Inventory.java`
- [Shopping cart](https://github.com/jhinico/grocery-project/blob/updated-version/Java/ShoppingCart.java): `Java/ShoppingCart.java`
- [Cart item](https://github.com/jhinico/grocery-project/blob/updated-version/Java/CartItem.java): `Java/CartItem.java`

### Store domain

- [Product model](https://github.com/jhinico/grocery-project/blob/updated-version/Java/Product.java): `Java/Product.java`

### Other components

- **Console user**

## Connections

- Console user → Application entry: starts (evidence: `Java/Grocery.java`)
- Application entry → Role dispatcher: runs (evidence: `Java/Grocery.java`)
- Role dispatcher → Manager workflow: dispatches
- Role dispatcher → Customer workflow: dispatches
- Role dispatcher → Restocker workflow: dispatches
- Manager workflow → Inventory management: manages (evidence: `Java/Manager_Admin.java`)
- Manager workflow → Store state: controls (evidence: `Java/Manager_Admin.java`)
- Customer workflow → Shopping cart: operates (evidence: `Java/Customer.java`)
- Store state → Customer workflow: allows (evidence: `Java/StoreState.java`)
- Store state → Inventory management: gates removal (evidence: `Java/StoreState.java`)
- Shopping cart → Inventory management: reads products (evidence: `Java/ShoppingCart.java`)
- Shopping cart → Cart item: creates (evidence: `Java/ShoppingCart.java`)
- Inventory management → Product model: creates (evidence: `Java/Inventory.java`)
