# naver-cloud-team2/assistant_manager architecture

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

- Interactive diagram: https://gitdiagram.com/naver-cloud-team2/assistant_manager
- Repository: https://github.com/naver-cloud-team2/assistant_manager

## Overview

대리총무는 단체 대화에서 결제·정정·환불을 근거 줄과 함께 정산 항목으로 정리하고, 총무의 확인을 거쳐 정산표를 발행하는 웹앱입니다. 총무는 행사를 만들고 대화를 붙여넣어 검토·수정한 뒤 판을 발행합니다. 모임원은 결과 링크에서 각자 부담액과 근거를 확인합니다. 그래프는 README의 제품 흐름과 주요 기능을 반영합니다. 일부 세부 연결은 SOURCE INDEX와 발췌만으로 확인했으며, 미확인 구현은 연결하지 않았습니다.

Main entry points: [`app/api/_lib/pipeline.ts`](https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/_lib/pipeline.ts) (초안 파이프라인), [`app/api/events/[id]/publish/route.ts`](https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/events/%5Bid%5D/publish/route.ts) (판 발행 API), [`lib/store.ts`](https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/store.ts) (TTL 저장소), [`app/m/_lib/admin.ts`](https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/m/_lib/admin.ts) (총무 화면 데이터)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_admin["총무 화면"]
  node_create_ui["행사 만들기"]
  node_admin_view["총무 화면 데이터<br/>[admin.ts]"]
  node_paste_ui["대화 붙여넣기<br/>[PasteFlow.tsx]"]
  node_mask["대화 가림<br/>[mask.ts]"]
  node_review_ui["항목 검토<br/>[ReviewBoard.tsx]"]
  node_table_ui["정산표 화면<br/>[SettlementView.tsx]"]
  node_publish_ui["발행 화면<br/>[PublishPanel.tsx]"]
end

subgraph group_pipeline["정산 처리"]
  node_pipeline["초안 파이프라인<br/>[pipeline.ts]"]
  node_parser["규칙 파서<br/>[parse.ts]"]
  node_extractor["AI 사건 추출<br/>[extract.ts]"]
  node_resolver["사건 정리<br/>[resolve.ts]"]
  node_calculator["정산 계산<br/>[calc.ts]"]
  node_transfers["송금안 계산<br/>[transfer.ts]"]
end

subgraph group_server["서버·저장"]
  node_event_api["행사 API<br/>[route.ts]"]
  node_admin_auth["관리 토큰 인증<br/>[auth.ts]"]
  node_excerpt_api["발췌 API<br/>[route.ts]"]
  node_answers_api["확인값 API<br/>[route.ts]"]
  node_publish_api["판 발행 API<br/>[route.ts]"]
  node_store[("TTL 저장소<br/>[store.ts]")]
  node_crypto["저장 데이터 암호화<br/>[crypto.ts]"]
  node_result_api["결과 API<br/>[route.ts]"]
  node_delete_api["행사 삭제 API<br/>[route.ts]"]
end

subgraph group_results["발행·결과"]
  node_versioning["판 관리<br/>[version.ts]"]
  node_result_loader["결과 조회<br/>[result.ts]"]
  node_result_page["공개 결과 페이지<br/>[page.tsx]"]
end

node_treasurer(("총무"))
node_members(("모임원"))

node_treasurer -->|"행사 입력"| node_create_ui
node_create_ui -->|"행사 생성"| node_event_api
node_event_api -->|"행사·토큰 저장"| node_store
node_treasurer -->|"대화 붙여넣기"| node_paste_ui
node_paste_ui -->|"개인정보 가림"| node_mask
node_paste_ui -->|"가린 줄 전송"| node_excerpt_api
node_excerpt_api -->|"권한 확인"| node_admin_auth
node_excerpt_api -->|"초안 요청"| node_pipeline
node_pipeline -->|"규칙 파싱"| node_parser
node_pipeline -->|"사건 추출"| node_extractor
node_pipeline -->|"사건 정리"| node_resolver
node_pipeline -->|"분담 계산"| node_calculator
node_calculator -->|"송금안 산출"| node_transfers
node_pipeline -->|"초안 암복호화"| node_crypto
node_pipeline -->|"초안 저장·조회"| node_store
node_treasurer -->|"관리 링크 열기"| node_admin_view
node_admin_view -->|"토큰으로 행사 조회"| node_admin_auth
node_admin_view -->|"저장 초안 조회"| node_pipeline
node_treasurer -->|"항목 확인·수정"| node_review_ui
node_review_ui -->|"확인값 저장"| node_answers_api
node_answers_api -->|"초안 재작성"| node_pipeline
node_admin_view -->|"정산표 표시"| node_table_ui
node_treasurer -->|"발행 선택"| node_publish_ui
node_publish_ui -->|"새 판 발행"| node_publish_api
node_publish_api -->|"권한 확인"| node_admin_auth
node_publish_api -->|"초안 확인"| node_pipeline
node_publish_api -->|"판 생성"| node_versioning
node_publish_api -->|"판·최신 번호 저장"| node_store
node_members -->|"결과 링크 열기"| node_result_page
node_result_page -->|"결과 요청"| node_result_api
node_result_api -->|"결과 조회"| node_result_loader
node_result_loader -->|"판·토큰 조회"| node_store
node_treasurer -->|"모두 지우기"| node_delete_api
node_delete_api -->|"행사 데이터 삭제"| node_store

