# kaviselvam31/storeflow architecture

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

- Interactive diagram: https://gitdiagram.com/kaviselvam31/storeflow
- Repository: https://github.com/kaviselvam31/storeflow

## Overview

#### Purpose and Runtime
StoreFlow is a Spring Boot backend for store operations, exposing CRUD-oriented APIs for organizational, catalog, inventory, purchasing, and sales records. The application starts at `src/main/java/com/storeflow/StoreApplication.java`; Maven build and dependency/runtime definition is `pom.xml`. Runtime settings, including the persistence connection configuration, are expected in `src/main/resources/application.properties`.

#### API Boundary
HTTP request handling is split by business resource into Spring controllers. Controllers are the external API boundary and delegate operations to corresponding services:
- Store structure: `src/main/java/com/storeflow/controller/BranchController.java`, `src/main/java/com/storeflow/controller/CategoryController.java`
- Parties: `src/main/java/com/storeflow/controller/CustomerController.java`, `src/main/java/com/storeflow/controller/SupplierController.java`
- Commercial workflows: `src/main/java/com/storeflow/controller/PurchaseController.java`, `src/main/java/com/storeflow/controller/SalesController.java`
- Stock/catalog: `src/main/java/com/storeflow/controller/ProductController.java`, `src/main/java/com/storeflow/controller/InventoryController.java`

#### Domain Model
JPA-style entities model the persisted business records and their relationships:
- Organization and catalog: `src/main/java/com/storeflow/entity/Branch.java`, `src/main/java/com/storeflow/entity/Category.java`, `src/main/java/com/storeflow/entity/Product.java`
- Supply and stock: `src/main/java/com/storeflow/entity/Supplier.java`, `src/main/java/com/storeflow/entity/Purchase.java`, `src/main/java/com/storeflow/entity/PurchaseItem.java`, `src/main/java/com/storeflow/entity/Inventory.java`
- Demand: `src/main/java/com/storeflow/entity/Customer.java`, `src/main/java/com/storeflow/entity/Sales.java`

The README specifically notes review of Product soft delete, making product lifecycle behavior a material catalog concern.

#### Service Layer
Services form the application/business boundary between controllers and persistence. Each primary resource has a dedicated service, including `src/main/java/com/storeflow/service/ProductService.java`, `src/main/java/com/storeflow/service/InventoryService.java`, and `src/main/java/com/storeflow/service/PurchaseService.java`. This layout indicates CRUD validation and lifecycle logic should reside here rather than in HTTP controllers or repositories.

#### Persistence Layer
Repository interfaces isolate entity storage access and are the boundary to the configured relational database/JPA provider:
- Core master data: `src/main/java/com/storeflow/repository/BranchRepository.java`, `src/main/java/com/storeflow/repository/ProductRepository.java`
- Transactional records: `src/main/java/com/storeflow/repository/PurchaseRepository.java`, `src/main/java/com/storeflow/repository/PurchaseItemRepository.java`, `src/main/java/com/storeflow/repository/SalesRepository.java`
- Stock: `src/main/java/com/storeflow/repository/InventoryRepository.java`

#### Primary Flow and Dependencies
The dominant control flow is controller → service → repository → database, returning entity-backed API responses. Catalog and supplier data support purchase records; purchases are decomposed into purchase items; inventory represents stocked products; customer and product data support sales records. Branches provide the store-location dimension across operational records. The important architectural boundaries are HTTP controllers, service-managed business logic, and repositories backed by infrastructure configured through `application.properties`.

Main entry points: [`src/main/java/com/storeflow/entity/Product.java`](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Product.java) (Product), [`src/main/java/com/storeflow/entity/Branch.java`](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Branch.java) (Branch), [`src/main/java/com/storeflow/entity/Purchase.java`](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Purchase.java) (Purchase), [`src/main/java/com/storeflow/entity/Sales.java`](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Sales.java) (Sales)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_maven["Maven Build<br/>build definition<br/>[pom.xml]"]
  node_application{{"StoreApplication<br/>Spring Boot entrypoint"}}
  node_settings["Runtime Settings<br/>Spring properties"]
end

subgraph group_api["HTTP API"]
  node_controllers["Resource Controllers<br/>HTTP API boundary"]
end

