@wipal/agent-team 1.0.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/.claude/commands/skills/discover.md +127 -0
  2. package/.claude/commands/skills/install.md +225 -0
  3. package/.claude/commands/skills/review.md +234 -0
  4. package/.claude/commands/utils/learn.md +142 -0
  5. package/.claude/commands/utils/retrospect.md +62 -0
  6. package/.claude/commands/utils/switch.md +113 -0
  7. package/.claude/commands/utils/sync.md +183 -0
  8. package/.claude/rules/common/general-rules.md +6 -0
  9. package/.claude/rules/role-rules/dev-be-rules.md +241 -0
  10. package/.claude/rules/role-rules/dev-fe-rules.md +76 -0
  11. package/.claude/skills/SKILL-INDEX.md +24 -5
  12. package/.claude/skills/core/knowledge-graph/SKILL.md +214 -0
  13. package/.claude/skills/core/sequential-thinking/SKILL.md +112 -0
  14. package/.claude/skills/core/sequential-thinking/references/advanced.md +122 -0
  15. package/.claude/skills/core/sequential-thinking/references/examples.md +274 -0
  16. package/.claude/skills/domain/architecture/c4-architecture/SKILL.md +314 -0
  17. package/.claude/skills/domain/architecture/c4-architecture/references/advanced-patterns.md +552 -0
  18. package/.claude/skills/domain/architecture/c4-architecture/references/c4-syntax.md +492 -0
  19. package/.claude/skills/domain/architecture/c4-architecture/references/common-mistakes.md +437 -0
  20. package/.claude/skills/domain/architecture/mermaid-diagrams/SKILL.md +238 -0
  21. package/.claude/skills/domain/architecture/mermaid-diagrams/references/advanced-features.md +556 -0
  22. package/.claude/skills/domain/architecture/mermaid-diagrams/references/architecture-diagrams.md +192 -0
  23. package/.claude/skills/domain/architecture/mermaid-diagrams/references/c4-diagrams.md +410 -0
  24. package/.claude/skills/domain/architecture/mermaid-diagrams/references/class-diagrams.md +361 -0
  25. package/.claude/skills/domain/architecture/mermaid-diagrams/references/erd-diagrams.md +510 -0
  26. package/.claude/skills/domain/architecture/mermaid-diagrams/references/flowcharts.md +450 -0
  27. package/.claude/skills/domain/architecture/mermaid-diagrams/references/sequence-diagrams.md +394 -0
  28. package/.claude/skills/domain/backend/testing-be/SKILL.md +121 -17
  29. package/.claude/skills/domain/design/design-system/SKILL.md +169 -0
  30. package/.claude/skills/domain/design/html-css-output/SKILL.md +253 -0
  31. package/.claude/skills/domain/design/mockup-creation/SKILL.md +230 -0
  32. package/.claude/skills/domain/design/responsive-design/SKILL.md +207 -0
  33. package/.claude/skills/domain/design/ui-design/SKILL.md +124 -0
  34. package/.claude/skills/domain/frontend/testing-fe/SKILL.md +143 -38
  35. package/.claude/skills/domain/frontend/ui-ux-pro-max/README.md +45 -0
  36. package/.claude/skills/domain/frontend/ui-ux-pro-max/SKILL.md +404 -0
  37. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/charts.csv +26 -0
  38. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/colors.csv +97 -0
  39. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/icons.csv +101 -0
  40. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/landing.csv +31 -0
  41. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/products.csv +97 -0
  42. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/react-performance.csv +45 -0
  43. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  44. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  45. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  46. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  47. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  48. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  49. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  50. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  51. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/react.csv +54 -0
  52. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  53. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  54. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  55. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  56. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/styles.csv +68 -0
  57. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/typography.csv +58 -0
  58. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  59. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  60. package/.claude/skills/domain/frontend/ui-ux-pro-max/data/web-interface.csv +31 -0
  61. package/.claude/skills/domain/frontend/ui-ux-pro-max/scripts/core.py +253 -0
  62. package/.claude/skills/domain/frontend/ui-ux-pro-max/scripts/design_system.py +1067 -0
  63. package/.claude/skills/domain/frontend/ui-ux-pro-max/scripts/search.py +114 -0
  64. package/.claude/skills/domain/product/requirements-clarity/SKILL.md +340 -0
  65. package/.claude/skills/skills-registry.yaml +103 -8
  66. package/README.md +107 -33
  67. package/README.npm.md +252 -0
  68. package/TUTORIAL.md +256 -0
  69. package/bin/agent-team.js +26 -7
  70. package/config/roles.yaml +107 -0
  71. package/docs/01-architecture.md +699 -0
  72. package/docs/02-setup-guide.md +634 -0
  73. package/docs/03-skills-guide.md +628 -0
  74. package/docs/04-workflows.md +792 -0
  75. package/docs/05-model-strategy.md +550 -0
  76. package/docs/06-extend-guide.md +1226 -0
  77. package/docs/07-quick-reference.md +578 -0
  78. package/docs/08-skills-discovery.md +342 -0
  79. package/docs/README.md +134 -0
  80. package/docs/rqm.md +560 -0
  81. package/package.json +9 -3
  82. package/scripts/postinstall.js +46 -0
  83. package/src/commands/add.js +131 -67
  84. package/src/commands/init.js +419 -9
  85. package/src/commands/list.js +20 -16
  86. package/src/commands/projects.js +127 -0
  87. package/src/commands/setup-hooks.js +261 -0
  88. package/src/index.js +0 -1
  89. package/src/utils/file-utils.js +147 -50
  90. package/src/utils/global-registry.js +224 -0
  91. package/templates/CLAUDE.md.tmpl +128 -20
  92. package/templates/MEMORY.md.tmpl +119 -0
  93. package/templates/agent.md.tmpl +205 -0
  94. package/templates/code/nestjs-controller.ts.tmpl +49 -0
  95. package/templates/code/nestjs-dto.ts.tmpl +63 -0
  96. package/templates/code/nestjs-service.ts.tmpl +45 -0
  97. package/templates/code/react-component.tsx.tmpl +24 -0
  98. package/templates/code/react-hook.ts.tmpl +54 -0
  99. package/templates/code/test.spec.ts.tmpl +50 -0
  100. package/templates/code/vue-component.vue.tmpl +49 -0
  101. package/templates/code/vue-composable.ts.tmpl +54 -0
  102. package/templates/knowledge.md.tmpl +152 -17
  103. package/templates/meeting-notes.md.tmpl +110 -0
  104. package/templates/memory/hooks.memory.json +50 -0
  105. package/templates/memory/settings.memory.json +16 -0
  106. package/templates/reports/bug-report.md.tmpl +164 -0
  107. package/templates/reports/code-review.md.tmpl +201 -0
  108. package/templates/reports/sprint-report.md.tmpl +218 -0
  109. package/templates/roles/ba.md +53 -0
  110. package/templates/roles/designer.md +82 -0
  111. package/templates/roles/dev-be.md +49 -0
  112. package/templates/roles/dev-fe.md +49 -0
  113. package/templates/roles/devops.md +53 -0
  114. package/templates/roles/pm.md +49 -0
  115. package/templates/roles/qa.md +53 -0
  116. package/templates/roles/sa.md +49 -0
  117. package/templates/roles/tech-lead.md +132 -0
  118. package/templates/skills/memory/memory-status.md +78 -0
  119. package/templates/skills/memory/recall.md +160 -0
  120. package/templates/skills/memory/reflect.md +168 -0
  121. package/templates/skills/memory/remember.md +105 -0
  122. package/templates/tasks/lessons.md.tmpl +77 -0
  123. package/templates/tasks/todo.md.tmpl +53 -0
  124. package/src/commands/switch.js +0 -53