click node_create_ui "https://github.com/naver-cloud-team2/assistant_manager/blob/main/components/CreateEventForm.tsx"
click node_event_api "https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/events/route.ts"
click node_admin_auth "https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/_lib/auth.ts"
click node_admin_view "https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/m/_lib/admin.ts"
click node_paste_ui "https://github.com/naver-cloud-team2/assistant_manager/blob/main/components/PasteFlow.tsx"
click node_mask "https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/mask.ts"
click node_excerpt_api "https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/events/%5Bid%5D/excerpt/route.ts"
click node_pipeline "https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/_lib/pipeline.ts"
click node_parser "https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/parse.ts"
click node_extractor "https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/extract.ts"
click node_resolver "https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/resolve.ts"
click node_calculator "https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/calc.ts"
click node_transfers "https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/transfer.ts"
click node_review_ui "https://github.com/naver-cloud-team2/assistant_manager/blob/main/components/ReviewBoard.tsx"
click node_answers_api "https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/events/%5Bid%5D/answers/route.ts"
click node_table_ui "https://github.com/naver-cloud-team2/assistant_manager/blob/main/components/SettlementView.tsx"
click node_publish_ui "https://github.com/naver-cloud-team2/assistant_manager/blob/main/components/PublishPanel.tsx"
click node_publish_api "https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/events/%5Bid%5D/publish/route.ts"
click node_versioning "https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/version.ts"
click node_store "https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/store.ts"
click node_crypto "https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/crypto.ts"
click node_result_api "https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/r/%5Btoken%5D/route.ts"
click node_result_loader "https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/_lib/result.ts"
click node_result_page "https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/r/%5Btoken%5D/page.tsx"
click node_delete_api "https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/events/%5Bid%5D/route.ts"

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_create_ui,node_admin_view,node_paste_ui,node_mask,node_review_ui,node_table_ui,node_publish_ui toneBlue
class node_pipeline,node_parser,node_extractor,node_resolver,node_calculator,node_transfers toneAmber
class node_event_api,node_admin_auth,node_excerpt_api,node_answers_api,node_publish_api,node_store,node_crypto,node_result_api,node_delete_api toneMint
class node_versioning,node_result_loader,node_result_page toneRose
class node_treasurer,node_members toneIndigo
```

## Components

### 총무 화면

- [행사 만들기](https://github.com/naver-cloud-team2/assistant_manager/blob/main/components/CreateEventForm.tsx): `components/CreateEventForm.tsx`
- [총무 화면 데이터](https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/m/_lib/admin.ts): `app/m/_lib/admin.ts`
- [대화 붙여넣기](https://github.com/naver-cloud-team2/assistant_manager/blob/main/components/PasteFlow.tsx): `components/PasteFlow.tsx`
- [대화 가림](https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/mask.ts): `lib/mask.ts`
- [항목 검토](https://github.com/naver-cloud-team2/assistant_manager/blob/main/components/ReviewBoard.tsx): `components/ReviewBoard.tsx`
- [정산표 화면](https://github.com/naver-cloud-team2/assistant_manager/blob/main/components/SettlementView.tsx): `components/SettlementView.tsx`
- [발행 화면](https://github.com/naver-cloud-team2/assistant_manager/blob/main/components/PublishPanel.tsx): `components/PublishPanel.tsx`

### 정산 처리

- [초안 파이프라인](https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/_lib/pipeline.ts): `app/api/_lib/pipeline.ts`
- [규칙 파서](https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/parse.ts): `lib/parse.ts`
- [AI 사건 추출](https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/extract.ts): `lib/extract.ts`
- [사건 정리](https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/resolve.ts): `lib/resolve.ts`
- [정산 계산](https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/calc.ts): `lib/calc.ts`
- [송금안 계산](https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/transfer.ts): `lib/transfer.ts`

### 서버·저장

- [행사 API](https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/events/route.ts): `app/api/events/route.ts`
- [관리 토큰 인증](https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/_lib/auth.ts): `app/api/_lib/auth.ts`
- [발췌 API](https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/events/%5Bid%5D/excerpt/route.ts): `app/api/events/[id]/excerpt/route.ts`
- [확인값 API](https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/events/%5Bid%5D/answers/route.ts): `app/api/events/[id]/answers/route.ts`
- [판 발행 API](https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/events/%5Bid%5D/publish/route.ts): `app/api/events/[id]/publish/route.ts`
- [TTL 저장소](https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/store.ts): `lib/store.ts`
- [저장 데이터 암호화](https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/crypto.ts): `lib/crypto.ts`
- [결과 API](https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/r/%5Btoken%5D/route.ts): `app/api/r/[token]/route.ts`
- [행사 삭제 API](https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/events/%5Bid%5D/route.ts): `app/api/events/[id]/route.ts`

### 발행·결과

- [판 관리](https://github.com/naver-cloud-team2/assistant_manager/blob/main/lib/version.ts): `lib/version.ts`
- [결과 조회](https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/api/_lib/result.ts): `app/api/_lib/result.ts`
- [공개 결과 페이지](https://github.com/naver-cloud-team2/assistant_manager/blob/main/app/r/%5Btoken%5D/page.tsx): `app/r/[token]/page.tsx`

### Other components

- **총무**
- **모임원**

## Connections

- 총무 → 행사 만들기: 행사 입력 (evidence: `README.md`)
- 행사 만들기 → 행사 API: 행사 생성 (evidence: `components/CreateEventForm.tsx`)
- 행사 API → TTL 저장소: 행사·토큰 저장 (evidence: `app/api/events/route.ts`)
- 총무 → 대화 붙여넣기: 대화 붙여넣기 (evidence: `README.md`)
- 대화 붙여넣기 → 대화 가림: 개인정보 가림 (evidence: `components/PasteFlow.tsx`)
- 대화 붙여넣기 → 발췌 API: 가린 줄 전송 (evidence: `components/PasteFlow.tsx`)
- 발췌 API → 관리 토큰 인증: 권한 확인 (evidence: `app/api/events/[id]/excerpt/route.ts`)
- 발췌 API → 초안 파이프라인: 초안 요청 (evidence: `app/api/events/[id]/excerpt/route.ts`)
- 초안 파이프라인 → 규칙 파서: 규칙 파싱 (evidence: `app/api/_lib/pipeline.ts`)
- 초안 파이프라인 → AI 사건 추출: 사건 추출 (evidence: `app/api/_lib/pipeline.ts`)
- 초안 파이프라인 → 사건 정리: 사건 정리 (evidence: `app/api/_lib/pipeline.ts`)
- 초안 파이프라인 → 정산 계산: 분담 계산 (evidence: `app/api/_lib/pipeline.ts`)
- 정산 계산 → 송금안 계산: 송금안 산출 (evidence: `lib/calc.ts`)
- 초안 파이프라인 → 저장 데이터 암호화: 초안 암복호화 (evidence: `app/api/_lib/pipeline.ts`)
- 초안 파이프라인 → TTL 저장소: 초안 저장·조회 (evidence: `app/api/_lib/pipeline.ts`)
- 총무 → 총무 화면 데이터: 관리 링크 열기 (evidence: `README.md`)
- 총무 화면 데이터 → 관리 토큰 인증: 토큰으로 행사 조회 (evidence: `app/m/_lib/admin.ts`)
- 총무 화면 데이터 → 초안 파이프라인: 저장 초안 조회 (evidence: `app/m/_lib/admin.ts`)
- 총무 → 항목 검토: 항목 확인·수정 (evidence: `README.md`)
- 항목 검토 → 확인값 API: 확인값 저장 (evidence: `components/ReviewBoard.tsx`)
- 확인값 API → 초안 파이프라인: 초안 재작성 (evidence: `app/api/events/[id]/answers/route.ts`)
- 총무 화면 데이터 → 정산표 화면: 정산표 표시 (evidence: `app/m/[token]/table/page.tsx`)
- 총무 → 발행 화면: 발행 선택 (evidence: `README.md`)
- 발행 화면 → 판 발행 API: 새 판 발행 (evidence: `components/PublishPanel.tsx`)
- 판 발행 API → 관리 토큰 인증: 권한 확인 (evidence: `app/api/events/[id]/publish/route.ts`)
- 판 발행 API → 초안 파이프라인: 초안 확인 (evidence: `app/api/events/[id]/publish/route.ts`)
- 판 발행 API → 판 관리: 판 생성 (evidence: `app/api/events/[id]/publish/route.ts`)
- 판 발행 API → TTL 저장소: 판·최신 번호 저장 (evidence: `app/api/events/[id]/publish/route.ts`)
- 모임원 → 공개 결과 페이지: 결과 링크 열기 (evidence: `README.md`)
- 공개 결과 페이지 → 결과 API: 결과 요청 (evidence: `app/r/[token]/page.tsx`)
- 결과 API → 결과 조회: 결과 조회 (evidence: `app/api/r/[token]/route.ts`)
- 결과 조회 → TTL 저장소: 판·토큰 조회 (evidence: `app/api/_lib/result.ts`)
- 총무 → 행사 삭제 API: 모두 지우기
- 행사 삭제 API → TTL 저장소: 행사 데이터 삭제 (evidence: `app/api/events/[id]/route.ts`)
