# sparta-3tm/3tm architecture

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

- Interactive diagram: https://gitdiagram.com/sparta-3tm/3tm
- Repository: https://github.com/sparta-3tm/3tm

## Overview

3TM is a Spring-based logistics and delivery MSA. A client enters through the gateway; documented domain capabilities cover authentication and delivery-manager administration, hubs and routes, companies and products, order creation and delivery management, plus weather summaries and Slack notifications. The sampled order service coordinates company/product and hub-route operations; hub routing uses Naver mapping. Exact controller-to-service and gateway routing details were not sampled, so those connections are marked unverified. Persistence is represented by service-owned repositories where evidenced, not as a single assumed shared database.

Main entry points: [`gateway-server/src/main/java/com/sparta3tm/gatewayserver/filter/CustomPreFilter.java`](https://github.com/sparta-3tm/3tm/blob/main/gateway-server/src/main/java/com/sparta3tm/gatewayserver/filter/CustomPreFilter.java) (API gateway), [`order-server/src/main/java/com/sparta3tm/orderserver/application/service/OrderDeliveryService.java`](https://github.com/sparta-3tm/3tm/blob/main/order-server/src/main/java/com/sparta3tm/orderserver/application/service/OrderDeliveryService.java) (Order and delivery orchestration), [`company-server/src/main/java/com/sparta3tm/companyserver/application/ProductService.java`](https://github.com/sparta-3tm/3tm/blob/main/company-server/src/main/java/com/sparta3tm/companyserver/application/ProductService.java) (Product management), [`hub-server/src/main/java/com/sparta3tm/hubserver/application/service/HMIService.java`](https://github.com/sparta-3tm/3tm/blob/main/hub-server/src/main/java/com/sparta3tm/hubserver/application/service/HMIService.java) (Hub route planning)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_edge["Entry and identity"]
  node_gateway["API gateway"]
  node_registry["Service registry"]
  node_auth["Identity and managers<br/>[AuthService.java]"]
  node_authdata[("User and manager records<br/>[User.java]")]
end

subgraph group_catalog["Logistics catalog"]
  node_companies["Company management"]
  node_products["Product management"]
  node_hub["Hub management<br/>[HubService.java]"]
  node_routes["Hub route planning<br/>[HMIService.java]"]
  node_naver["Naver Maps"]
  node_companydata[("Company and product records<br/>[Company.java]")]
  node_hubdata[("Hub and movement records<br/>[Hub.java]")]
end

subgraph group_fulfillment["Orders and delivery"]
  node_orders["Order and delivery orchestration"]
  node_delivery["Delivery tracking"]
  node_orderdata[("Order and delivery records<br/>[Order.java]")]
end

subgraph group_notify["Notifications and assistance"]
  node_weather["Weather lookup"]
  node_summary["AI summaries<br/>[GeminiService.java]"]
  node_slack["Slack notifications<br/>[SlackService.java]"]
  node_slackservice["Slack API"]
end

subgraph group_shared["Shared runtime"]
  node_common["Shared API support<br/>[ApiResponse.java]"]
end

node_client(("API client"))

node_client -.->|"sends requests"| node_gateway
node_gateway -.->|"routes requests"| node_auth
node_gateway -.->|"routes requests"| node_companies
node_gateway -.->|"routes requests"| node_products
node_gateway -.->|"routes requests"| node_hub
node_gateway -.->|"routes requests"| node_orders
node_gateway -.->|"routes requests"| node_delivery
node_gateway -.->|"routes requests"| node_slack
node_gateway -.->|"discovers services"| node_registry
node_orders -->|"requests company data"| node_companies
node_orders -->|"updates quantities"| node_products
node_orders -->|"requests route"| node_routes
node_routes -->|"looks up hubs"| node_hub
node_routes -->|"requests directions"| node_naver
node_slack -->|"gets forecast"| node_weather
node_slack -->|"requests summary"| node_summary
node_slack -->|"posts messages"| node_slackservice
node_auth -->|"reads and writes"| node_authdata
node_companies -.->|"reads and writes"| node_companydata
node_products -->|"reads company"| node_companydata
node_products -->|"validates hub"| node_hub
node_products -->|"uses Gemini DTOs"| node_common
node_hub -->|"reads and writes"| node_hubdata
node_routes -.->|"stores movements"| node_hubdata
node_orders -.->|"stores orders"| node_orderdata
node_delivery -.->|"manages delivery"| node_orderdata

click node_gateway "https://github.com/sparta-3tm/3tm/blob/main/gateway-server/src/main/java/com/sparta3tm/gatewayserver/filter/CustomPreFilter.java"
click node_registry "https://github.com/sparta-3tm/3tm/blob/main/eureka-server/src/main/java/com/sparta3tm/eurekaserver/EurekaServerApplication.java"
click node_auth "https://github.com/sparta-3tm/3tm/blob/main/auth-server/src/main/java/com/sparta3tm/authserver/application/AuthService.java"
click node_companies "https://github.com/sparta-3tm/3tm/blob/main/company-server/src/main/java/com/sparta3tm/companyserver/application/CompanyService.java"
click node_products "https://github.com/sparta-3tm/3tm/blob/main/company-server/src/main/java/com/sparta3tm/companyserver/application/ProductService.java"
click node_hub "https://github.com/sparta-3tm/3tm/blob/main/hub-server/src/main/java/com/sparta3tm/hubserver/application/service/HubService.java"
click node_routes "https://github.com/sparta-3tm/3tm/blob/main/hub-server/src/main/java/com/sparta3tm/hubserver/application/service/HMIService.java"
click node_orders "https://github.com/sparta-3tm/3tm/blob/main/order-server/src/main/java/com/sparta3tm/orderserver/application/service/OrderDeliveryService.java"
click node_delivery "https://github.com/sparta-3tm/3tm/blob/main/order-server/src/main/java/com/sparta3tm/orderserver/application/service/DeliveryService.java"
click node_weather "https://github.com/sparta-3tm/3tm/blob/main/chore-server/src/main/java/com/sparta3tm/choreserver/application/WeatherService.java"
click node_summary "https://github.com/sparta-3tm/3tm/blob/main/chore-server/src/main/java/com/sparta3tm/choreserver/application/GeminiService.java"
click node_slack "https://github.com/sparta-3tm/3tm/blob/main/chore-server/src/main/java/com/sparta3tm/choreserver/application/SlackService.java"
click node_common "https://github.com/sparta-3tm/3tm/blob/main/common/src/main/java/com/sparta3tm/common/support/response/ApiResponse.java"
click node_companydata "https://github.com/sparta-3tm/3tm/blob/main/company-server/src/main/java/com/sparta3tm/companyserver/domain/company/Company.java"
click node_hubdata "https://github.com/sparta-3tm/3tm/blob/main/hub-server/src/main/java/com/sparta3tm/hubserver/domain/entity/Hub.java"
click node_orderdata "https://github.com/sparta-3tm/3tm/blob/main/order-server/src/main/java/com/sparta3tm/orderserver/domain/entity/order/Order.java"
click node_authdata "https://github.com/sparta-3tm/3tm/blob/main/auth-server/src/main/java/com/sparta3tm/authserver/domain/user/User.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_registry,node_auth,node_authdata,node_client toneBlue
class node_companies,node_products,node_hub,node_routes,node_naver,node_companydata,node_hubdata toneAmber
class node_orders,node_delivery,node_orderdata toneMint
class node_weather,node_summary,node_slack,node_slackservice toneRose
class node_common toneIndigo
```

## Components

### Entry and identity

- [API gateway](https://github.com/sparta-3tm/3tm/blob/main/gateway-server/src/main/java/com/sparta3tm/gatewayserver/filter/CustomPreFilter.java): `gateway-server/src/main/java/com/sparta3tm/gatewayserver/filter/CustomPreFilter.java`
- [Service registry](https://github.com/sparta-3tm/3tm/blob/main/eureka-server/src/main/java/com/sparta3tm/eurekaserver/EurekaServerApplication.java): `eureka-server/src/main/java/com/sparta3tm/eurekaserver/EurekaServerApplication.java`
- [Identity and managers](https://github.com/sparta-3tm/3tm/blob/main/auth-server/src/main/java/com/sparta3tm/authserver/application/AuthService.java): `auth-server/src/main/java/com/sparta3tm/authserver/application/AuthService.java`
- [User and manager records](https://github.com/sparta-3tm/3tm/blob/main/auth-server/src/main/java/com/sparta3tm/authserver/domain/user/User.java): `auth-server/src/main/java/com/sparta3tm/authserver/domain/user/User.java`

### Logistics catalog

- [Company management](https://github.com/sparta-3tm/3tm/blob/main/company-server/src/main/java/com/sparta3tm/companyserver/application/CompanyService.java): `company-server/src/main/java/com/sparta3tm/companyserver/application/CompanyService.java`
- [Product management](https://github.com/sparta-3tm/3tm/blob/main/company-server/src/main/java/com/sparta3tm/companyserver/application/ProductService.java): `company-server/src/main/java/com/sparta3tm/companyserver/application/ProductService.java`
- [Hub management](https://github.com/sparta-3tm/3tm/blob/main/hub-server/src/main/java/com/sparta3tm/hubserver/application/service/HubService.java): `hub-server/src/main/java/com/sparta3tm/hubserver/application/service/HubService.java`
- [Hub route planning](https://github.com/sparta-3tm/3tm/blob/main/hub-server/src/main/java/com/sparta3tm/hubserver/application/service/HMIService.java): `hub-server/src/main/java/com/sparta3tm/hubserver/application/service/HMIService.java`
- **Naver Maps**
- [Company and product records](https://github.com/sparta-3tm/3tm/blob/main/company-server/src/main/java/com/sparta3tm/companyserver/domain/company/Company.java): `company-server/src/main/java/com/sparta3tm/companyserver/domain/company/Company.java`
- [Hub and movement records](https://github.com/sparta-3tm/3tm/blob/main/hub-server/src/main/java/com/sparta3tm/hubserver/domain/entity/Hub.java): `hub-server/src/main/java/com/sparta3tm/hubserver/domain/entity/Hub.java`

### Orders and delivery

- [Order and delivery orchestration](https://github.com/sparta-3tm/3tm/blob/main/order-server/src/main/java/com/sparta3tm/orderserver/application/service/OrderDeliveryService.java): `order-server/src/main/java/com/sparta3tm/orderserver/application/service/OrderDeliveryService.java`
- [Delivery tracking](https://github.com/sparta-3tm/3tm/blob/main/order-server/src/main/java/com/sparta3tm/orderserver/application/service/DeliveryService.java): `order-server/src/main/java/com/sparta3tm/orderserver/application/service/DeliveryService.java`
- [Order and delivery records](https://github.com/sparta-3tm/3tm/blob/main/order-server/src/main/java/com/sparta3tm/orderserver/domain/entity/order/Order.java): `order-server/src/main/java/com/sparta3tm/orderserver/domain/entity/order/Order.java`

### Notifications and assistance

- [Weather lookup](https://github.com/sparta-3tm/3tm/blob/main/chore-server/src/main/java/com/sparta3tm/choreserver/application/WeatherService.java): `chore-server/src/main/java/com/sparta3tm/choreserver/application/WeatherService.java`
- [AI summaries](https://github.com/sparta-3tm/3tm/blob/main/chore-server/src/main/java/com/sparta3tm/choreserver/application/GeminiService.java): `chore-server/src/main/java/com/sparta3tm/choreserver/application/GeminiService.java`
- [Slack notifications](https://github.com/sparta-3tm/3tm/blob/main/chore-server/src/main/java/com/sparta3tm/choreserver/application/SlackService.java): `chore-server/src/main/java/com/sparta3tm/choreserver/application/SlackService.java`
- **Slack API**

### Shared runtime

- [Shared API support](https://github.com/sparta-3tm/3tm/blob/main/common/src/main/java/com/sparta3tm/common/support/response/ApiResponse.java): `common/src/main/java/com/sparta3tm/common/support/response/ApiResponse.java`

### Other components

- **API client**

## Connections

- API client → API gateway: sends requests
- API gateway → Identity and managers: routes requests
- API gateway → Company management: routes requests
- API gateway → Product management: routes requests
- API gateway → Hub management: routes requests
- API gateway → Order and delivery orchestration: routes requests
- API gateway → Delivery tracking: routes requests
- API gateway → Slack notifications: routes requests
- API gateway → Service registry: discovers services
- Order and delivery orchestration → Company management: requests company data (evidence: `order-server/src/main/java/com/sparta3tm/orderserver/application/service/OrderDeliveryService.java`)
- Order and delivery orchestration → Product management: updates quantities (evidence: `order-server/src/main/java/com/sparta3tm/orderserver/application/service/OrderDeliveryService.java`)
- Order and delivery orchestration → Hub route planning: requests route (evidence: `order-server/src/main/java/com/sparta3tm/orderserver/application/service/OrderDeliveryService.java`)
- Hub route planning → Hub management: looks up hubs (evidence: `hub-server/src/main/java/com/sparta3tm/hubserver/application/service/HMIService.java`)
- Hub route planning → Naver Maps: requests directions (evidence: `hub-server/src/main/java/com/sparta3tm/hubserver/application/service/HMIService.java`)
- Slack notifications → Weather lookup: gets forecast (evidence: `chore-server/src/main/java/com/sparta3tm/choreserver/application/SlackService.java`)
- Slack notifications → AI summaries: requests summary (evidence: `chore-server/src/main/java/com/sparta3tm/choreserver/application/SlackService.java`)
- Slack notifications → Slack API: posts messages (evidence: `chore-server/src/main/java/com/sparta3tm/choreserver/application/SlackService.java`)
- Identity and managers → User and manager records: reads and writes (evidence: `auth-server/src/main/java/com/sparta3tm/authserver/application/AuthService.java`)
- Company management → Company and product records: reads and writes (evidence: `company-server/src/main/java/com/sparta3tm/companyserver/application/CompanyService.java`)
- Product management → Company and product records: reads company (evidence: `company-server/src/main/java/com/sparta3tm/companyserver/application/ProductService.java`)
- Product management → Hub management: validates hub (evidence: `company-server/src/main/java/com/sparta3tm/companyserver/application/ProductService.java`)
- Product management → Shared API support: uses Gemini DTOs (evidence: `company-server/src/main/java/com/sparta3tm/companyserver/application/ProductService.java`)
- Hub management → Hub and movement records: reads and writes (evidence: `hub-server/src/main/java/com/sparta3tm/hubserver/application/service/HubService.java`)
- Hub route planning → Hub and movement records: stores movements (evidence: `hub-server/src/main/java/com/sparta3tm/hubserver/application/service/HMIService.java`)
- Order and delivery orchestration → Order and delivery records: stores orders (evidence: `order-server/src/main/java/com/sparta3tm/orderserver/application/service/OrderDeliveryService.java`)
- Delivery tracking → Order and delivery records: manages delivery
