"매 architecture 의 zoom-in". 매 4 level (Context → Container → Component → Code) 의 progressive detail. 매 Simon Brown 의 simple + 매 effective. 매 UML 의 heavy 의 escape. 매 just-enough 의 documentation.
📖 핵심
매 4 level
1. Context (System Context)
매 highest level.
매 user (actor) + 매 external system + 매 our system (single box).
매 audience: 매 모두 (technical + business).
매 question: "매 무엇 의 build?"
2. Container
매 deployable unit (app, database, queue).
매 technology choice (SPA, mobile, REST, Postgres).
매 audience: 매 technical.
매 question: "매 high-level shape."
3. Component
매 container 내부 의 major component.
매 module / library boundary.
매 audience: 매 developer.
매 question: "매 container 의 internal."
4. Code (optional)
매 class / interface diagram.
매 IDE 의 generate 가능.
매 보통 매 outdated 의 fast → 매 skip OK.
매 supplementary diagram
Dynamic
매 sequence (interaction over time).
Deployment
매 infra mapping (which container 매 어디).
Landscape
매 multi-system overview (큰 organization).
매 design principles
C4 의 lighweight: 매 just enough.
Notation-independent: 매 box + arrow + label.
Hierarchical zoom: 매 each level 의 detail.
Audience-aware: 매 level 별 의 audience.
Tooling-friendly: text → diagram (Structurizr).
매 vs UML / 4+1
UML: 매 heavy, 매 fall out of fashion.
4+1 view (Kruchten): 매 logical / process / development / physical / scenario — 매 too many.
C4: 매 simpler, 매 hierarchical.
arc42: 매 template — 매 C4 와 의 complementary.
매 modern tool
Structurizr (Simon Brown): 매 official, 매 DSL.
IcePanel: 매 modern collaborative.
PlantUML C4: 매 text → diagram.
Mermaid C4: 매 markdown.
Diagrams.net / Excalidraw: 매 manual.
Likely (AI-assist): 매 automated.
매 application
New project kickoff: 매 shared understanding.
Onboarding: 매 new dev.
Architecture review: 매 stakeholder.
Compliance: 매 audit doc.
Refactoring planning: 매 target state.
Incident: 매 blast radius.
매 ADR 와 의 관계
ADR: 매 decision (why).
C4: 매 structure (what).
매 둘 다 의 living doc.
💻 패턴
Structurizr DSL
workspace "MyApp" "Description" {
model {
user = person "Customer" "User of the system"
myApp = softwareSystem "MyApp" "Internal banking system" {
web = container "Web App" "User interface" "React" "Web Browser"
api = container "API" "Business logic" "Node.js"
db = container "Database" "Stores users" "PostgreSQL" "Database"
}
emailSystem = softwareSystem "Email" "External SMTP" "External"
user -> web "Uses" "HTTPS"
web -> api "Calls" "JSON/HTTPS"
api -> db "Reads/writes" "SQL"
api -> emailSystem "Sends emails" "SMTP"
}
views {
systemContext myApp "Context" {
include *
autolayout lr
}
container myApp "Containers" {
include *
autolayout tb
}
component api "ApiComponents" {
// 매 API container 의 internal
}
styles {
element "Database" { shape Cylinder }
element "External" { background #999 }
}
}
}
C4Context
title System Context for MyApp
Person(user, "Customer")
System(myapp, "MyApp", "Internal banking")
System_Ext(email, "Email", "SMTP")
Rel(user, myapp, "Uses")
Rel(myapp, email, "Sends")
Generate from code (architecture as code)
# 매 dependency-cruiser 의 결과 의 C4 의 자동 generateimportjsondefgenerate_c4_components(deps_json):container_name='API'components=set()edges=[]formoduleindeps_json['modules']:component=module['source'].split('/')[1]# 매 src/auth/x.ts → authcomponents.add(component)fordepinmodule['dependencies']:target=dep['resolved'].split('/')[1]if'/'indep['resolved']else'external'iftarget!=component:edges.append((component,target))# 매 Structurizr DSL outputprint(f'container "{container_name}" {{')forcincomponents:print(f' component "{c}"')forsrc,tgtinset(edges):print(f' {src} -> {tgt}')print('}')
IcePanel API (collaborative)
// 매 IcePanel 의 API 의 model 의 sync
consticepanel=newIcePanelClient(token);awaiticepanel.upsertContainer({landscape:'main',name:'API',technology:'Node.js + TypeScript',description:'Business logic',});
CI integration (architecture drift detection)
# 매 .github/workflows/arch.yml- name:Validate architecturerun:| structurizr-cli validate -workspace workspace.dsl
- name:Compare with coderun:| npx dependency-cruiser src --output-type json > current-deps.json
python scripts/compare_with_c4.py current-deps.json workspace.dsl
# 매 diverge 시 의 fail
🤔 결정 기준
상황
Tool
Solo / small
Mermaid (markdown)
Team / collaborative
IcePanel / Structurizr
Code-driven
PlantUML + git
Living doc
Structurizr DSL + CI
Single deliverable
Excalidraw
AI-assisted
Likely + ChatGPT
기본값: Structurizr DSL 의 spec 기반. 매 markdown 의 Mermaid 의 light.