# niki8533/beadv1_1_dev_ground_be architecture

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

- Interactive diagram: https://gitdiagram.com/niki8533/beadv1_1_dev_ground_be
- Repository: https://github.com/niki8533/beadv1_1_dev_ground_be

## Overview

DBAY is a second-hand electronics marketplace. A buyer browses and searches listings, adds items to a cart, places an order, and pays using a user deposit; delivery completion later enables seller settlement. Sellers manage products and images, while users can chat in real time. The repository separates product, commerce, payments, and user services, with a shared core and gateway/service-discovery components. The sampled code confirms product indexing and image operations, chat-room lookups, and Saga state handling; some cross-service flows are documented in the README rather than shown in the excerpts.

Main entry points: [`gateway/src/main/java/io/devground/gateway`](https://github.com/niki8533/beadv1_1_dev_ground_be/tree/main/gateway/src/main/java/io/devground/gateway) (API gateway), [`product/src/main/java/io/devground/product/product/application/service/ProductApplicationService.java`](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/product/src/main/java/io/devground/product/product/application/service/ProductApplicationService.java) (Product management), [`commerce/src/main/java/io/devground/dbay/order/application/service/OrderApplication.java`](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/commerce/src/main/java/io/devground/dbay/order/application/service/OrderApplication.java) (Order lifecycle), [`payments/src/main/java/io/devground/payments/payment/service/PaymentService.java`](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/payments/src/main/java/io/devground/payments/payment/service/PaymentService.java) (Payment processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Platform entry"]
  node_gateway["API gateway"]
  node_discovery["Service discovery"]
  node_core["Shared contracts<br/>[ErrorCode.java]"]
end

subgraph group_catalog["Catalog and discovery"]
  node_products["Product management"]
  node_search["Search and suggestions"]
  node_images["Product images"]
  node_s3["Image object storage<br/>[S3Service.java]"]
end

subgraph group_commerce["Cart and orders"]
  node_cart["Shopping cart"]
  node_orders["Order lifecycle"]
  node_commerce_store[("Commerce persistence")]
end

subgraph group_finance["Payments and settlement"]
  node_deposit["Deposit accounts"]
  node_payment["Payment processing"]
  node_settlement["Seller settlement"]
  node_finance_saga[("Payment Saga state<br/>[SagaService.java]")]
end

subgraph group_people["Users and messaging"]
  node_accounts["User accounts<br/>[UserService.java]"]
  node_authentication["Authentication"]
  node_chat["Chat rooms"]
  node_chat_messages[("Chat messages")]
end

node_buyer(("Buyer or seller"))
node_customer{{"Toss Pay"}}

node_buyer -->|"sends requests"| node_gateway
node_gateway -.->|"routes requests"| node_products
node_gateway -.->|"routes requests"| node_cart
node_gateway -.->|"routes requests"| node_orders
node_gateway -.->|"routes requests"| node_accounts
node_gateway -.->|"routes requests"| node_payment
node_gateway -->|"uses discovery"| node_discovery
node_buyer -->|"manages listings"| node_products
node_products -->|"publishes updates"| node_search
node_products -->|"requests image URLs"| node_images
node_images -.->|"uses storage"| node_s3
node_buyer -->|"searches listings"| node_search
node_buyer -->|"manages cart"| node_cart
node_cart -->|"orders cart items"| node_orders
node_orders -.->|"persists orders"| node_commerce_store
node_orders -.->|"checks products"| node_products
node_orders -->|"charges deposit"| node_deposit
node_payment -->|"confirms payment"| node_customer
node_payment -->|"funds deposit"| node_deposit
node_settlement -->|"settles funds"| node_deposit
node_payment -.->|"tracks Saga"| node_finance_saga
node_buyer -->|"registers and signs in"| node_accounts
node_buyer -->|"chats with seller"| node_chat
node_chat -->|"reads messages"| node_chat_messages
node_chat -->|"fetches product detail"| node_products

click node_gateway "https://github.com/niki8533/beadv1_1_dev_ground_be/tree/main/gateway/src/main/java/io/devground/gateway"
click node_discovery "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/eureka-server/src/main/java/io/devground/eurekaserver/EurekaServerApplication.java"
click node_products "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/product/src/main/java/io/devground/product/product/application/service/ProductApplicationService.java"
click node_search "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/src/main/java/io/devground/dbay/domain/product/product/service/ProductSearchService.java"
click node_images "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/product/src/main/java/io/devground/product/image/application/service/ImageApplicationService.java"
click node_s3 "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/product/src/main/java/io/devground/product/image/infrastructure/adapter/out/S3Service.java"
click node_cart "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/commerce/src/main/java/io/devground/dbay/cart/application/service/CartApplication.java"
click node_orders "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/commerce/src/main/java/io/devground/dbay/order/application/service/OrderApplication.java"
click node_commerce_store "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/commerce/src/main/java/io/devground/dbay/order/infrastructure/adapter/out/persistence/OrderPersistenceAdapter.java"
click node_deposit "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/payments/src/main/java/io/devground/payments/deposit/application/service/DepositApplication.java"
click node_payment "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/payments/src/main/java/io/devground/payments/payment/service/PaymentService.java"
click node_settlement "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/payments/src/main/java/io/devground/payments/settlement/service/SettlementService.java"
click node_finance_saga "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/payments/src/main/java/io/devground/payments/common/saga/service/SagaService.java"
click node_accounts "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/user/src/main/java/io/devground/user/service/UserService.java"
click node_authentication "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/user/src/main/java/io/devground/auth/service/ReissueService.java"
click node_chat "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/user/src/main/java/io/devground/chat/service/ChatRoomService.java"
click node_chat_messages "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/user/src/main/java/io/devground/chat/repository/MessageRepository.java"
click node_core "https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/core/src/main/java/io/devground/core/model/vo/ErrorCode.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_gateway,node_discovery,node_core toneBlue
class node_products,node_search,node_images,node_s3 toneAmber
class node_cart,node_orders,node_commerce_store toneMint
class node_deposit,node_payment,node_settlement,node_finance_saga toneRose
class node_accounts,node_authentication,node_chat,node_chat_messages,node_buyer,node_customer toneIndigo
```

## Components

### Platform entry

- [API gateway](https://github.com/niki8533/beadv1_1_dev_ground_be/tree/main/gateway/src/main/java/io/devground/gateway): `gateway/src/main/java/io/devground/gateway`
- [Service discovery](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/eureka-server/src/main/java/io/devground/eurekaserver/EurekaServerApplication.java): `eureka-server/src/main/java/io/devground/eurekaserver/EurekaServerApplication.java`
- [Shared contracts](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/core/src/main/java/io/devground/core/model/vo/ErrorCode.java): `core/src/main/java/io/devground/core/model/vo/ErrorCode.java`

### Catalog and discovery

- [Product management](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/product/src/main/java/io/devground/product/product/application/service/ProductApplicationService.java): `product/src/main/java/io/devground/product/product/application/service/ProductApplicationService.java`
- [Search and suggestions](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/src/main/java/io/devground/dbay/domain/product/product/service/ProductSearchService.java): `src/main/java/io/devground/dbay/domain/product/product/service/ProductSearchService.java`
- [Product images](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/product/src/main/java/io/devground/product/image/application/service/ImageApplicationService.java): `product/src/main/java/io/devground/product/image/application/service/ImageApplicationService.java`
- [Image object storage](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/product/src/main/java/io/devground/product/image/infrastructure/adapter/out/S3Service.java): `product/src/main/java/io/devground/product/image/infrastructure/adapter/out/S3Service.java`

### Cart and orders

- [Shopping cart](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/commerce/src/main/java/io/devground/dbay/cart/application/service/CartApplication.java): `commerce/src/main/java/io/devground/dbay/cart/application/service/CartApplication.java`
- [Order lifecycle](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/commerce/src/main/java/io/devground/dbay/order/application/service/OrderApplication.java): `commerce/src/main/java/io/devground/dbay/order/application/service/OrderApplication.java`
- [Commerce persistence](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/commerce/src/main/java/io/devground/dbay/order/infrastructure/adapter/out/persistence/OrderPersistenceAdapter.java): `commerce/src/main/java/io/devground/dbay/order/infrastructure/adapter/out/persistence/OrderPersistenceAdapter.java`

### Payments and settlement

- [Deposit accounts](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/payments/src/main/java/io/devground/payments/deposit/application/service/DepositApplication.java): `payments/src/main/java/io/devground/payments/deposit/application/service/DepositApplication.java`
- [Payment processing](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/payments/src/main/java/io/devground/payments/payment/service/PaymentService.java): `payments/src/main/java/io/devground/payments/payment/service/PaymentService.java`
- [Seller settlement](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/payments/src/main/java/io/devground/payments/settlement/service/SettlementService.java): `payments/src/main/java/io/devground/payments/settlement/service/SettlementService.java`
- [Payment Saga state](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/payments/src/main/java/io/devground/payments/common/saga/service/SagaService.java): `payments/src/main/java/io/devground/payments/common/saga/service/SagaService.java`

### Users and messaging

- [User accounts](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/user/src/main/java/io/devground/user/service/UserService.java): `user/src/main/java/io/devground/user/service/UserService.java`
- [Authentication](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/user/src/main/java/io/devground/auth/service/ReissueService.java): `user/src/main/java/io/devground/auth/service/ReissueService.java`
- [Chat rooms](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/user/src/main/java/io/devground/chat/service/ChatRoomService.java): `user/src/main/java/io/devground/chat/service/ChatRoomService.java`
- [Chat messages](https://github.com/niki8533/beadv1_1_dev_ground_be/blob/main/user/src/main/java/io/devground/chat/repository/MessageRepository.java): `user/src/main/java/io/devground/chat/repository/MessageRepository.java`

### Other components

- **Buyer or seller**
- **Toss Pay**

## Connections

- Buyer or seller → API gateway: sends requests
- API gateway → Product management: routes requests
- API gateway → Shopping cart: routes requests
- API gateway → Order lifecycle: routes requests
- API gateway → User accounts: routes requests
- API gateway → Payment processing: routes requests
- API gateway → Service discovery: uses discovery
- Buyer or seller → Product management: manages listings
- Product management → Search and suggestions: publishes updates (evidence: `product/src/main/java/io/devground/product/product/application/service/ProductApplicationService.java`)
- Product management → Product images: requests image URLs (evidence: `product/src/main/java/io/devground/product/product/application/service/ProductApplicationService.java`)
- Product images → Image object storage: uses storage
- Buyer or seller → Search and suggestions: searches listings
- Buyer or seller → Shopping cart: manages cart
- Shopping cart → Order lifecycle: orders cart items
- Order lifecycle → Commerce persistence: persists orders
- Order lifecycle → Product management: checks products
- Order lifecycle → Deposit accounts: charges deposit
- Payment processing → Toss Pay: confirms payment
- Payment processing → Deposit accounts: funds deposit
- Seller settlement → Deposit accounts: settles funds
- Payment processing → Payment Saga state: tracks Saga
- Buyer or seller → User accounts: registers and signs in
- Buyer or seller → Chat rooms: chats with seller
- Chat rooms → Chat messages: reads messages (evidence: `user/src/main/java/io/devground/chat/service/ChatRoomService.java`)
- Chat rooms → Product management: fetches product detail (evidence: `user/src/main/java/io/devground/chat/service/ChatRoomService.java`)
