# vatanak-dev/store-management-api architecture

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

- Interactive diagram: https://gitdiagram.com/vatanak-dev/store-management-api
- Repository: https://github.com/vatanak-dev/store-management-api

## Overview

Store Management API exposes product and category management plus account registration and authentication. The main workflow is HTTP product requests through controllers, service logic, mapping and persistence, returning DTOs; product search adds dynamic filtering and pagination, while stock and status updates are distinct operations. The README also documents Swagger and validation. Source excerpts chiefly show product and user service behavior; category, security wiring, and some endpoints are represented where indexed or documented, so unsupported internal links are omitted.

Main entry points: [`src/main/java/com/vdev/service/ProductService.java`](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/service/ProductService.java) (Product operations), [`src/main/java/com/vdev/repository/UserRepository.java`](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/repository/UserRepository.java) (User repository), [`src/main/java/com/vdev/service/CategoryService.java`](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/service/CategoryService.java) (Category operations), [`src/main/java/com/vdev/repository/CategoryRepository.java`](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/repository/CategoryRepository.java) (Category repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API endpoints"]
  node_product_api["Product endpoints"]
  node_category_api["Category endpoints"]
  node_user_api["User registration"]
  node_auth_api["Authentication endpoint"]
end

subgraph group_domain["Store domain"]
  node_product_service["Product operations"]
  node_category_service["Category operations"]
  node_product_mapper["Product mapping<br/>[ProductMapper.java]"]
  node_category_mapper["Category mapping"]
  node_product_spec["Product filters"]
  node_product_entity["Product entity<br/>[Product.java]"]
  node_category_entity["Category entity<br/>[Category.java]"]
end

subgraph group_persistence["Persistence"]
  node_product_repo["Product repository"]
  node_category_repo["Category repository"]
  node_user_repo["User repository"]
  node_database[("MySQL database")]
  node_migrations["Schema migrations"]
end

subgraph group_identity["Identity and security"]
  node_user_service["Account registration<br/>[UserService.java]"]
  node_auth_service["User lookup"]
  node_user_entity["User entity<br/>[User.java]"]
  node_security["Security configuration"]
end

subgraph group_runtime["Runtime support"]
  node_exceptions["Error handling"]
  node_auditing["JPA auditing"]
  node_application["Spring Boot application"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_product_api
node_product_api -->|"delegates"| node_product_service
node_category_api -->|"delegates"| node_category_service
node_user_api -->|"delegates"| node_user_service
node_auth_api -.->|"authenticates"| node_auth_service
node_client -.->|"sends requests"| node_category_api
node_client -.->|"sends requests"| node_user_api
node_client -.->|"sends requests"| node_auth_api
node_product_service -->|"reads and writes"| node_product_repo
node_product_service -->|"loads category"| node_category_repo
node_product_service -->|"maps results"| node_product_mapper
node_product_service -->|"builds filters"| node_product_spec
node_category_service -->|"reads and writes"| node_category_repo
node_category_service -->|"maps category"| node_category_mapper
node_user_service -->|"stores accounts"| node_user_repo
node_auth_service -->|"loads user"| node_user_repo
node_security -->|"configures lookup"| node_auth_service
node_product_repo -.->|"persists"| node_database
node_category_repo -.->|"persists"| node_database
node_user_repo -.->|"persists"| node_database
node_product_entity -->|"references"| node_category_entity
node_user_entity -->|"stored by"| node_user_repo
node_product_service -.->|"raises domain errors"| node_exceptions
node_application -.->|"starts application"| node_auditing
node_migrations -.->|"defines schema"| node_database

click node_product_api "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/controller/ProductController.java"
click node_category_api "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/controller/CategoryController.java"
click node_user_api "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/controller/UserController.java"
click node_auth_api "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/controller/AuthController.java"
click node_product_service "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/service/ProductService.java"
click node_category_service "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/service/CategoryService.java"
click node_user_service "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/service/UserService.java"
click node_auth_service "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/service/CustomUserDetailsService.java"
click node_product_mapper "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/mapper/ProductMapper.java"
click node_category_mapper "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/mapper/CategoryMapper.java"
click node_product_spec "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/specification/ProductSpecification.java"
click node_product_entity "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/entity/Product.java"
click node_category_entity "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/entity/Category.java"
click node_user_entity "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/entity/User.java"
click node_product_repo "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/repository/ProductRepository.java"
click node_category_repo "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/repository/CategoryRepository.java"
click node_user_repo "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/repository/UserRepository.java"
click node_security "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/config/SecurityConfig.java"
click node_exceptions "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/exception/GlobalExceptionHandler.java"
click node_auditing "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/config/JpaAuditingConfig.java"
click node_application "https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/StoreManagementApiApplication.java"
click node_migrations "https://github.com/vatanak-dev/store-management-api/tree/main/src/main/resources/db/migration"

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_product_api,node_category_api,node_user_api,node_auth_api,node_client toneBlue
class node_product_service,node_category_service,node_product_mapper,node_category_mapper,node_product_spec,node_product_entity,node_category_entity toneAmber
class node_product_repo,node_category_repo,node_user_repo,node_database,node_migrations toneMint
class node_user_service,node_auth_service,node_user_entity,node_security toneRose
class node_exceptions,node_auditing,node_application toneIndigo
```

## Components

### API endpoints

- [Product endpoints](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/controller/ProductController.java): `src/main/java/com/vdev/controller/ProductController.java`
- [Category endpoints](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/controller/CategoryController.java): `src/main/java/com/vdev/controller/CategoryController.java`
- [User registration](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/controller/UserController.java): `src/main/java/com/vdev/controller/UserController.java`
- [Authentication endpoint](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/controller/AuthController.java): `src/main/java/com/vdev/controller/AuthController.java`

### Store domain

- [Product operations](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/service/ProductService.java): `src/main/java/com/vdev/service/ProductService.java`
- [Category operations](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/service/CategoryService.java): `src/main/java/com/vdev/service/CategoryService.java`
- [Product mapping](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/mapper/ProductMapper.java): `src/main/java/com/vdev/mapper/ProductMapper.java`
- [Category mapping](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/mapper/CategoryMapper.java): `src/main/java/com/vdev/mapper/CategoryMapper.java`
- [Product filters](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/specification/ProductSpecification.java): `src/main/java/com/vdev/specification/ProductSpecification.java`
- [Product entity](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/entity/Product.java): `src/main/java/com/vdev/entity/Product.java`
- [Category entity](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/entity/Category.java): `src/main/java/com/vdev/entity/Category.java`

### Persistence

- [Product repository](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/repository/ProductRepository.java): `src/main/java/com/vdev/repository/ProductRepository.java`
- [Category repository](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/repository/CategoryRepository.java): `src/main/java/com/vdev/repository/CategoryRepository.java`
- [User repository](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/repository/UserRepository.java): `src/main/java/com/vdev/repository/UserRepository.java`
- **MySQL database**
- [Schema migrations](https://github.com/vatanak-dev/store-management-api/tree/main/src/main/resources/db/migration): `src/main/resources/db/migration`

### Identity and security

- [Account registration](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/service/UserService.java): `src/main/java/com/vdev/service/UserService.java`
- [User lookup](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/service/CustomUserDetailsService.java): `src/main/java/com/vdev/service/CustomUserDetailsService.java`
- [User entity](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/entity/User.java): `src/main/java/com/vdev/entity/User.java`
- [Security configuration](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/config/SecurityConfig.java): `src/main/java/com/vdev/config/SecurityConfig.java`

### Runtime support

- [Error handling](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/exception/GlobalExceptionHandler.java): `src/main/java/com/vdev/exception/GlobalExceptionHandler.java`
- [JPA auditing](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/config/JpaAuditingConfig.java): `src/main/java/com/vdev/config/JpaAuditingConfig.java`
- [Spring Boot application](https://github.com/vatanak-dev/store-management-api/blob/main/src/main/java/com/vdev/StoreManagementApiApplication.java): `src/main/java/com/vdev/StoreManagementApiApplication.java`

### Other components

- **API client**

## Connections

- API client → Product endpoints: sends requests (evidence: `src/main/java/com/vdev/controller/ProductController.java`)
- Product endpoints → Product operations: delegates (evidence: `src/main/java/com/vdev/controller/ProductController.java`)
- Category endpoints → Category operations: delegates (evidence: `src/main/java/com/vdev/controller/CategoryController.java`)
- User registration → Account registration: delegates (evidence: `src/main/java/com/vdev/controller/UserController.java`)
- Authentication endpoint → User lookup: authenticates
- API client → Category endpoints: sends requests
- API client → User registration: sends requests
- API client → Authentication endpoint: sends requests
- Product operations → Product repository: reads and writes (evidence: `src/main/java/com/vdev/service/ProductService.java`)
- Product operations → Category repository: loads category (evidence: `src/main/java/com/vdev/service/ProductService.java`)
- Product operations → Product mapping: maps results (evidence: `src/main/java/com/vdev/service/ProductService.java`)
- Product operations → Product filters: builds filters (evidence: `src/main/java/com/vdev/service/ProductService.java`)
- Category operations → Category repository: reads and writes (evidence: `src/main/java/com/vdev/service/CategoryService.java`)
- Category operations → Category mapping: maps category (evidence: `src/main/java/com/vdev/service/CategoryService.java`)
- Account registration → User repository: stores accounts (evidence: `src/main/java/com/vdev/service/UserService.java`)
- User lookup → User repository: loads user (evidence: `src/main/java/com/vdev/service/CustomUserDetailsService.java`)
- Security configuration → User lookup: configures lookup (evidence: `src/main/java/com/vdev/config/SecurityConfig.java`)
- Product repository → MySQL database: persists
- Category repository → MySQL database: persists
- User repository → MySQL database: persists
- Product entity → Category entity: references (evidence: `src/main/java/com/vdev/entity/Product.java`)
- User entity → User repository: stored by (evidence: `src/main/java/com/vdev/repository/UserRepository.java`)
- Product operations → Error handling: raises domain errors
- Spring Boot application → JPA auditing: starts application
- Schema migrations → MySQL database: defines schema