@@ -0,0 +1,192 @@
1
+ # Architecture Diagrams Reference
2
+
3
+ Architecture diagrams visualize cloud services, CI/CD deployments, and infrastructure relationships. Introduced in Mermaid v11.1.0.
4
+
5
+ ## Basic Syntax
6
+
7
+ ```mermaid
8
+ architecture-beta
9
+ group public_api(cloud)[Public API]
10
+ service api1(server)[API Server] in public_api
11
+ service db(database)[Database]
12
+
13
+ api1:R --> L:db
14
+ ```
15
+
16
+ ## Building Blocks
17
+
18
+ ### Groups
19
+
20
+ Group related services together:
21
+
22
+ ```
23
+ group {groupId}({icon})[{title}] (in {parentId})?
24
+ ```
25
+
26
+ ```mermaid
27
+ architecture-beta
28
+ group public_api(cloud)[Public API]
29
+ group private_api(cloud)[Private API] in public_api
30
+ ```
31
+
32
+ ### Services
33
+
34
+ Declare services (nodes):
35
+
36
+ ```
37
+ service {serviceId}({icon})[{title}] (in {parentId})?
38
+ ```
39
+
40
+ ```mermaid
41
+ architecture-beta
42
+ service api(server)[API Server]
43
+ service db(database)[Database]
44
+ service cache(redis)[Cache] in api
45
+ ```
46
+
47
+ ### Edges
48
+
49
+ Connect services with edges:
50
+
51
+ ```
52
+ {serviceId}{{group}}?:{T|B|L|R} {<}?--{>}? {T|B|L|R}:{serviceId}{{group}}?
53
+ ```
54
+
55
+ **Directions:** `T` (top), `B` (bottom), `L` (left), `R` (right)
56
+
57
+ **Arrows:** `<` for incoming, `>` for outgoing
58
+
59
+ ```mermaid
60
+ architecture-beta
61
+ service client(browser)[Client]
62
+ service api(server)[API]
63
+ service db(database)[Database]
64
+
65
+ client:B --> T:api
66
+ api:R --> L:db
67
+ ```
68
+
69
+ ### Junctions
70
+
71
+ Create 4-way splits:
72
+
73
+ ```
74
+ junction {junctionId} (in {parentId})?
75
+ ```
76
+
77
+ ```mermaid
78
+ architecture-beta
79
+ service input(server)[Input]
80
+ service output1(server)[Output 1]
81
+ service output2(server)[Output 2]
82
+
83
+ junction j1
84
+
85
+ input:R --> L:j1
86
+ j1:T --> B:output1
87
+ j1:B --> T:output2
88
+ ```
89
+
90
+ ## Icons
91
+
92
+ **Default icons:** `cloud`, `database`, `disk`, `internet`, `server`
93
+
94
+ **Custom icons:** Use any of 200,000+ icons from iconify.design:
95
+
96
+ ```mermaid
97
+ architecture-beta
98
+ service web(aws:ec2)[Web Server]
99
+ service storage(aws:s3)[Storage]
100
+ ```
101
+
102
+ ### Using @iconify-json Icon Packs
103
+
104
+ Use npm icon packs with Mermaid CLI for a wide variety of technology logos:
105
+
106
+ ```bash
107
+ npm install @iconify-json/logos @mermaid-js/mermaid-cli
108
+ mmdc --iconPacks @iconify-json/logos -i ./diagram.mmd -o ./output.svg
109
+ ```
110
+
111
+ Use icons with the `logos:` prefix:
112
+
113
+ ```mermaid
114
+ architecture-beta
115
+ service web(logos:docker)[Docker Container]
116
+ service k8s(logos:kubernetes)[Kubernetes Cluster]
117
+ service aws(logos:aws)[AWS Services]
118
+ service github(logos:github)[GitHub Actions]
119
+
120
+ web:R --> L:k8s
121
+ k8s:R --> L:aws
122
+ web:R --> L:github
123
+ ```
124
+
125
+ **Popular icon packs:**
126
+
127
+ | Icon Pack | Description | Install |
128
+ | ---------------------------- | --------------------------------------------- | ---------------------------------- |
129
+ | `@iconify-json/logos` | Technology brands (Docker, AWS, GitHub, etc.) | `npm i @iconify-json/logos` |
130
+ | `@iconify-json/bi` | Bootstrap icons | `npm i @iconify-json/bi` |
131
+ | `@iconify-json/mdi` | Material Design icons | `npm i @iconify-json/mdi` |
132
+ | `@iconify-json/simple-icons` | Simple icons | `npm i @iconify-json/simple-icons` |
133
+
134
+ Usage: `pack:icon-name` (e.g., `logos:docker`, `mdi:database`)
135
+
136
+ ## Complex Example
137
+
138
+ ```mermaid
139
+ architecture-beta
140
+ group internet(cloud)[Internet]
141
+ group private_vpc(cloud)[Private VPC]
142
+
143
+ service lb(load_balancer)[Load Balancer] in internet
144
+ service api1(api)[API Server 1] in private_vpc
145
+ service api2(api)[API Server 2] in private_vpc
146
+ service db(database)[Primary Database] in private_vpc
147
+ service replica(database)[Read Replica] in private_vpc
148
+
149
+ lb:R --> L:api1
150
+ lb:R --> L:api2
151
+ api1:R --> L:db
152
+ api2:R --> L:db
153
+ db:R --> L:replica
154
+ ```
155
+
156
+ ## Edge Patterns
157
+
158
+ | Pattern | Description |
159
+ | -------------------- | ------------------------- |
160
+ | `A:R -- L:B` | Horizontal edge |
161
+ | `A:T -- B:B` | Vertical edge (90 degree) |
162
+ | `A:R --> L:B` | Edge with arrow |
163
+ | `A:R <--> L:B` | Bidirectional edge |
164
+ | `A{group}:R --> L:B` | Edge from group boundary |
165
+
166
+ ## Group Edges
167
+
168
+ Connect groups using the `{group}` modifier:
169
+
170
+ ```mermaid
171
+ architecture-beta
172
+ group frontend(cloud)[Frontend]
173
+ group backend(cloud)[Backend]
174
+
175
+ service client(browser)[Client] in frontend
176
+ service api(server)[API] in backend
177
+
178
+ client{group}:B --> T:api{group}
179
+ ```
180
+
181
+ ## Best Practices
182
+
183
+ 1. Group services by environment (public/private) or layer (frontend/backend)
184
+ 2. Use consistent icons for service types
185
+ 3. Label edges with protocols (HTTPS, TCP, etc.)
186
+ 4. Use junctions for fan-out patterns
187
+ 5. Keep diagrams focused; split complex architectures into multiple views
188
+
189
+ ## Reference
190
+
191
+ - [Official Documentation](https://mermaid.js.org/syntax/architecture.html)
192
+ - [Iconify Icons](https://iconify.design)
@@ -0,0 +1,410 @@
1
+ # C4 Model Diagrams
2
+
3
+ The C4 model provides a hierarchical way to visualize software architecture at different levels of abstraction: Context, Containers, Components, and Code.
4
+
5
+ ## C4 Model Levels
6
+
7
+ 1. **System Context** - Shows the system and its users/external systems
8
+ 2. **Container** - Shows applications, databases, and services within the system
9
+ 3. **Component** - Shows internal structure of containers
10
+ 4. **Code** - Class diagrams showing implementation details (use regular class diagrams)
11
+
12
+ ## C4 Context Diagram
13
+
14
+ Shows the big picture: your system and its relationships with users and external systems.
15
+
16
+ ### Basic Syntax
17
+
18
+ ```mermaid
19
+ C4Context
20
+ title System Context for Banking System
21
+
22
+ Person(customer, "Customer", "A banking customer")
23
+ System(banking, "Banking System", "Allows customers to manage accounts")
24
+ System_Ext(email, "Email System", "Sends emails")
25
+
26
+ Rel(customer, banking, "Uses")
27
+ Rel(banking, email, "Sends emails via")
28
+ ```
29
+
30
+ ### Elements
31
+
32
+ **People:**
33
+ ```mermaid
34
+ C4Context
35
+ Person(user, "User", "Description")
36
+ Person_Ext(external, "External User", "Outside organization")
37
+ ```
38
+
39
+ **Systems:**
40
+ ```mermaid
41
+ C4Context
42
+ System(internal, "Internal System", "Description")
43
+ System_Ext(external, "External System", "Description")
44
+ SystemDb(database, "Database System", "Description")
45
+ SystemDb_Ext(external_db, "External DB", "Description")
46
+ SystemQueue(queue, "Message Queue", "Description")
47
+ SystemQueue_Ext(external_queue, "External Queue", "Description")
48
+ ```
49
+
50
+ **Relationships:**
51
+ ```mermaid
52
+ C4Context
53
+ Rel(from, to, "Label")
54
+ Rel(from, to, "Label", "Optional Technology")
55
+ BiRel(system1, system2, "Bidirectional")
56
+ ```
57
+
58
+ ### Comprehensive Context Example
59
+
60
+ ```mermaid
61
+ C4Context
62
+ title System Context - E-Commerce Platform
63
+
64
+ Person(customer, "Customer", "Shops online")
65
+ Person(admin, "Administrator", "Manages products and orders")
66
+ Person_Ext(delivery, "Delivery Personnel", "Delivers orders")
67
+
68
+ System(ecommerce, "E-Commerce Platform", "Online shopping platform")
69
+
70
+ System_Ext(payment, "Payment Gateway", "Processes payments")
71
+ System_Ext(email, "Email Service", "Sends notifications")
72
+ System_Ext(sms, "SMS Service", "Sends SMS alerts")
73
+ System_Ext(analytics, "Analytics Platform", "Tracks user behavior")
74
+ SystemQueue_Ext(shipping, "Shipping API", "Calculates shipping rates")
75
+
76
+ Rel(customer, ecommerce, "Browses products, places orders")
77
+ Rel(admin, ecommerce, "Manages catalog, reviews orders")
78
+ Rel(delivery, ecommerce, "Updates delivery status")
79
+
80
+ Rel(ecommerce, payment, "Processes payments via", "HTTPS/REST")
81
+ Rel(ecommerce, email, "Sends emails via", "SMTP")
82
+ Rel(ecommerce, sms, "Sends SMS via", "REST API")
83
+ Rel(ecommerce, analytics, "Tracks events", "JavaScript SDK")
84
+ Rel(ecommerce, shipping, "Gets shipping rates", "REST API")
85
+
86
+ UpdateRelStyle(customer, ecommerce, $offsetX="-50", $offsetY="-30")
87
+ UpdateRelStyle(admin, ecommerce, $offsetX="50", $offsetY="-30")
88
+ ```
89
+
90
+ ## C4 Container Diagram
91
+
92
+ Zooms into the system to show containers (applications, databases, services).
93
+
94
+ ### Basic Syntax
95
+
96
+ ```mermaid
97
+ C4Container
98
+ title Container Diagram for Banking System
99
+
100
+ Person(customer, "Customer")
101
+
102
+ Container_Boundary(banking, "Banking System") {
103
+ Container(web, "Web Application", "React", "Delivers static content")
104
+ Container(api, "API Application", "Node.js", "Provides banking API")
105
+ ContainerDb(db, "Database", "PostgreSQL", "Stores account data")
106
+ }
107
+
108
+ Rel(customer, web, "Uses", "HTTPS")
109
+ Rel(web, api, "Makes API calls", "HTTPS/JSON")
110
+ Rel(api, db, "Reads/writes", "SQL/TCP")
111
+ ```
112
+
113
+ ### Container Elements
114
+
115
+ ```mermaid
116
+ C4Container
117
+ Container(app, "Application", "Technology", "Description")
118
+ ContainerDb(db, "Database", "PostgreSQL", "Description")
119
+ ContainerQueue(queue, "Queue", "RabbitMQ", "Description")
120
+ Container_Ext(external, "External Service", "Tech", "Description")
121
+ ```
122
+
123
+ ### Container Boundaries
124
+
125
+ ```mermaid
126
+ C4Container
127
+ Container_Boundary(boundary_name, "Boundary Label") {
128
+ Container(app1, "App 1", "Tech")
129
+ Container(app2, "App 2", "Tech")
130
+ }
131
+ ```
132
+
133
+ ### Comprehensive Container Example
134
+
135
+ ```mermaid
136
+ C4Container
137
+ title Container Diagram - E-Commerce Platform
138
+
139
+ Person(customer, "Customer")
140
+ Person(admin, "Admin")
141
+ System_Ext(payment, "Payment Gateway")
142
+ System_Ext(email, "Email Service")
143
+
144
+ Container_Boundary(frontend, "Frontend") {
145
+ Container(web, "Web App", "React", "Delivers UI")
146
+ Container(mobile, "Mobile App", "React Native", "Mobile UI")
147
+ }
148
+
149
+ Container_Boundary(backend, "Backend Services") {
150
+ Container(api, "API Gateway", "Node.js/Express", "Routes requests")
151
+ Container(auth, "Auth Service", "Node.js", "Handles authentication")
152
+ Container(catalog, "Catalog Service", "Python/FastAPI", "Manages products")
153
+ Container(order, "Order Service", "Java/Spring", "Processes orders")
154
+ Container(notification, "Notification Service", "Node.js", "Sends notifications")
155
+ }
156
+
157
+ Container_Boundary(data, "Data Layer") {
158
+ ContainerDb(postgres, "Main Database", "PostgreSQL", "Stores core data")
159
+ ContainerDb(mongo, "Product DB", "MongoDB", "Product catalog")
160
+ ContainerDb(redis, "Cache", "Redis", "Session & caching")
161
+ ContainerQueue(queue, "Message Queue", "RabbitMQ", "Async processing")
162
+ }
163
+
164
+ Rel(customer, web, "Uses", "HTTPS")
165
+ Rel(customer, mobile, "Uses", "HTTPS")
166
+ Rel(admin, web, "Manages via", "HTTPS")
167
+
168
+ Rel(web, api, "Makes calls", "HTTPS/JSON")
169
+ Rel(mobile, api, "Makes calls", "HTTPS/JSON")
170
+
171
+ Rel(api, auth, "Authenticates", "gRPC")
172
+ Rel(api, catalog, "Gets products", "REST")
173
+ Rel(api, order, "Creates orders", "REST")
174
+
175
+ Rel(auth, postgres, "Reads/writes users", "SQL")
176
+ Rel(catalog, mongo, "Reads/writes products", "MongoDB Protocol")
177
+ Rel(order, postgres, "Reads/writes orders", "SQL")
178
+
179
+ Rel(auth, redis, "Stores sessions", "Redis Protocol")
180
+ Rel(api, redis, "Caches data", "Redis Protocol")
181
+
182
+ Rel(order, queue, "Publishes events", "AMQP")
183
+ Rel(notification, queue, "Consumes events", "AMQP")
184
+ Rel(notification, email, "Sends via", "SMTP")
185
+ Rel(order, payment, "Processes payment", "HTTPS/REST")
186
+ ```
187
+
188
+ ## C4 Component Diagram
189
+
190
+ Zooms into a container to show its internal components.
191
+
192
+ ### Basic Syntax
193
+
194
+ ```mermaid
195
+ C4Component
196
+ title Component Diagram for API Application
197
+
198
+ Container(web, "Web App", "React")
199
+ ContainerDb(db, "Database", "PostgreSQL")
200
+ System_Ext(email, "Email System")
201
+
202
+ Container_Boundary(api, "API Application") {
203
+ Component(controller, "Controller", "Express Router", "Handles HTTP")
204
+ Component(service, "Business Logic", "Service Layer", "Core logic")
205
+ Component(repository, "Data Access", "Repository", "DB operations")
206
+ Component(emailClient, "Email Client", "Client", "Sends emails")
207
+ }
208
+
209
+ Rel(web, controller, "Makes requests", "HTTPS")
210
+ Rel(controller, service, "Uses")
211
+ Rel(service, repository, "Uses")
212
+ Rel(repository, db, "Reads/writes", "SQL")
213
+ Rel(service, emailClient, "Sends emails via")
214
+ Rel(emailClient, email, "Sends", "SMTP")
215
+ ```
216
+
217
+ ### Comprehensive Component Example
218
+
219
+ ```mermaid
220
+ C4Component
221
+ title Component Diagram - Order Service
222
+
223
+ Container(api_gateway, "API Gateway", "Node.js")
224
+ ContainerDb(postgres, "Database", "PostgreSQL")
225
+ ContainerQueue(queue, "Message Queue", "RabbitMQ")
226
+ System_Ext(payment, "Payment Gateway")
227
+ System_Ext(inventory, "Inventory Service")
228
+
229
+ Container_Boundary(order_service, "Order Service") {
230
+ Component(controller, "REST Controllers", "Spring MVC", "HTTP endpoints")
231
+ Component(order_logic, "Order Manager", "Service", "Order processing logic")
232
+ Component(payment_client, "Payment Client", "REST Client", "Payment integration")
233
+ Component(inventory_client, "Inventory Client", "REST Client", "Inventory integration")
234
+ Component(repository, "Order Repository", "JPA", "Database operations")
235
+ Component(event_publisher, "Event Publisher", "Component", "Publishes domain events")
236
+ Component(validator, "Order Validator", "Component", "Validates orders")
237
+ }
238
+
239
+ Rel(api_gateway, controller, "Routes requests", "HTTPS/REST")
240
+
241
+ Rel(controller, order_logic, "Delegates to")
242
+ Rel(controller, validator, "Validates with")
243
+
244
+ Rel(order_logic, payment_client, "Processes payment")
245
+ Rel(order_logic, inventory_client, "Checks stock")
246
+ Rel(order_logic, repository, "Persists orders")
247
+ Rel(order_logic, event_publisher, "Publishes events")
248
+
249
+ Rel(payment_client, payment, "Calls", "HTTPS/REST")
250
+ Rel(inventory_client, inventory, "Calls", "HTTPS/REST")
251
+ Rel(repository, postgres, "Reads/writes", "JDBC/SQL")
252
+ Rel(event_publisher, queue, "Publishes to", "AMQP")
253
+ ```
254
+
255
+ ## Microservices Architecture Example
256
+
257
+ ```mermaid
258
+ C4Container
259
+ title Microservices Architecture - Streaming Platform
260
+
261
+ Person(user, "User", "Platform user")
262
+ Person(creator, "Content Creator", "Uploads videos")
263
+ System_Ext(cdn, "CDN", "Delivers media")
264
+ System_Ext(storage, "Object Storage", "Stores videos")
265
+ System_Ext(transcoding, "Transcoding Service", "Processes videos")
266
+
267
+ Container_Boundary(frontend, "Frontend Layer") {
268
+ Container(web, "Web Application", "Next.js", "Server-rendered UI")
269
+ Container(mobile, "Mobile Apps", "React Native", "iOS/Android apps")
270
+ }
271
+
272
+ Container_Boundary(api_layer, "API Layer") {
273
+ Container(api_gateway, "API Gateway", "Kong", "Routing, auth, rate limiting")
274
+ Container(graphql, "GraphQL Gateway", "Apollo", "Unified API")
275
+ }
276
+
277
+ Container_Boundary(services, "Microservices") {
278
+ Container(auth, "Auth Service", "Go", "Authentication & authorization")
279
+ Container(user, "User Service", "Node.js", "User profiles & preferences")
280
+ Container(video, "Video Service", "Python", "Video metadata & management")
281
+ Container(recommendation, "Recommendation Engine", "Python/ML", "Content recommendations")
282
+ Container(analytics, "Analytics Service", "Go", "View tracking & metrics")
283
+ Container(search, "Search Service", "Elasticsearch", "Content search")
284
+ Container(comment, "Comment Service", "Node.js", "Comments & discussions")
285
+ }
286
+
287
+ Container_Boundary(data, "Data Layer") {
288
+ ContainerDb(user_db, "User Database", "PostgreSQL", "User data")
289
+ ContainerDb(video_db, "Video Database", "MongoDB", "Video metadata")
290
+ ContainerDb(analytics_db, "Analytics DB", "ClickHouse", "Analytics data")
291
+ ContainerDb(cache, "Cache Layer", "Redis Cluster", "Caching & sessions")
292
+ ContainerQueue(event_bus, "Event Bus", "Kafka", "Event streaming")
293
+ ContainerDb(search_index, "Search Index", "Elasticsearch", "Search data")
294
+ }
295
+
296
+ Rel(user, web, "Uses", "HTTPS")
297
+ Rel(creator, web, "Uploads via", "HTTPS")
298
+ Rel(user, mobile, "Uses", "HTTPS")
299
+
300
+ Rel(web, api_gateway, "API calls", "HTTPS/REST")
301
+ Rel(mobile, api_gateway, "API calls", "HTTPS/REST")
302
+ Rel(web, graphql, "Queries", "HTTPS/GraphQL")
303
+
304
+ Rel(api_gateway, auth, "Authenticates", "gRPC")
305
+ Rel(graphql, video, "Gets videos", "gRPC")
306
+ Rel(graphql, user, "Gets users", "gRPC")
307
+ Rel(graphql, recommendation, "Gets recommendations", "gRPC")
308
+
309
+ Rel(video, storage, "Stores videos", "S3 API")
310
+ Rel(video, transcoding, "Sends for transcoding", "REST")
311
+ Rel(video, cdn, "Publishes to", "API")
312
+
313
+ Rel(auth, user_db, "Manages credentials", "SQL")
314
+ Rel(user, user_db, "Stores profiles", "SQL")
315
+ Rel(video, video_db, "Stores metadata", "MongoDB")
316
+ Rel(analytics, analytics_db, "Stores metrics", "SQL")
317
+
318
+ Rel(auth, cache, "Sessions", "Redis")
319
+ Rel(video, cache, "Caches metadata", "Redis")
320
+ Rel(search, search_index, "Indexes & queries", "REST")
321
+
322
+ Rel(video, event_bus, "Publishes VideoUploaded", "Kafka")
323
+ Rel(analytics, event_bus, "Publishes ViewStarted", "Kafka")
324
+ Rel(recommendation, event_bus, "Consumes events", "Kafka")
325
+ Rel(search, event_bus, "Consumes events", "Kafka")
326
+ ```
327
+
328
+ ## Best Practices
329
+
330
+ 1. **Use appropriate level** - Context for stakeholders, Container for architects, Component for developers
331
+ 2. **Keep it focused** - One system per Context diagram, one container per Component diagram
332
+ 3. **Show key relationships** - Don't clutter with every possible connection
333
+ 4. **Use consistent naming** - Same names across all diagram levels
334
+ 5. **Add technology details** - Specify frameworks, languages, protocols at Container/Component level
335
+ 6. **Update regularly** - Keep diagrams in sync with architecture
336
+ 7. **Use boundaries** - Group related containers/components logically
337
+ 8. **Document protocols** - Show communication methods (REST, gRPC, messaging)
338
+ 9. **Highlight external systems** - Use *_Ext variants for clarity
339
+ 10. **Start simple** - Begin with Context, drill down as needed
340
+
341
+ ## Common Architecture Patterns
342
+
343
+ ### Monolithic Application
344
+ ```mermaid
345
+ C4Container
346
+ Person(user, "User")
347
+
348
+ Container_Boundary(system, "Application") {
349
+ Container(app, "Web Application", "Ruby on Rails", "Monolithic application")
350
+ ContainerDb(db, "Database", "PostgreSQL", "Application database")
351
+ ContainerDb(cache, "Cache", "Redis", "Session store")
352
+ }
353
+
354
+ Rel(user, app, "Uses", "HTTPS")
355
+ Rel(app, db, "Reads/writes", "SQL")
356
+ Rel(app, cache, "Caches", "Redis Protocol")
357
+ ```
358
+
359
+ ### Three-Tier Architecture
360
+ ```mermaid
361
+ C4Container
362
+ Person(user, "User")
363
+
364
+ Container_Boundary(presentation, "Presentation Tier") {
365
+ Container(web, "Web Server", "Nginx", "Static content")
366
+ Container(app, "App Server", "Node.js", "Application logic")
367
+ }
368
+
369
+ Container_Boundary(business, "Business Tier") {
370
+ Container(api, "API Server", "Java", "Business logic")
371
+ }
372
+
373
+ Container_Boundary(data, "Data Tier") {
374
+ ContainerDb(db, "Database", "MySQL", "Data storage")
375
+ }
376
+
377
+ Rel(user, web, "Uses", "HTTPS")
378
+ Rel(web, app, "Proxies to", "HTTP")
379
+ Rel(app, api, "Calls", "REST")
380
+ Rel(api, db, "Reads/writes", "SQL")
381
+ ```
382
+
383
+ ### Event-Driven Architecture
384
+ ```mermaid
385
+ C4Container
386
+ Person(user, "User")
387
+
388
+ Container(frontend, "Frontend", "React", "User interface")
389
+ Container(api, "API Gateway", "Kong", "API routing")
390
+
391
+ Container_Boundary(services, "Services") {
392
+ Container(order, "Order Service", "Java", "Order processing")
393
+ Container(inventory, "Inventory Service", "Go", "Stock management")
394
+ Container(notification, "Notification Service", "Node.js", "Alerts")
395
+ }
396
+
397
+ ContainerQueue(events, "Event Bus", "Kafka", "Event streaming")
398
+ ContainerDb(db, "Databases", "Various", "Service databases")
399
+
400
+ Rel(user, frontend, "Uses")
401
+ Rel(frontend, api, "Calls")
402
+ Rel(api, order, "Routes to")
403
+
404
+ Rel(order, events, "Publishes OrderCreated")
405
+ Rel(events, inventory, "Consumes events")
406
+ Rel(events, notification, "Consumes events")
407
+
408
+ Rel(order, db, "Persists")
409
+ Rel(inventory, db, "Persists")
410
+ ```