# thanu-san/inventorymanagementsystem architecture

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

- Interactive diagram: https://gitdiagram.com/thanu-san/inventorymanagementsystem
- Repository: https://github.com/thanu-san/inventorymanagementsystem

## Overview

StockFlow is a console-based product inventory manager. A user enters the main menu, opens product management, and uses the controller to create, list, find, update, or delete products; the service validates and coordinates repository operations, and the selected repository stores product state. The current startup wiring selects in-memory storage. JDBC connection support exists, but the JDBC repository is incomplete and is not selected by Main. The README also describes stock movements, audit, reporting, categories, suppliers, and security as future work; those capabilities have no implementation paths in the supplied tree.

Main entry points: [`src/main/java/com/stockflow/service/ProductService.java`](https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/service/ProductService.java) (Product service), [`src/main/java/com/stockflow/Main.java`](https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/Main.java) (Application entry), [`src/main/java/com/stockflow/controller/ProductController.java`](https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/controller/ProductController.java) (Product menu), [`src/main/java/com/stockflow/repository/InMemoryProductRepository.java`](https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/repository/InMemoryProductRepository.java) (In-memory store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Console interface"]
  node_main["Application entry<br/>[Main.java]"]
  node_controller["Product menu"]
end

subgraph group_business["Product domain"]
  node_service["Product service"]
  node_product["Product entity<br/>[Product.java]"]
  node_validation["Validation errors"]
end

subgraph group_persistence["Persistence"]
  node_repository["Repository contract"]
  node_memory[("In-memory store")]
  node_jdbc[("JDBC repository")]
  node_connection["DB connection"]
end

subgraph group_roadmap["Planned capabilities"]
  node_planned_ops["Stock movements"]
  node_planned_audit[("Audit records")]
  node_planned_reporting["Alerts and reports"]
  node_planned_catalog["Categories and suppliers"]
  node_planned_security["Authentication and roles"]
end

node_user(("Terminal user"))
node_postgres[("PostgreSQL")]

node_user -->|"chooses menu"| node_main
node_main -->|"opens menu"| node_controller
node_main -->|"selects store"| node_memory
node_main -->|"wires service"| node_service
node_controller -->|"dispatches actions"| node_service
node_service -->|"uses contract"| node_repository
node_memory -->|"implements"| node_repository
node_jdbc -->|"implements"| node_repository
node_service -->|"creates and updates"| node_product
node_service -->|"throws"| node_validation
node_controller -->|"handles errors"| node_validation
node_memory -->|"stores products"| node_product
node_jdbc -->|"gets connection"| node_connection
node_connection -->|"opens JDBC connection"| node_postgres

click node_main "https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/Main.java"
click node_controller "https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/controller/ProductController.java"
click node_service "https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/service/ProductService.java"
click node_product "https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/model/Product.java"
click node_validation "https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/exception/ValidationException.java"
click node_repository "https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/repository/ProductRepository.java"
click node_memory "https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/repository/InMemoryProductRepository.java"
click node_jdbc "https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/repository/JdbcProductRepository.java"
click node_connection "https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/database/DatabaseConnection.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_main,node_controller,node_user toneBlue
class node_service,node_product,node_validation,node_postgres toneAmber
class node_repository,node_memory,node_jdbc,node_connection toneMint
class node_planned_ops,node_planned_audit,node_planned_reporting,node_planned_catalog,node_planned_security toneRose
```

## Components

### Console interface

- [Application entry](https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/Main.java): `src/main/java/com/stockflow/Main.java`
- [Product menu](https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/controller/ProductController.java): `src/main/java/com/stockflow/controller/ProductController.java`

### Product domain

- [Product service](https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/service/ProductService.java): `src/main/java/com/stockflow/service/ProductService.java`
- [Product entity](https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/model/Product.java): `src/main/java/com/stockflow/model/Product.java`
- [Validation errors](https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/exception/ValidationException.java): `src/main/java/com/stockflow/exception/ValidationException.java`

### Persistence

- [Repository contract](https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/repository/ProductRepository.java): `src/main/java/com/stockflow/repository/ProductRepository.java`
- [In-memory store](https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/repository/InMemoryProductRepository.java): `src/main/java/com/stockflow/repository/InMemoryProductRepository.java`
- [JDBC repository](https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/repository/JdbcProductRepository.java): `src/main/java/com/stockflow/repository/JdbcProductRepository.java`
- [DB connection](https://github.com/thanu-san/inventorymanagementsystem/blob/main/src/main/java/com/stockflow/database/DatabaseConnection.java): `src/main/java/com/stockflow/database/DatabaseConnection.java`

### Planned capabilities

- **Stock movements**
- **Audit records**
- **Alerts and reports**
- **Categories and suppliers**
- **Authentication and roles**

### Other components

- **Terminal user**
- **PostgreSQL**

## Connections

- Terminal user → Application entry: chooses menu (evidence: `src/main/java/com/stockflow/Main.java`)
- Application entry → Product menu: opens menu (evidence: `src/main/java/com/stockflow/Main.java`)
- Application entry → In-memory store: selects store (evidence: `src/main/java/com/stockflow/Main.java`)
- Application entry → Product service: wires service (evidence: `src/main/java/com/stockflow/Main.java`)
- Product menu → Product service: dispatches actions (evidence: `src/main/java/com/stockflow/controller/ProductController.java`)
- Product service → Repository contract: uses contract (evidence: `src/main/java/com/stockflow/service/ProductService.java`)
- In-memory store → Repository contract: implements (evidence: `src/main/java/com/stockflow/repository/InMemoryProductRepository.java`)
- JDBC repository → Repository contract: implements (evidence: `src/main/java/com/stockflow/repository/JdbcProductRepository.java`)
- Product service → Product entity: creates and updates (evidence: `src/main/java/com/stockflow/service/ProductService.java`)
- Product service → Validation errors: throws (evidence: `src/main/java/com/stockflow/service/ProductService.java`)
- Product menu → Validation errors: handles errors (evidence: `src/main/java/com/stockflow/controller/ProductController.java`)
- In-memory store → Product entity: stores products (evidence: `src/main/java/com/stockflow/repository/InMemoryProductRepository.java`)
- JDBC repository → DB connection: gets connection (evidence: `src/main/java/com/stockflow/repository/JdbcProductRepository.java`)
- DB connection → PostgreSQL: opens JDBC connection (evidence: `src/main/java/com/stockflow/database/DatabaseConnection.java`)