subgraph group_application["Application Services"]
  node_product_service["Product Service<br/>catalog service"]
  node_inventory_service["Inventory Service<br/>stock service"]
  node_purchase_service["Purchase Service<br/>purchasing service"]
  node_other_services["Other Resource Services<br/>business services"]
end

subgraph group_domain["Domain Model"]
  node_branch["Branch<br/>JPA entity<br/>[Branch.java]"]
  node_category["Category<br/>JPA entity<br/>[Category.java]"]
  node_product["Product<br/>JPA entity<br/>[Product.java]"]
  node_supplier["Supplier<br/>JPA entity<br/>[Supplier.java]"]
  node_purchase["Purchase<br/>JPA entity<br/>[Purchase.java]"]
  node_purchase_item["Purchase Item<br/>JPA entity<br/>[PurchaseItem.java]"]
  node_inventory["Inventory<br/>JPA entity<br/>[Inventory.java]"]
  node_customer["Customer<br/>JPA entity<br/>[Customer.java]"]
  node_sales["Sales<br/>JPA entity<br/>[Sales.java]"]
end

subgraph group_persistence["Persistence"]
  node_product_repository["Product Repository<br/>JPA repository"]
  node_inventory_repository["Inventory Repository<br/>JPA repository"]
  node_purchase_repository["Purchase Repositories<br/>JPA repositories"]
  node_other_repositories["Other Repositories<br/>JPA repositories"]
  node_database[("Relational Database<br/>configured JPA datastore")]
end

node_maven -->|"builds"| node_application
node_application -->|"boots"| node_controllers
node_controllers -->|"delegates catalog requests"| node_product_service
node_controllers -->|"delegates stock requests"| node_inventory_service
node_controllers -->|"delegates purchase requests"| node_purchase_service
node_controllers -->|"delegates other resources"| node_other_services
node_product_service -->|"persists products"| node_product_repository
node_inventory_service -->|"persists stock"| node_inventory_repository
node_purchase_service -->|"persists purchases"| node_purchase_repository
node_other_services -->|"persists resources"| node_other_repositories
node_product_repository -->|"JPA access"| node_database
node_inventory_repository -->|"JPA access"| node_database
node_purchase_repository -->|"JPA access"| node_database
node_other_repositories -->|"JPA access"| node_database
node_settings -.->|"connection configuration"| node_database
node_product -->|"classified by"| node_category
node_purchase -->|"sourced from"| node_supplier
node_purchase -->|"contains"| node_purchase_item
node_purchase_item -->|"references"| node_product
node_inventory -->|"stocks"| node_product
node_sales -->|"sold to"| node_customer
node_sales -->|"references"| node_product
node_branch -.->|"operational location"| node_purchase
node_branch -.->|"operational location"| node_inventory
node_branch -.->|"operational location"| node_sales

