f8b21af4be
10_Wiki/Topics 대규모 정리: - 오류 캡처/미완성 stub 문서 227개 제거 - 교차폴더 중복 43클러스터 병합 (63파일 → redirect) - 링크명 정규화: 깨진 링크 수정·redirect 직결·개념 매핑 ~2,400건 - 카테고리 MOC 6개 신규 생성 - Graph 섹션 미해결 related-keyword 링크 10,058건 제거 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
189 lines
5.5 KiB
Markdown
189 lines
5.5 KiB
Markdown
---
|
|
id: wiki-2026-0508-architecture-diagramming-standar
|
|
title: Architecture Diagramming Standards
|
|
category: 10_Wiki/Topics
|
|
status: verified
|
|
canonical_id: self
|
|
aliases: [c4-model, arch-diagrams]
|
|
duplicate_of: none
|
|
source_trust_level: A
|
|
confidence_score: 0.9
|
|
verification_status: applied
|
|
tags: [architecture, diagrams, c4, documentation]
|
|
raw_sources: []
|
|
last_reinforced: 2026-05-10
|
|
github_commit: pending
|
|
tech_stack:
|
|
language: mermaid
|
|
framework: c4-plantuml
|
|
---
|
|
|
|
# Architecture Diagramming Standards
|
|
|
|
## 매 한 줄
|
|
> **"매 diagram 의 audience 의 결정한다"**. 매 C4 model (Simon Brown, 2018) 의 Context → Container → Component → Code 의 4-level zoom 의 default standard 의 됨. 매 2026 의 PlantUML + Mermaid + Structurizr DSL 의 most-used toolchain.
|
|
|
|
## 매 핵심
|
|
|
|
### 매 C4 Model levels
|
|
- **Level 1 — System Context**: 매 system + users + external systems. 매 non-technical audience.
|
|
- **Level 2 — Container**: 매 deployable units (web app, DB, queue). 매 technical overview.
|
|
- **Level 3 — Component**: 매 container 안의 logical components. 매 dev team.
|
|
- **Level 4 — Code**: 매 class diagram (rarely used — 매 IDE 의 generation 의 default).
|
|
|
|
### 매 supplementary diagrams
|
|
- **Sequence**: 매 request flow / interaction.
|
|
- **Deployment**: 매 infra topology (k8s, regions).
|
|
- **Dynamic**: 매 runtime view, message sequence.
|
|
- **State**: 매 entity lifecycle.
|
|
|
|
### 매 응용
|
|
1. ADR 의 embedded diagram — 매 context.
|
|
2. Onboarding 의 system overview.
|
|
3. Incident postmortem 의 affected component highlight.
|
|
|
|
## 💻 패턴
|
|
|
|
### C4 Context (Mermaid)
|
|
```mermaid
|
|
C4Context
|
|
title System Context for Banking App
|
|
Person(customer, "Customer", "Bank customer with accounts")
|
|
System(banking, "Internet Banking", "Allows customers to view info")
|
|
System_Ext(mainframe, "Mainframe", "Stores account, txn info")
|
|
System_Ext(email, "Email System", "SMTP relay")
|
|
Rel(customer, banking, "Uses", "HTTPS")
|
|
Rel(banking, mainframe, "Reads/writes", "XML/HTTPS")
|
|
Rel(banking, email, "Sends emails", "SMTP")
|
|
```
|
|
|
|
### C4 Container (PlantUML + C4-PlantUML)
|
|
```plantuml
|
|
@startuml
|
|
!include <C4/C4_Container>
|
|
Person(user, "User")
|
|
System_Boundary(c1, "Banking System") {
|
|
Container(spa, "SPA", "React/TS", "UI")
|
|
Container(api, "API", "Go/Gin", "JSON/HTTPS")
|
|
ContainerDb(db, "Database", "Postgres 17", "Customers, accounts")
|
|
Container(worker, "Worker", "Go", "Async jobs")
|
|
ContainerQueue(mq, "Queue", "NATS JetStream")
|
|
}
|
|
Rel(user, spa, "Uses", "HTTPS")
|
|
Rel(spa, api, "Calls", "JSON/HTTPS")
|
|
Rel(api, db, "Reads/writes")
|
|
Rel(api, mq, "Publishes")
|
|
Rel(worker, mq, "Consumes")
|
|
@enduml
|
|
```
|
|
|
|
### Structurizr DSL (workspace-as-code)
|
|
```
|
|
workspace "Banking" {
|
|
model {
|
|
user = person "Customer"
|
|
bank = softwareSystem "Banking" {
|
|
spa = container "SPA" "React/TS"
|
|
api = container "API" "Go/Gin"
|
|
db = container "Database" "Postgres 17" "Database"
|
|
}
|
|
user -> spa "Uses"
|
|
spa -> api "JSON/HTTPS"
|
|
api -> db "SQL"
|
|
}
|
|
views {
|
|
container bank "Containers" { include * autolayout lr }
|
|
theme default
|
|
}
|
|
}
|
|
```
|
|
|
|
### Sequence (Mermaid)
|
|
```mermaid
|
|
sequenceDiagram
|
|
actor U as User
|
|
participant S as SPA
|
|
participant A as API
|
|
participant D as DB
|
|
U->>S: Click "Pay"
|
|
S->>A: POST /payments
|
|
A->>D: BEGIN; INSERT; COMMIT
|
|
A-->>S: 201 Created
|
|
S-->>U: Success toast
|
|
```
|
|
|
|
### Deployment (Mermaid)
|
|
```mermaid
|
|
flowchart LR
|
|
subgraph k8s[Kubernetes / us-east-1]
|
|
api[API Pods x3]
|
|
worker[Worker Pods x2]
|
|
end
|
|
subgraph rds[RDS]
|
|
pg[(Postgres 17 Multi-AZ)]
|
|
end
|
|
ALB --> api
|
|
api --> pg
|
|
worker --> pg
|
|
worker --> SQS
|
|
```
|
|
|
|
### Diagrams as code (Python diagrams lib)
|
|
```python
|
|
from diagrams import Diagram, Cluster
|
|
from diagrams.aws.compute import ECS
|
|
from diagrams.aws.database import RDS
|
|
from diagrams.aws.network import ELB
|
|
|
|
with Diagram("Web", show=False, direction="LR"):
|
|
lb = ELB("lb")
|
|
with Cluster("Services"):
|
|
svc = [ECS("svc1"), ECS("svc2")]
|
|
db = RDS("primary")
|
|
lb >> svc >> db
|
|
```
|
|
|
|
### Auto-generated from infra (Terraform → diagram)
|
|
```bash
|
|
# Inframap / Pluralith / Cloudcraft import
|
|
terraform graph | dot -Tpng > infra.png
|
|
inframap generate terraform.tfstate | dot -Tpng > clean.png
|
|
```
|
|
|
|
## 매 결정 기준
|
|
| 상황 | Approach |
|
|
|---|---|
|
|
| Quick sketch | Excalidraw / Whiteboard |
|
|
| Reusable, version-controlled | Mermaid (md-embedded) |
|
|
| Strict C4 + theming | Structurizr DSL |
|
|
| Cloud infra reality | Terraform → Inframap |
|
|
| Slide deck / exec | PlantUML + C4 theme + export |
|
|
|
|
**기본값**: Mermaid (C4 plugin) — 매 GitHub/Obsidian native rendering.
|
|
|
|
## 🔗 Graph
|
|
- 부모: [[Software Architecture]]
|
|
- 변형: [[ADR]] · [[RFC]]
|
|
- 응용: [[Onboarding]] · [[Postmortem]]
|
|
- Adjacent: [[Architecture Review (아키텍처 및 설계 리뷰)]] · [[Architecture_Refactor]]
|
|
|
|
## 🤖 LLM 활용
|
|
**언제**: text spec → Mermaid/PlantUML 의 generation, code → C4 inference.
|
|
**언제 X**: production diagram 의 unverified auto-generation — 매 hallucinated component 의 risk.
|
|
|
|
## ❌ 안티패턴
|
|
- **Box-and-line soup**: 매 layer/audience 의 mix 의 unreadable diagram.
|
|
- **Stale .png in repo**: 매 source-less binary — 매 update 의 X. Mermaid/DSL 의 사용.
|
|
- **Over-leveling**: 매 Level 4 (Code) 의 manually 의 maintain — 매 IDE 의 generate.
|
|
- **No legend**: 매 shape/color semantics 의 없는 diagram — 매 reader 의 confusion.
|
|
|
|
## 🧪 검증 / 중복
|
|
- Verified (Simon Brown, *Software Architecture for Developers*; c4model.com).
|
|
- 신뢰도 A.
|
|
|
|
## 🕓 Changelog
|
|
| 날짜 | 변경 |
|
|
|---|---|
|
|
| 2026-05-08 | Phase 1 |
|
|
| 2026-05-10 | Manual cleanup — C4 model + Mermaid/Structurizr/diagrams.py patterns |
|