# 100-hours-a-week/ktb4-20th-be architecture

> Architecture diagram of the GitHub repository 100-hours-a-week/ktb4-20th-be, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/100-hours-a-week/ktb4-20th-be
- Repository: https://github.com/100-hours-a-week/ktb4-20th-be

## Overview

Planit is a Spring backend for collaborative trip planning, with Kakao-based authentication, trip and survey management, AI-assisted schedule generation, and regional chat. The likely user journey is authenticate, create or join a trip, submit preferences, then generate and manage an itinerary; chat and region lookup are complementary capabilities. The README gives no product detail, and most controllers and services were not sampled, so several feature nodes reflect the source tree without asserted connections. Edges below are limited to relationships visible in excerpts or the SOURCE INDEX.

Main entry points: [`src/main/java/com/planit/schedule/service/SchedulePersistenceService.java`](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/schedule/service/SchedulePersistenceService.java) (Schedule Persistence), [`src/main/java/com/planit/chat/service/ChatMessageTransactionService.java`](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/chat/service/ChatMessageTransactionService.java) (Chat Transactions), [`src/main/java/com/planit/trip/service/TripService.java`](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/trip/service/TripService.java) (Trip Service), [`src/main/java/com/planit/repository/TripRepository.java`](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/repository/TripRepository.java) (Trip Repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity"]
  node_auth_api["Auth API"]
  node_auth_service["Auth Service<br/>[AuthService.java]"]
  node_withdrawal["Account Withdrawal"]
end

subgraph group_planning["Trip Planning"]
  node_trip_api["Trip API"]
  node_trip_service["Trip Service<br/>[TripService.java]"]
  node_survey["Survey Services"]
  node_region["Region Catalog<br/>[RegionService.java]"]
end

subgraph group_itinerary["Schedules"]
  node_schedule_api["Schedule APIs"]
  node_schedule_service["Schedule Services"]
  node_schedule_persist["Schedule Persistence"]
  node_route_calc["Route Calculator"]
end

subgraph group_community["Regional Chat"]
  node_chat_tx["Chat Transactions"]
  node_text_normalizer["Text Normalizer"]
end

subgraph group_shared["Shared Services"]
  node_trip_store[("Trip Repository")]
  node_schedule_store[("Schedule Repositories")]
  node_chat_store[("Chat Repositories")]
  node_image_store["Image Storage<br/>[ImageStorage.java]"]
end

node_user(("User"))

node_auth_api -->|"delegates auth"| node_auth_service
node_trip_api -->|"delegates trips"| node_trip_service
node_withdrawal -->|"leaves trips"| node_trip_service
node_region -->|"reads regions"| node_trip_store
node_schedule_persist -->|"locks trip"| node_trip_store
node_schedule_persist -->|"persists itinerary"| node_schedule_store
node_schedule_persist -->|"calculates route"| node_route_calc
node_chat_tx -->|"reads and writes"| node_chat_store
node_chat_tx -->|"creates read URL"| node_image_store
node_chat_tx -->|"normalizes text"| node_text_normalizer

click node_auth_api "https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/auth/controller/AuthController.java"
click node_auth_service "https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/auth/service/AuthService.java"
click node_trip_api "https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/trip/controller/TripController.java"
click node_trip_service "https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/trip/service/TripService.java"
click node_withdrawal "https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/user/service/WithdrawalTransactionService.java"
click node_survey "https://github.com/100-hours-a-week/ktb4-20th-be/tree/dev/src/main/java/com/planit/survey/service"
click node_region "https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/region/service/RegionService.java"
click node_schedule_api "https://github.com/100-hours-a-week/ktb4-20th-be/tree/dev/src/main/java/com/planit/schedule/controller"
click node_schedule_service "https://github.com/100-hours-a-week/ktb4-20th-be/tree/dev/src/main/java/com/planit/schedule/service"
click node_schedule_persist "https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/schedule/service/SchedulePersistenceService.java"
click node_route_calc "https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/schedule/route/ShortestRouteCalculator.java"
click node_trip_store "https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/repository/TripRepository.java"
click node_schedule_store "https://github.com/100-hours-a-week/ktb4-20th-be/tree/dev/src/main/java/com/planit/schedule/repository"
click node_chat_tx "https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/chat/service/ChatMessageTransactionService.java"
click node_chat_store "https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/repository/ChatMessageRepository.java"
click node_image_store "https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/image/storage/ImageStorage.java"
click node_text_normalizer "https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/chat/service/ChatTextNormalizer.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_auth_api,node_auth_service,node_withdrawal,node_user toneBlue
class node_trip_api,node_trip_service,node_survey,node_region toneAmber
class node_schedule_api,node_schedule_service,node_schedule_persist,node_route_calc toneMint
class node_chat_tx,node_text_normalizer toneRose
class node_trip_store,node_schedule_store,node_chat_store,node_image_store toneIndigo
```

## Components

### Identity

- [Auth API](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/auth/controller/AuthController.java): `src/main/java/com/planit/auth/controller/AuthController.java`
- [Auth Service](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/auth/service/AuthService.java): `src/main/java/com/planit/auth/service/AuthService.java`
- [Account Withdrawal](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/user/service/WithdrawalTransactionService.java): `src/main/java/com/planit/user/service/WithdrawalTransactionService.java`

### Trip Planning

- [Trip API](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/trip/controller/TripController.java): `src/main/java/com/planit/trip/controller/TripController.java`
- [Trip Service](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/trip/service/TripService.java): `src/main/java/com/planit/trip/service/TripService.java`
- [Survey Services](https://github.com/100-hours-a-week/ktb4-20th-be/tree/dev/src/main/java/com/planit/survey/service): `src/main/java/com/planit/survey/service`
- [Region Catalog](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/region/service/RegionService.java): `src/main/java/com/planit/region/service/RegionService.java`

### Schedules

- [Schedule APIs](https://github.com/100-hours-a-week/ktb4-20th-be/tree/dev/src/main/java/com/planit/schedule/controller): `src/main/java/com/planit/schedule/controller`
- [Schedule Services](https://github.com/100-hours-a-week/ktb4-20th-be/tree/dev/src/main/java/com/planit/schedule/service): `src/main/java/com/planit/schedule/service`
- [Schedule Persistence](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/schedule/service/SchedulePersistenceService.java): `src/main/java/com/planit/schedule/service/SchedulePersistenceService.java`
- [Route Calculator](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/schedule/route/ShortestRouteCalculator.java): `src/main/java/com/planit/schedule/route/ShortestRouteCalculator.java`

### Regional Chat

- [Chat Transactions](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/chat/service/ChatMessageTransactionService.java): `src/main/java/com/planit/chat/service/ChatMessageTransactionService.java`
- [Text Normalizer](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/chat/service/ChatTextNormalizer.java): `src/main/java/com/planit/chat/service/ChatTextNormalizer.java`

### Shared Services

- [Trip Repository](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/repository/TripRepository.java): `src/main/java/com/planit/repository/TripRepository.java`
- [Schedule Repositories](https://github.com/100-hours-a-week/ktb4-20th-be/tree/dev/src/main/java/com/planit/schedule/repository): `src/main/java/com/planit/schedule/repository`
- [Chat Repositories](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/repository/ChatMessageRepository.java): `src/main/java/com/planit/repository/ChatMessageRepository.java`
- [Image Storage](https://github.com/100-hours-a-week/ktb4-20th-be/blob/dev/src/main/java/com/planit/image/storage/ImageStorage.java): `src/main/java/com/planit/image/storage/ImageStorage.java`

### Other components

- **User**

## Connections

- Auth API → Auth Service: delegates auth (evidence: `src/main/java/com/planit/auth/controller/AuthController.java`)
- Trip API → Trip Service: delegates trips (evidence: `src/main/java/com/planit/trip/controller/TripController.java`)
- Account Withdrawal → Trip Service: leaves trips (evidence: `src/main/java/com/planit/user/service/WithdrawalTransactionService.java`)
- Region Catalog → Trip Repository: reads regions (evidence: `src/main/java/com/planit/region/service/RegionService.java`)
- Schedule Persistence → Trip Repository: locks trip (evidence: `src/main/java/com/planit/schedule/service/SchedulePersistenceService.java`)
- Schedule Persistence → Schedule Repositories: persists itinerary (evidence: `src/main/java/com/planit/schedule/service/SchedulePersistenceService.java`)
- Schedule Persistence → Route Calculator: calculates route (evidence: `src/main/java/com/planit/schedule/service/SchedulePersistenceService.java`)
- Chat Transactions → Chat Repositories: reads and writes (evidence: `src/main/java/com/planit/chat/service/ChatMessageTransactionService.java`)
- Chat Transactions → Image Storage: creates read URL (evidence: `src/main/java/com/planit/chat/service/ChatMessageTransactionService.java`)
- Chat Transactions → Text Normalizer: normalizes text (evidence: `src/main/java/com/planit/chat/service/ChatMessageTransactionService.java`)