click node_maven "https://github.com/kaviselvam31/storeflow/blob/main/pom.xml"
click node_application "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/StoreApplication.java"
click node_settings "https://github.com/kaviselvam31/storeflow/blob/main/src/main/resources/application.properties"
click node_product_service "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/service/ProductService.java"
click node_inventory_service "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/service/InventoryService.java"
click node_purchase_service "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/service/PurchaseService.java"
click node_branch "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Branch.java"
click node_category "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Category.java"
click node_product "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Product.java"
click node_supplier "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Supplier.java"
click node_purchase "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Purchase.java"
click node_purchase_item "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/PurchaseItem.java"
click node_inventory "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Inventory.java"
click node_customer "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Customer.java"
click node_sales "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Sales.java"
click node_product_repository "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/repository/ProductRepository.java"
click node_inventory_repository "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/repository/InventoryRepository.java"
click node_purchase_repository "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/repository/PurchaseRepository.java"
click node_other_repositories "https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/repository/BranchRepository.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_maven,node_application,node_settings toneBlue
class node_controllers toneAmber
class node_product_service,node_inventory_service,node_purchase_service,node_other_services toneMint
class node_branch,node_category,node_product,node_supplier,node_purchase,node_purchase_item,node_inventory,node_customer,node_sales toneRose
class node_product_repository,node_inventory_repository,node_purchase_repository,node_other_repositories,node_database toneIndigo
```

## Components

### Runtime

- [Maven Build](https://github.com/kaviselvam31/storeflow/blob/main/pom.xml): build definition · `pom.xml`
- [StoreApplication](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/StoreApplication.java): Spring Boot entrypoint · `src/main/java/com/storeflow/StoreApplication.java`
- [Runtime Settings](https://github.com/kaviselvam31/storeflow/blob/main/src/main/resources/application.properties): Spring properties · Configures the persistence connection. · `src/main/resources/application.properties`

### HTTP API

- **Resource Controllers**: HTTP API boundary · Branch, category, customer, supplier, purchase, sales, product, and inventory endpoints.

### Application Services

- [Product Service](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/service/ProductService.java): catalog service · Owns product lifecycle logic, including soft-delete behavior. · `src/main/java/com/storeflow/service/ProductService.java`
- [Inventory Service](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/service/InventoryService.java): stock service · `src/main/java/com/storeflow/service/InventoryService.java`
- [Purchase Service](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/service/PurchaseService.java): purchasing service · `src/main/java/com/storeflow/service/PurchaseService.java`
- **Other Resource Services**: business services · Services for branches, categories, customers, suppliers, and sales.

### Domain Model

- [Branch](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Branch.java): JPA entity · Store-location dimension for operations. · `src/main/java/com/storeflow/entity/Branch.java`
- [Category](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Category.java): JPA entity · `src/main/java/com/storeflow/entity/Category.java`
- [Product](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Product.java): JPA entity · `src/main/java/com/storeflow/entity/Product.java`
- [Supplier](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Supplier.java): JPA entity · `src/main/java/com/storeflow/entity/Supplier.java`
- [Purchase](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Purchase.java): JPA entity · `src/main/java/com/storeflow/entity/Purchase.java`
- [Purchase Item](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/PurchaseItem.java): JPA entity · Line items that decompose a purchase. · `src/main/java/com/storeflow/entity/PurchaseItem.java`
- [Inventory](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Inventory.java): JPA entity · Stocked product records. · `src/main/java/com/storeflow/entity/Inventory.java`
- [Customer](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Customer.java): JPA entity · `src/main/java/com/storeflow/entity/Customer.java`
- [Sales](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/entity/Sales.java): JPA entity · `src/main/java/com/storeflow/entity/Sales.java`

### Persistence

- [Product Repository](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/repository/ProductRepository.java): JPA repository · `src/main/java/com/storeflow/repository/ProductRepository.java`
- [Inventory Repository](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/repository/InventoryRepository.java): JPA repository · `src/main/java/com/storeflow/repository/InventoryRepository.java`
- [Purchase Repositories](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/repository/PurchaseRepository.java): JPA repositories · Stores purchases and their line items. · `src/main/java/com/storeflow/repository/PurchaseRepository.java`
- [Other Repositories](https://github.com/kaviselvam31/storeflow/blob/main/src/main/java/com/storeflow/repository/BranchRepository.java): JPA repositories · Storage access for branches, sales, and other master data. · `src/main/java/com/storeflow/repository/BranchRepository.java`
- **Relational Database**: configured JPA datastore

## Connections

- Maven Build → StoreApplication: builds
- StoreApplication → Resource Controllers: boots
- Resource Controllers → Product Service: delegates catalog requests
- Resource Controllers → Inventory Service: delegates stock requests
- Resource Controllers → Purchase Service: delegates purchase requests
- Resource Controllers → Other Resource Services: delegates other resources
- Product Service → Product Repository: persists products
- Inventory Service → Inventory Repository: persists stock
- Purchase Service → Purchase Repositories: persists purchases
- Other Resource Services → Other Repositories: persists resources
- Product Repository → Relational Database: JPA access
- Inventory Repository → Relational Database: JPA access
- Purchase Repositories → Relational Database: JPA access
- Other Repositories → Relational Database: JPA access
- Runtime Settings → Relational Database: connection configuration
- Product → Category: classified by
- Purchase → Supplier: sourced from
- Purchase → Purchase Item: contains
- Purchase Item → Product: references
- Inventory → Product: stocks
- Sales → Customer: sold to
- Sales → Product: references
- Branch → Purchase: operational location
- Branch → Inventory: operational location
- Branch → Sales: operational location
