ai-flow-dev 2.7.0 โ†’ 2.8.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 (171) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +573 -570
  3. package/package.json +74 -74
  4. package/prompts/backend/flow-build-phase-0.md +535 -535
  5. package/prompts/backend/flow-build-phase-1.md +626 -626
  6. package/prompts/backend/flow-build-phase-10.md +340 -340
  7. package/prompts/backend/flow-build-phase-2.md +573 -573
  8. package/prompts/backend/flow-build-phase-3.md +834 -834
  9. package/prompts/backend/flow-build-phase-4.md +554 -554
  10. package/prompts/backend/flow-build-phase-5.md +703 -703
  11. package/prompts/backend/flow-build-phase-6.md +524 -524
  12. package/prompts/backend/flow-build-phase-7.md +1001 -1001
  13. package/prompts/backend/flow-build-phase-8.md +1407 -1407
  14. package/prompts/backend/flow-build-phase-9.md +477 -477
  15. package/prompts/backend/flow-build.md +137 -137
  16. package/prompts/backend/flow-check-review.md +656 -20
  17. package/prompts/backend/flow-check-test.md +526 -14
  18. package/prompts/backend/flow-check.md +725 -67
  19. package/prompts/backend/flow-commit.md +88 -119
  20. package/prompts/backend/flow-docs-sync.md +354 -354
  21. package/prompts/backend/flow-finish.md +919 -0
  22. package/prompts/backend/flow-release.md +949 -0
  23. package/prompts/backend/flow-work-feature.md +61 -61
  24. package/prompts/backend/flow-work-fix.md +46 -46
  25. package/prompts/backend/flow-work-refactor.md +48 -48
  26. package/prompts/backend/flow-work-resume.md +34 -34
  27. package/prompts/backend/flow-work.md +1098 -1286
  28. package/prompts/desktop/flow-build-phase-0.md +359 -359
  29. package/prompts/desktop/flow-build-phase-1.md +295 -295
  30. package/prompts/desktop/flow-build-phase-10.md +357 -357
  31. package/prompts/desktop/flow-build-phase-2.md +282 -282
  32. package/prompts/desktop/flow-build-phase-3.md +291 -291
  33. package/prompts/desktop/flow-build-phase-4.md +308 -308
  34. package/prompts/desktop/flow-build-phase-5.md +269 -269
  35. package/prompts/desktop/flow-build-phase-6.md +350 -350
  36. package/prompts/desktop/flow-build-phase-7.md +297 -297
  37. package/prompts/desktop/flow-build-phase-8.md +541 -541
  38. package/prompts/desktop/flow-build-phase-9.md +439 -439
  39. package/prompts/desktop/flow-build.md +156 -156
  40. package/prompts/desktop/flow-check-review.md +656 -20
  41. package/prompts/desktop/flow-check-test.md +526 -14
  42. package/prompts/desktop/flow-check.md +725 -67
  43. package/prompts/desktop/flow-commit.md +88 -119
  44. package/prompts/desktop/flow-docs-sync.md +354 -354
  45. package/prompts/desktop/flow-finish.md +910 -0
  46. package/prompts/desktop/flow-release.md +662 -0
  47. package/prompts/desktop/flow-work-feature.md +61 -61
  48. package/prompts/desktop/flow-work-fix.md +46 -46
  49. package/prompts/desktop/flow-work-refactor.md +48 -48
  50. package/prompts/desktop/flow-work-resume.md +34 -34
  51. package/prompts/desktop/flow-work.md +1202 -1390
  52. package/prompts/frontend/flow-build-phase-0.md +425 -425
  53. package/prompts/frontend/flow-build-phase-1.md +626 -626
  54. package/prompts/frontend/flow-build-phase-10.md +33 -33
  55. package/prompts/frontend/flow-build-phase-2.md +573 -573
  56. package/prompts/frontend/flow-build-phase-3.md +782 -782
  57. package/prompts/frontend/flow-build-phase-4.md +554 -554
  58. package/prompts/frontend/flow-build-phase-5.md +703 -703
  59. package/prompts/frontend/flow-build-phase-6.md +524 -524
  60. package/prompts/frontend/flow-build-phase-7.md +1001 -1001
  61. package/prompts/frontend/flow-build-phase-8.md +872 -872
  62. package/prompts/frontend/flow-build-phase-9.md +94 -94
  63. package/prompts/frontend/flow-build.md +137 -137
  64. package/prompts/frontend/flow-check-review.md +656 -20
  65. package/prompts/frontend/flow-check-test.md +526 -14
  66. package/prompts/frontend/flow-check.md +725 -67
  67. package/prompts/frontend/flow-commit.md +88 -119
  68. package/prompts/frontend/flow-docs-sync.md +550 -550
  69. package/prompts/frontend/flow-finish.md +910 -0
  70. package/prompts/frontend/flow-release.md +519 -0
  71. package/prompts/frontend/flow-work-api.md +1540 -0
  72. package/prompts/frontend/flow-work-feature.md +61 -61
  73. package/prompts/frontend/flow-work-fix.md +38 -38
  74. package/prompts/frontend/flow-work-refactor.md +48 -48
  75. package/prompts/frontend/flow-work-resume.md +34 -34
  76. package/prompts/frontend/flow-work.md +1583 -1320
  77. package/prompts/mobile/flow-build-phase-0.md +425 -425
  78. package/prompts/mobile/flow-build-phase-1.md +626 -626
  79. package/prompts/mobile/flow-build-phase-10.md +32 -32
  80. package/prompts/mobile/flow-build-phase-2.md +573 -573
  81. package/prompts/mobile/flow-build-phase-3.md +782 -782
  82. package/prompts/mobile/flow-build-phase-4.md +554 -554
  83. package/prompts/mobile/flow-build-phase-5.md +703 -703
  84. package/prompts/mobile/flow-build-phase-6.md +524 -524
  85. package/prompts/mobile/flow-build-phase-7.md +1001 -1001
  86. package/prompts/mobile/flow-build-phase-8.md +888 -888
  87. package/prompts/mobile/flow-build-phase-9.md +90 -90
  88. package/prompts/mobile/flow-build.md +135 -135
  89. package/prompts/mobile/flow-check-review.md +656 -20
  90. package/prompts/mobile/flow-check-test.md +526 -14
  91. package/prompts/mobile/flow-check.md +725 -67
  92. package/prompts/mobile/flow-commit.md +88 -119
  93. package/prompts/mobile/flow-docs-sync.md +620 -620
  94. package/prompts/mobile/flow-finish.md +910 -0
  95. package/prompts/mobile/flow-release.md +751 -0
  96. package/prompts/mobile/flow-work-api.md +1493 -0
  97. package/prompts/mobile/flow-work-feature.md +61 -61
  98. package/prompts/mobile/flow-work-fix.md +46 -46
  99. package/prompts/mobile/flow-work-refactor.md +48 -48
  100. package/prompts/mobile/flow-work-resume.md +34 -34
  101. package/prompts/mobile/flow-work.md +1593 -1329
  102. package/prompts/shared/mermaid-guidelines.md +102 -102
  103. package/prompts/shared/scope-levels.md +114 -114
  104. package/prompts/shared/smart-skip-preflight.md +214 -214
  105. package/prompts/shared/story-points.md +55 -55
  106. package/prompts/shared/task-format.md +74 -74
  107. package/prompts/shared/task-summary-template.md +277 -277
  108. package/templates/AGENT.template.md +443 -443
  109. package/templates/backend/.clauderules.template +112 -112
  110. package/templates/backend/.cursorrules.template +102 -102
  111. package/templates/backend/README.template.md +2 -2
  112. package/templates/backend/ai-instructions.template.md +2 -2
  113. package/templates/backend/copilot-instructions.template.md +2 -2
  114. package/templates/backend/docs/api.template.md +320 -320
  115. package/templates/backend/docs/business-flows.template.md +97 -97
  116. package/templates/backend/docs/code-standards.template.md +2 -2
  117. package/templates/backend/docs/contributing.template.md +3 -3
  118. package/templates/backend/docs/data-model.template.md +520 -520
  119. package/templates/backend/docs/testing.template.md +2 -2
  120. package/templates/backend/project-brief.template.md +2 -2
  121. package/templates/backend/specs/configuration.template.md +2 -2
  122. package/templates/backend/specs/security.template.md +2 -2
  123. package/templates/desktop/.clauderules.template +112 -112
  124. package/templates/desktop/.cursorrules.template +102 -102
  125. package/templates/desktop/README.template.md +170 -170
  126. package/templates/desktop/ai-instructions.template.md +366 -366
  127. package/templates/desktop/copilot-instructions.template.md +140 -140
  128. package/templates/desktop/docs/docs/api.template.md +320 -320
  129. package/templates/desktop/docs/docs/architecture.template.md +724 -724
  130. package/templates/desktop/docs/docs/business-flows.template.md +102 -102
  131. package/templates/desktop/docs/docs/code-standards.template.md +792 -792
  132. package/templates/desktop/docs/docs/contributing.template.md +149 -149
  133. package/templates/desktop/docs/docs/data-model.template.md +520 -520
  134. package/templates/desktop/docs/docs/operations.template.md +720 -720
  135. package/templates/desktop/docs/docs/testing.template.md +722 -722
  136. package/templates/desktop/project-brief.template.md +150 -150
  137. package/templates/desktop/specs/specs/configuration.template.md +121 -121
  138. package/templates/desktop/specs/specs/security.template.md +392 -392
  139. package/templates/frontend/README.template.md +2 -2
  140. package/templates/frontend/ai-instructions.template.md +2 -2
  141. package/templates/frontend/docs/api-integration.template.md +362 -362
  142. package/templates/frontend/docs/components.template.md +2 -2
  143. package/templates/frontend/docs/error-handling.template.md +360 -360
  144. package/templates/frontend/docs/operations.template.md +107 -107
  145. package/templates/frontend/docs/performance.template.md +124 -124
  146. package/templates/frontend/docs/pwa.template.md +119 -119
  147. package/templates/frontend/docs/state-management.template.md +2 -2
  148. package/templates/frontend/docs/styling.template.md +2 -2
  149. package/templates/frontend/docs/testing.template.md +2 -2
  150. package/templates/frontend/project-brief.template.md +2 -2
  151. package/templates/frontend/specs/accessibility.template.md +95 -95
  152. package/templates/frontend/specs/configuration.template.md +2 -2
  153. package/templates/frontend/specs/security.template.md +175 -175
  154. package/templates/fullstack/README.template.md +252 -252
  155. package/templates/fullstack/ai-instructions.template.md +444 -444
  156. package/templates/fullstack/project-brief.template.md +157 -157
  157. package/templates/fullstack/specs/configuration.template.md +340 -340
  158. package/templates/mobile/README.template.md +167 -167
  159. package/templates/mobile/ai-instructions.template.md +196 -196
  160. package/templates/mobile/docs/app-store.template.md +135 -135
  161. package/templates/mobile/docs/architecture.template.md +63 -63
  162. package/templates/mobile/docs/native-features.template.md +94 -94
  163. package/templates/mobile/docs/navigation.template.md +59 -59
  164. package/templates/mobile/docs/offline-strategy.template.md +65 -65
  165. package/templates/mobile/docs/permissions.template.md +56 -56
  166. package/templates/mobile/docs/state-management.template.md +85 -85
  167. package/templates/mobile/docs/testing.template.md +109 -109
  168. package/templates/mobile/project-brief.template.md +69 -69
  169. package/templates/mobile/specs/build-configuration.template.md +91 -91
  170. package/templates/mobile/specs/deployment.template.md +92 -92
  171. package/templates/work.template.md +47 -47
@@ -1,724 +1,724 @@
1
- # System Architecture
2
-
3
- > Technical architecture and design patterns for {{PROJECT_NAME}}
4
-
5
- ---
6
-
7
- ## ๐Ÿ—๏ธ Architecture Pattern
8
-
9
- **Pattern:** {{ARCHITECTURE_PATTERN}}
10
-
11
- ### Why This Pattern?
12
-
13
- ## {{ARCHITECTURE_RATIONALE}}
14
-
15
- ## ๐Ÿงฑ System Components
16
-
17
- ### High-Level Architecture
18
-
19
- ```
20
- {{ARCHITECTURE_DIAGRAM}}
21
- ```
22
-
23
- ### Component Overview
24
-
25
- {{#EACH COMPONENT}}
26
-
27
- #### {{COMPONENT_NAME}}
28
-
29
- **Purpose:** {{COMPONENT_PURPOSE}}
30
-
31
- **Responsibilities:**
32
- {{#EACH RESPONSIBILITY}}
33
-
34
- - {{RESPONSIBILITY_DESCRIPTION}}
35
- {{/EACH}}
36
-
37
- **Dependencies:**
38
- {{#EACH DEPENDENCY}}
39
-
40
- - {{DEPENDENCY_NAME}}
41
- {{/EACH}}
42
-
43
- ## {{/EACH}}
44
-
45
- ## ๐Ÿ“Š Layer Structure
46
-
47
- {{#IF LAYERED_ARCHITECTURE}}
48
-
49
- ### Presentation Layer
50
-
51
- **Location:** `{{PRESENTATION_LAYER_PATH}}`
52
-
53
- **Responsibilities:**
54
-
55
- - HTTP request/response handling
56
- - Input validation
57
- - Route definitions
58
- - Middleware integration
59
-
60
- **Rules:**
61
-
62
- - โŒ No business logic
63
- - โŒ No direct database access
64
- - โœ… Thin controllers
65
- - โœ… Delegate to services
66
-
67
- ### Business Logic Layer
68
-
69
- **Location:** `{{BUSINESS_LAYER_PATH}}`
70
-
71
- **Responsibilities:**
72
-
73
- - Core business rules
74
- - Use case orchestration
75
- - Transaction management
76
- - Domain logic
77
-
78
- **Rules:**
79
-
80
- - โŒ No HTTP concerns
81
- - โŒ No database-specific code
82
- - โœ… Framework-agnostic
83
- - โœ… Testable in isolation
84
-
85
- ### Data Access Layer
86
-
87
- **Location:** `{{DATA_LAYER_PATH}}`
88
-
89
- **Responsibilities:**
90
-
91
- - Database operations
92
- - Query construction
93
- - Data mapping
94
- - Cache management
95
-
96
- **Rules:**
97
-
98
- - โŒ No business logic
99
- - โœ… Repository pattern
100
- - โœ… ORM abstraction
101
- - โœ… Transaction support
102
-
103
- ## {{/IF}}
104
-
105
- ## ๐Ÿ”„ Request Flow
106
-
107
- ### Typical Request Lifecycle
108
-
109
- ```
110
- {{REQUEST_FLOW_DIAGRAM}}
111
- ```
112
-
113
- ### Flow Steps
114
-
115
- {{#EACH FLOW_STEP}}
116
- {{STEP_NUMBER}}. **{{STEP_NAME}}**
117
-
118
- - Component: {{COMPONENT}}
119
- - Action: {{ACTION_DESCRIPTION}}
120
- - Output: {{OUTPUT}}
121
- {{/EACH}}
122
-
123
- ---
124
-
125
- ## ๐ŸŽฏ Design Patterns
126
-
127
- {{#EACH DESIGN_PATTERN}}
128
-
129
- ### {{PATTERN_NAME}}
130
-
131
- **Purpose:** {{PATTERN_PURPOSE}}
132
-
133
- **Used In:** {{PATTERN_USAGE}}
134
-
135
- **Example:**
136
-
137
- ```{{LANGUAGE}}
138
- {{PATTERN_EXAMPLE}}
139
- ```
140
-
141
- ## {{/EACH}}
142
-
143
- ## ๐Ÿ“ Project Structure
144
-
145
- ```
146
- {{PROJECT_STRUCTURE_DETAILED}}
147
- ```
148
-
149
- ### Directory Descriptions
150
-
151
- {{#EACH DIRECTORY}}
152
-
153
- - **`{{DIR_PATH}}`** - {{DIR_DESCRIPTION}}
154
- {{/EACH}}
155
-
156
- ---
157
-
158
- ## ๐Ÿ”Œ Module Organization
159
-
160
- **Strategy:** {{MODULE_ORGANIZATION_STRATEGY}}
161
-
162
- {{#IF FEATURE_BASED}}
163
-
164
- ### Feature Modules
165
-
166
- Each feature is self-contained:
167
-
168
- ```
169
- src/
170
- {{FEATURE_EXAMPLE}}/
171
- {{FEATURE_EXAMPLE}}.controller.ts
172
- {{FEATURE_EXAMPLE}}.service.ts
173
- {{FEATURE_EXAMPLE}}.repository.ts
174
- {{FEATURE_EXAMPLE}}.dto.ts
175
- {{FEATURE_EXAMPLE}}.entity.ts
176
- {{FEATURE_EXAMPLE}}.module.ts
177
- {{FEATURE_EXAMPLE}}.spec.ts
178
- ```
179
-
180
- **Benefits:**
181
-
182
- - Clear boundaries
183
- - Easy to find related code
184
- - Supports team ownership
185
- - Facilitates microservices extraction
186
-
187
- {{/IF}}
188
-
189
- {{#IF LAYER_BASED}}
190
-
191
- ### Layer-Based Organization
192
-
193
- Organized by technical layer:
194
-
195
- ```
196
- src/
197
- controllers/
198
- {{ENTITY_EXAMPLE}}.controller.ts
199
- services/
200
- {{ENTITY_EXAMPLE}}.service.ts
201
- repositories/
202
- {{ENTITY_EXAMPLE}}.repository.ts
203
- ```
204
-
205
- ## {{/IF}}
206
-
207
- ## ๐Ÿ”— Dependency Management
208
-
209
- ### Dependency Injection
210
-
211
- **Container:** {{DI_CONTAINER}}
212
-
213
- **Registration:**
214
-
215
- ```{{LANGUAGE}}
216
- {{DI_REGISTRATION_EXAMPLE}}
217
- ```
218
-
219
- **Usage:**
220
-
221
- ```{{LANGUAGE}}
222
- {{DI_USAGE_EXAMPLE}}
223
- ```
224
-
225
- ### Dependency Rules
226
-
227
- ```
228
- High-level modules should not depend on low-level modules.
229
- Both should depend on abstractions.
230
-
231
- Allowed: Controller โ†’ Service โ†’ Repository
232
- Not Allowed: Controller โ†’ Repository (bypasses service)
233
- ```
234
-
235
- ---
236
-
237
- ## ๐ŸŒ API Structure
238
-
239
- **Style:** {{API_STYLE}}
240
-
241
- **Versioning:** {{API_VERSIONING_STRATEGY}}
242
-
243
- ### API Gateway
244
-
245
- {{#IF API_GATEWAY}}
246
- **Gateway:** {{API_GATEWAY_NAME}}
247
-
248
- **Purpose:** {{API_GATEWAY_PURPOSE}}
249
-
250
- **Configuration:**
251
-
252
- - Rate limiting: {{GATEWAY_RATE_LIMITING}}
253
- - Authentication: {{GATEWAY_AUTHENTICATION}}
254
- - Request routing: {{GATEWAY_ROUTING}}
255
- - Load balancing: {{GATEWAY_LOAD_BALANCING}}
256
-
257
- **Routes:**
258
- {{#EACH GATEWAY_ROUTE}}
259
-
260
- - **{{ROUTE_PATH}}** โ†’ {{TARGET_SERVICE}} ({{ROUTE_METHODS}})
261
- {{/EACH}}
262
-
263
- {{ELSE}}
264
- **API Gateway:** Not used - Direct API access
265
- {{/IF}}
266
-
267
- ### API Documentation
268
-
269
- **Tool:** {{API_DOC_TOOL}}
270
-
271
- {{#IF SWAGGER_OPENAPI}}
272
- **Swagger/OpenAPI:**
273
-
274
- - Specification: `{{OPENAPI_SPEC_PATH}}`
275
- - UI endpoint: `{{SWAGGER_UI_URL}}`
276
- - Strategy: {{API_DOC_STRATEGY}} ({{#IF CODE_FIRST}}Code-First{{ELSE}}Design-First{{/IF}})
277
-
278
- **Auto-generation:** {{#IF AUTO_GENERATE_DOCS}}Enabled{{ELSE}}Manual{{/IF}}
279
-
280
- {{#IF AUTO_GENERATE_DOCS}}
281
- **Example:**
282
-
283
- ```{{LANGUAGE}}
284
- {{API_DOC_EXAMPLE}}
285
- ```
286
-
287
- {{/IF}}
288
- {{/IF}}
289
-
290
- ### Endpoint Patterns
291
-
292
- {{#IF REST_API}}
293
-
294
- #### REST Conventions
295
-
296
- | Resource | Method | Endpoint | Description |
297
- | ----------------- | --------- | ---------------------------------------- | ----------- |
298
- | {{RESOURCE_NAME}} | GET | /{{API_VERSION}}/{{RESOURCE_PLURAL}} | List all |
299
- | {{RESOURCE_NAME}} | GET | /{{API_VERSION}}/{{RESOURCE_PLURAL}}/:id | Get one |
300
- | {{RESOURCE_NAME}} | POST | /{{API_VERSION}}/{{RESOURCE_PLURAL}} | Create |
301
- | {{RESOURCE_NAME}} | PUT/PATCH | /{{API_VERSION}}/{{RESOURCE_PLURAL}}/:id | Update |
302
- | {{RESOURCE_NAME}} | DELETE | /{{API_VERSION}}/{{RESOURCE_PLURAL}}/:id | Delete |
303
-
304
- {{/IF}}
305
-
306
- {{#IF GRAPHQL}}
307
-
308
- #### GraphQL Schema
309
-
310
- ```graphql
311
- {{GRAPHQL_SCHEMA_EXAMPLE}}
312
- ```
313
-
314
- ## {{/IF}}
315
-
316
- ## ๐Ÿ“ฆ External Dependencies
317
-
318
- ### Core Libraries
319
-
320
- {{#EACH CORE_LIBRARY}}
321
-
322
- - **{{LIBRARY_NAME}}** ({{LIBRARY_VERSION}})
323
- - Purpose: {{LIBRARY_PURPOSE}}
324
- - Critical: {{IS_CRITICAL}}
325
- {{/EACH}}
326
-
327
- ### External Services
328
-
329
- {{#EACH EXTERNAL_SERVICE}}
330
-
331
- - **{{SERVICE_NAME}}**
332
- - Purpose: {{SERVICE_PURPOSE}}
333
- - Integration: {{INTEGRATION_METHOD}}
334
- - Fallback: {{FALLBACK_STRATEGY}}
335
- {{/EACH}}
336
-
337
- ---
338
-
339
- ## โš™๏ธ Background Processing
340
-
341
- {{#IF BACKGROUND_JOBS_ENABLED}}
342
- **Queue System:** {{QUEUE_SYSTEM}}
343
-
344
- **Job Types:**
345
- {{#EACH JOB_TYPE}}
346
-
347
- ### {{JOB_NAME}}
348
-
349
- - **Purpose:** {{JOB_PURPOSE}}
350
- - **Trigger:** {{JOB_TRIGGER}}
351
- - **Priority:** {{JOB_PRIORITY}}
352
- - **Retry Strategy:** {{JOB_RETRY_STRATEGY}}
353
- - **Timeout:** {{JOB_TIMEOUT}}
354
-
355
- {{/EACH}}
356
-
357
- **Dead Letter Queue:** {{#IF DLQ_ENABLED}}Enabled{{ELSE}}Disabled{{/IF}}
358
-
359
- **Monitoring:**
360
-
361
- - Dashboard: {{QUEUE_DASHBOARD}}
362
- - Alerts: {{QUEUE_ALERTS}}
363
-
364
- **Example:**
365
-
366
- ```{{LANGUAGE}}
367
- {{BACKGROUND_JOB_EXAMPLE}}
368
- ```
369
-
370
- {{ELSE}}
371
- **Background Processing:** Not implemented - All operations are synchronous
372
- {{/IF}}
373
-
374
- ---
375
-
376
- ## ๐Ÿ”Œ Real-time Communication
377
-
378
- {{#IF REALTIME_ENABLED}}
379
-
380
- ### WebSockets
381
-
382
- **Enabled:** Yes
383
-
384
- **Use Cases:**
385
- {{#EACH WEBSOCKET_USE_CASE}}
386
-
387
- - {{USE_CASE_DESCRIPTION}}
388
- {{/EACH}}
389
-
390
- **Implementation:**
391
-
392
- - Library: {{WEBSOCKET_LIBRARY}}
393
- - Protocol: {{WEBSOCKET_PROTOCOL}}
394
- - Authentication: {{WEBSOCKET_AUTH}}
395
-
396
- **Connection Management:**
397
-
398
- - Max connections: {{WEBSOCKET_MAX_CONNECTIONS}}
399
- - Heartbeat interval: {{WEBSOCKET_HEARTBEAT}}s
400
- - Reconnection strategy: {{WEBSOCKET_RECONNECTION}}
401
-
402
- **Example:**
403
-
404
- ```{{LANGUAGE}}
405
- {{WEBSOCKET_EXAMPLE}}
406
- ```
407
-
408
- ### Server-Sent Events (SSE)
409
-
410
- {{#IF SSE_ENABLED}}
411
- **Enabled:** Yes
412
-
413
- **Use Cases:**
414
- {{#EACH SSE_USE_CASE}}
415
-
416
- - {{USE_CASE_DESCRIPTION}}
417
- {{/EACH}}
418
-
419
- **Implementation:**
420
-
421
- ```{{LANGUAGE}}
422
- {{SSE_EXAMPLE}}
423
- ```
424
-
425
- {{ELSE}}
426
- **Enabled:** No
427
- {{/IF}}
428
-
429
- {{ELSE}}
430
- **Real-time Communication:** Not implemented
431
- {{/IF}}
432
-
433
- ---
434
-
435
- ## ๏ฟฝ File Storage
436
-
437
- {{#IF FILE_STORAGE_ENABLED}}
438
- **Storage Type:** {{FILE_STORAGE_TYPE}}
439
-
440
- **Provider:** {{FILE_STORAGE_PROVIDER}}
441
-
442
- **Configuration:**
443
-
444
- - Bucket/Container: {{FILE_STORAGE_BUCKET}}
445
- - Region: {{FILE_STORAGE_REGION}}
446
- - CDN: {{FILE_CDN_ENABLED}}
447
-
448
- **Allowed File Types:**
449
- {{#EACH ALLOWED_FILE_TYPE}}
450
-
451
- - {{FILE_TYPE}} (max: {{MAX_SIZE}})
452
- {{/EACH}}
453
-
454
- **Max File Size:** {{MAX_FILE_SIZE}} MB
455
-
456
- **Upload Process:**
457
-
458
- 1. Client requests presigned URL / upload endpoint
459
- 2. File uploaded to {{FILE_STORAGE_PROVIDER}}
460
- 3. Metadata stored in database
461
- 4. {{#IF FILE_CDN_ENABLED}}CDN URL returned{{ELSE}}Direct URL returned{{/IF}}
462
-
463
- **Security:**
464
-
465
- - Presigned URLs: {{PRESIGNED_URL_EXPIRY}} expiry
466
- - Access control: {{FILE_ACCESS_CONTROL}}
467
- - Virus scanning: {{VIRUS_SCANNING_ENABLED}}
468
-
469
- {{ELSE}}
470
- **File Storage:** Not implemented
471
- {{/IF}}
472
-
473
- ---
474
-
475
- ## ๏ฟฝ๐Ÿ“จ Message Broker Patterns
476
-
477
- {{#IF MESSAGE_BROKER}}
478
- **Broker:** {{MESSAGE_BROKER_NAME}}
479
-
480
- **Patterns Used:**
481
- {{#EACH MESSAGE_PATTERN}}
482
-
483
- ### {{PATTERN_NAME}}
484
-
485
- **Type:** {{PATTERN_TYPE}} ({{#IF PUB_SUB}}Pub/Sub{{ELSE}}Queue{{/IF}})
486
-
487
- **Use Case:** {{PATTERN_USE_CASE}}
488
-
489
- **Topics/Queues:**
490
- {{#EACH TOPIC_QUEUE}}
491
-
492
- - **{{NAME}}**: {{DESCRIPTION}}
493
- - Producers: {{PRODUCERS}}
494
- - Consumers: {{CONSUMERS}}
495
- - Retention: {{RETENTION}}
496
- {{/EACH}}
497
-
498
- **Delivery Guarantees:** {{DELIVERY_GUARANTEES}} ({{#IF AT_LEAST_ONCE}}At-least-once{{ELSE}}{{#IF EXACTLY_ONCE}}Exactly-once{{ELSE}}At-most-once{{/IF}}{{/IF}})
499
-
500
- **Implementation:**
501
-
502
- ```{{LANGUAGE}}
503
- {{PATTERN_EXAMPLE}}
504
- ```
505
-
506
- {{/EACH}}
507
-
508
- **Error Handling:**
509
-
510
- - Dead letter queue: {{#IF DLQ_ENABLED}}Enabled{{ELSE}}Disabled{{/IF}}
511
- - Retry strategy: {{RETRY_STRATEGY}}
512
- - Max retries: {{MAX_RETRIES}}
513
-
514
- {{ELSE}}
515
- **Message Broker:** Not used
516
- {{/IF}}
517
-
518
- ---
519
-
520
- ## ๐Ÿ•ธ๏ธ Service Mesh
521
-
522
- {{#IF SERVICE_MESH}}
523
- **Mesh:** {{SERVICE_MESH_NAME}}
524
-
525
- **Purpose:** {{SERVICE_MESH_PURPOSE}}
526
-
527
- **Features:**
528
-
529
- - Service discovery: {{SERVICE_DISCOVERY}}
530
- - Load balancing: {{MESH_LOAD_BALANCING}}
531
- - Traffic management: {{TRAFFIC_MANAGEMENT}}
532
- - Security: {{MESH_SECURITY}} (mTLS)
533
- - Observability: {{MESH_OBSERVABILITY}}
534
-
535
- **Configuration:**
536
-
537
- ```yaml
538
- { { SERVICE_MESH_CONFIG_EXAMPLE } }
539
- ```
540
-
541
- {{ELSE}}
542
- **Service Mesh:** Not used (monolith or simple microservices)
543
- {{/IF}}
544
-
545
- ---
546
-
547
- ## ๐Ÿ” Security Architecture
548
-
549
- ### Authentication Flow
550
-
551
- ```
552
- {{AUTH_FLOW_DIAGRAM}}
553
- ```
554
-
555
- ### Authorization Model
556
-
557
- **Type:** {{AUTHORIZATION_MODEL}}
558
-
559
- ## **Implementation:** See `specs/security.md` for details.
560
-
561
- ## ๐Ÿ’พ Data Flow
562
-
563
- ### Create Operation
564
-
565
- ```
566
- {{CREATE_FLOW_DIAGRAM}}
567
- ```
568
-
569
- ### Read Operation
570
-
571
- ```
572
- {{READ_FLOW_DIAGRAM}}
573
- ```
574
-
575
- ### Update Operation
576
-
577
- ```
578
- {{UPDATE_FLOW_DIAGRAM}}
579
- ```
580
-
581
- ### Delete Operation
582
-
583
- ```
584
- {{DELETE_FLOW_DIAGRAM}}
585
- ```
586
-
587
- ---
588
-
589
- ## โšก Performance Considerations
590
-
591
- ### Caching Strategy
592
-
593
- {{#IF CACHING_ENABLED}}
594
- **Cache Type:** {{CACHE_TYPE}}
595
-
596
- **What We Cache:**
597
- {{#EACH CACHED_ITEM}}
598
-
599
- - {{ITEM_DESCRIPTION}} (TTL: {{TTL}})
600
- {{/EACH}}
601
-
602
- **Invalidation:**
603
- {{CACHE_INVALIDATION_STRATEGY}}
604
-
605
- {{ELSE}}
606
- No caching implemented yet.
607
- {{/IF}}
608
-
609
- ### Database Optimization
610
-
611
- {{#EACH DB_OPTIMIZATION}}
612
-
613
- - {{OPTIMIZATION_DESCRIPTION}}
614
- {{/EACH}}
615
-
616
- ---
617
-
618
- ## ๐Ÿ”ง Configuration Management
619
-
620
- **Strategy:** {{CONFIG_STRATEGY}}
621
-
622
- **Configuration Loaded From:**
623
- {{#EACH CONFIG_SOURCE}}
624
-
625
- - {{CONFIG_SOURCE_DESCRIPTION}}
626
- {{/EACH}}
627
-
628
- **Per Environment:**
629
-
630
- - Development: {{DEV_CONFIG}}
631
- - Staging: {{STAGING_CONFIG}}
632
- - Production: {{PROD_CONFIG}}
633
-
634
- ---
635
-
636
- ## ๐Ÿ“ Error Handling Architecture
637
-
638
- ### Error Hierarchy
639
-
640
- ```{{LANGUAGE}}
641
- {{ERROR_HIERARCHY_EXAMPLE}}
642
- ```
643
-
644
- ### Error Flow
645
-
646
- ```
647
- {{ERROR_FLOW_DIAGRAM}}
648
- ```
649
-
650
- ---
651
-
652
- ## ๐Ÿงช Testing Architecture
653
-
654
- **Strategy:** See `docs/testing.md`
655
-
656
- **Testability Features:**
657
-
658
- - Dependency injection enables mocking
659
- - Services isolated from framework
660
- - Repository pattern abstracts database
661
- - DTOs validate at boundaries
662
-
663
- ---
664
-
665
- ## ๐Ÿ“ˆ Scalability
666
-
667
- ### Horizontal Scaling
668
-
669
- {{HORIZONTAL_SCALING_STRATEGY}}
670
-
671
- ### Vertical Scaling
672
-
673
- {{VERTICAL_SCALING_STRATEGY}}
674
-
675
- ### Bottlenecks
676
-
677
- {{#EACH BOTTLENECK}}
678
-
679
- - **{{BOTTLENECK_NAME}}**: {{MITIGATION_STRATEGY}}
680
- {{/EACH}}
681
-
682
- ---
683
-
684
- ## ๐Ÿš€ Deployment Architecture
685
-
686
- See `docs/operations.md` for full deployment details.
687
-
688
- **Deployment Model:** {{DEPLOYMENT_MODEL}}
689
-
690
- ## **Infrastructure:** {{INFRASTRUCTURE}}
691
-
692
- ## ๐Ÿ“š Architecture Decision Records (ADRs)
693
-
694
- {{#IF ADR_ENABLED}}
695
- Location: `specs/adr/`
696
-
697
- {{#EACH ADR}}
698
-
699
- - [ADR-{{ADR_NUMBER}}: {{ADR_TITLE}}](../specs/adr/{{ADR_FILE}})
700
- {{/EACH}}
701
-
702
- {{ELSE}}
703
- ADRs will be added as significant architectural decisions are made.
704
- {{/IF}}
705
-
706
- ---
707
-
708
- ## ๐Ÿ”„ Future Considerations
709
-
710
- {{#EACH FUTURE_CONSIDERATION}}
711
-
712
- ### {{CONSIDERATION_TITLE}}
713
-
714
- {{CONSIDERATION_DESCRIPTION}}
715
-
716
- **When:** {{CONSIDERATION_TIMELINE}}
717
-
718
- ## {{/EACH}}
719
-
720
- **Document Version:** 1.0
721
-
722
- **Last Updated:** {{GENERATION_DATE}}
723
-
724
- **Generated by:** AI Flow v1.0.0
1
+ # System Architecture
2
+
3
+ > Technical architecture and design patterns for {{PROJECT_NAME}}
4
+
5
+ ---
6
+
7
+ ## ๐Ÿ—๏ธ Architecture Pattern
8
+
9
+ **Pattern:** {{ARCHITECTURE_PATTERN}}
10
+
11
+ ### Why This Pattern?
12
+
13
+ ## {{ARCHITECTURE_RATIONALE}}
14
+
15
+ ## ๐Ÿงฑ System Components
16
+
17
+ ### High-Level Architecture
18
+
19
+ ```
20
+ {{ARCHITECTURE_DIAGRAM}}
21
+ ```
22
+
23
+ ### Component Overview
24
+
25
+ {{#EACH COMPONENT}}
26
+
27
+ #### {{COMPONENT_NAME}}
28
+
29
+ **Purpose:** {{COMPONENT_PURPOSE}}
30
+
31
+ **Responsibilities:**
32
+ {{#EACH RESPONSIBILITY}}
33
+
34
+ - {{RESPONSIBILITY_DESCRIPTION}}
35
+ {{/EACH}}
36
+
37
+ **Dependencies:**
38
+ {{#EACH DEPENDENCY}}
39
+
40
+ - {{DEPENDENCY_NAME}}
41
+ {{/EACH}}
42
+
43
+ ## {{/EACH}}
44
+
45
+ ## ๐Ÿ“Š Layer Structure
46
+
47
+ {{#IF LAYERED_ARCHITECTURE}}
48
+
49
+ ### Presentation Layer
50
+
51
+ **Location:** `{{PRESENTATION_LAYER_PATH}}`
52
+
53
+ **Responsibilities:**
54
+
55
+ - HTTP request/response handling
56
+ - Input validation
57
+ - Route definitions
58
+ - Middleware integration
59
+
60
+ **Rules:**
61
+
62
+ - โŒ No business logic
63
+ - โŒ No direct database access
64
+ - โœ… Thin controllers
65
+ - โœ… Delegate to services
66
+
67
+ ### Business Logic Layer
68
+
69
+ **Location:** `{{BUSINESS_LAYER_PATH}}`
70
+
71
+ **Responsibilities:**
72
+
73
+ - Core business rules
74
+ - Use case orchestration
75
+ - Transaction management
76
+ - Domain logic
77
+
78
+ **Rules:**
79
+
80
+ - โŒ No HTTP concerns
81
+ - โŒ No database-specific code
82
+ - โœ… Framework-agnostic
83
+ - โœ… Testable in isolation
84
+
85
+ ### Data Access Layer
86
+
87
+ **Location:** `{{DATA_LAYER_PATH}}`
88
+
89
+ **Responsibilities:**
90
+
91
+ - Database operations
92
+ - Query construction
93
+ - Data mapping
94
+ - Cache management
95
+
96
+ **Rules:**
97
+
98
+ - โŒ No business logic
99
+ - โœ… Repository pattern
100
+ - โœ… ORM abstraction
101
+ - โœ… Transaction support
102
+
103
+ ## {{/IF}}
104
+
105
+ ## ๐Ÿ”„ Request Flow
106
+
107
+ ### Typical Request Lifecycle
108
+
109
+ ```
110
+ {{REQUEST_FLOW_DIAGRAM}}
111
+ ```
112
+
113
+ ### Flow Steps
114
+
115
+ {{#EACH FLOW_STEP}}
116
+ {{STEP_NUMBER}}. **{{STEP_NAME}}**
117
+
118
+ - Component: {{COMPONENT}}
119
+ - Action: {{ACTION_DESCRIPTION}}
120
+ - Output: {{OUTPUT}}
121
+ {{/EACH}}
122
+
123
+ ---
124
+
125
+ ## ๐ŸŽฏ Design Patterns
126
+
127
+ {{#EACH DESIGN_PATTERN}}
128
+
129
+ ### {{PATTERN_NAME}}
130
+
131
+ **Purpose:** {{PATTERN_PURPOSE}}
132
+
133
+ **Used In:** {{PATTERN_USAGE}}
134
+
135
+ **Example:**
136
+
137
+ ```{{LANGUAGE}}
138
+ {{PATTERN_EXAMPLE}}
139
+ ```
140
+
141
+ ## {{/EACH}}
142
+
143
+ ## ๐Ÿ“ Project Structure
144
+
145
+ ```
146
+ {{PROJECT_STRUCTURE_DETAILED}}
147
+ ```
148
+
149
+ ### Directory Descriptions
150
+
151
+ {{#EACH DIRECTORY}}
152
+
153
+ - **`{{DIR_PATH}}`** - {{DIR_DESCRIPTION}}
154
+ {{/EACH}}
155
+
156
+ ---
157
+
158
+ ## ๐Ÿ”Œ Module Organization
159
+
160
+ **Strategy:** {{MODULE_ORGANIZATION_STRATEGY}}
161
+
162
+ {{#IF FEATURE_BASED}}
163
+
164
+ ### Feature Modules
165
+
166
+ Each feature is self-contained:
167
+
168
+ ```
169
+ src/
170
+ {{FEATURE_EXAMPLE}}/
171
+ {{FEATURE_EXAMPLE}}.controller.ts
172
+ {{FEATURE_EXAMPLE}}.service.ts
173
+ {{FEATURE_EXAMPLE}}.repository.ts
174
+ {{FEATURE_EXAMPLE}}.dto.ts
175
+ {{FEATURE_EXAMPLE}}.entity.ts
176
+ {{FEATURE_EXAMPLE}}.module.ts
177
+ {{FEATURE_EXAMPLE}}.spec.ts
178
+ ```
179
+
180
+ **Benefits:**
181
+
182
+ - Clear boundaries
183
+ - Easy to find related code
184
+ - Supports team ownership
185
+ - Facilitates microservices extraction
186
+
187
+ {{/IF}}
188
+
189
+ {{#IF LAYER_BASED}}
190
+
191
+ ### Layer-Based Organization
192
+
193
+ Organized by technical layer:
194
+
195
+ ```
196
+ src/
197
+ controllers/
198
+ {{ENTITY_EXAMPLE}}.controller.ts
199
+ services/
200
+ {{ENTITY_EXAMPLE}}.service.ts
201
+ repositories/
202
+ {{ENTITY_EXAMPLE}}.repository.ts
203
+ ```
204
+
205
+ ## {{/IF}}
206
+
207
+ ## ๐Ÿ”— Dependency Management
208
+
209
+ ### Dependency Injection
210
+
211
+ **Container:** {{DI_CONTAINER}}
212
+
213
+ **Registration:**
214
+
215
+ ```{{LANGUAGE}}
216
+ {{DI_REGISTRATION_EXAMPLE}}
217
+ ```
218
+
219
+ **Usage:**
220
+
221
+ ```{{LANGUAGE}}
222
+ {{DI_USAGE_EXAMPLE}}
223
+ ```
224
+
225
+ ### Dependency Rules
226
+
227
+ ```
228
+ High-level modules should not depend on low-level modules.
229
+ Both should depend on abstractions.
230
+
231
+ Allowed: Controller โ†’ Service โ†’ Repository
232
+ Not Allowed: Controller โ†’ Repository (bypasses service)
233
+ ```
234
+
235
+ ---
236
+
237
+ ## ๐ŸŒ API Structure
238
+
239
+ **Style:** {{API_STYLE}}
240
+
241
+ **Versioning:** {{API_VERSIONING_STRATEGY}}
242
+
243
+ ### API Gateway
244
+
245
+ {{#IF API_GATEWAY}}
246
+ **Gateway:** {{API_GATEWAY_NAME}}
247
+
248
+ **Purpose:** {{API_GATEWAY_PURPOSE}}
249
+
250
+ **Configuration:**
251
+
252
+ - Rate limiting: {{GATEWAY_RATE_LIMITING}}
253
+ - Authentication: {{GATEWAY_AUTHENTICATION}}
254
+ - Request routing: {{GATEWAY_ROUTING}}
255
+ - Load balancing: {{GATEWAY_LOAD_BALANCING}}
256
+
257
+ **Routes:**
258
+ {{#EACH GATEWAY_ROUTE}}
259
+
260
+ - **{{ROUTE_PATH}}** โ†’ {{TARGET_SERVICE}} ({{ROUTE_METHODS}})
261
+ {{/EACH}}
262
+
263
+ {{ELSE}}
264
+ **API Gateway:** Not used - Direct API access
265
+ {{/IF}}
266
+
267
+ ### API Documentation
268
+
269
+ **Tool:** {{API_DOC_TOOL}}
270
+
271
+ {{#IF SWAGGER_OPENAPI}}
272
+ **Swagger/OpenAPI:**
273
+
274
+ - Specification: `{{OPENAPI_SPEC_PATH}}`
275
+ - UI endpoint: `{{SWAGGER_UI_URL}}`
276
+ - Strategy: {{API_DOC_STRATEGY}} ({{#IF CODE_FIRST}}Code-First{{ELSE}}Design-First{{/IF}})
277
+
278
+ **Auto-generation:** {{#IF AUTO_GENERATE_DOCS}}Enabled{{ELSE}}Manual{{/IF}}
279
+
280
+ {{#IF AUTO_GENERATE_DOCS}}
281
+ **Example:**
282
+
283
+ ```{{LANGUAGE}}
284
+ {{API_DOC_EXAMPLE}}
285
+ ```
286
+
287
+ {{/IF}}
288
+ {{/IF}}
289
+
290
+ ### Endpoint Patterns
291
+
292
+ {{#IF REST_API}}
293
+
294
+ #### REST Conventions
295
+
296
+ | Resource | Method | Endpoint | Description |
297
+ | ----------------- | --------- | ---------------------------------------- | ----------- |
298
+ | {{RESOURCE_NAME}} | GET | /{{API_VERSION}}/{{RESOURCE_PLURAL}} | List all |
299
+ | {{RESOURCE_NAME}} | GET | /{{API_VERSION}}/{{RESOURCE_PLURAL}}/:id | Get one |
300
+ | {{RESOURCE_NAME}} | POST | /{{API_VERSION}}/{{RESOURCE_PLURAL}} | Create |
301
+ | {{RESOURCE_NAME}} | PUT/PATCH | /{{API_VERSION}}/{{RESOURCE_PLURAL}}/:id | Update |
302
+ | {{RESOURCE_NAME}} | DELETE | /{{API_VERSION}}/{{RESOURCE_PLURAL}}/:id | Delete |
303
+
304
+ {{/IF}}
305
+
306
+ {{#IF GRAPHQL}}
307
+
308
+ #### GraphQL Schema
309
+
310
+ ```graphql
311
+ {{GRAPHQL_SCHEMA_EXAMPLE}}
312
+ ```
313
+
314
+ ## {{/IF}}
315
+
316
+ ## ๐Ÿ“ฆ External Dependencies
317
+
318
+ ### Core Libraries
319
+
320
+ {{#EACH CORE_LIBRARY}}
321
+
322
+ - **{{LIBRARY_NAME}}** ({{LIBRARY_VERSION}})
323
+ - Purpose: {{LIBRARY_PURPOSE}}
324
+ - Critical: {{IS_CRITICAL}}
325
+ {{/EACH}}
326
+
327
+ ### External Services
328
+
329
+ {{#EACH EXTERNAL_SERVICE}}
330
+
331
+ - **{{SERVICE_NAME}}**
332
+ - Purpose: {{SERVICE_PURPOSE}}
333
+ - Integration: {{INTEGRATION_METHOD}}
334
+ - Fallback: {{FALLBACK_STRATEGY}}
335
+ {{/EACH}}
336
+
337
+ ---
338
+
339
+ ## โš™๏ธ Background Processing
340
+
341
+ {{#IF BACKGROUND_JOBS_ENABLED}}
342
+ **Queue System:** {{QUEUE_SYSTEM}}
343
+
344
+ **Job Types:**
345
+ {{#EACH JOB_TYPE}}
346
+
347
+ ### {{JOB_NAME}}
348
+
349
+ - **Purpose:** {{JOB_PURPOSE}}
350
+ - **Trigger:** {{JOB_TRIGGER}}
351
+ - **Priority:** {{JOB_PRIORITY}}
352
+ - **Retry Strategy:** {{JOB_RETRY_STRATEGY}}
353
+ - **Timeout:** {{JOB_TIMEOUT}}
354
+
355
+ {{/EACH}}
356
+
357
+ **Dead Letter Queue:** {{#IF DLQ_ENABLED}}Enabled{{ELSE}}Disabled{{/IF}}
358
+
359
+ **Monitoring:**
360
+
361
+ - Dashboard: {{QUEUE_DASHBOARD}}
362
+ - Alerts: {{QUEUE_ALERTS}}
363
+
364
+ **Example:**
365
+
366
+ ```{{LANGUAGE}}
367
+ {{BACKGROUND_JOB_EXAMPLE}}
368
+ ```
369
+
370
+ {{ELSE}}
371
+ **Background Processing:** Not implemented - All operations are synchronous
372
+ {{/IF}}
373
+
374
+ ---
375
+
376
+ ## ๐Ÿ”Œ Real-time Communication
377
+
378
+ {{#IF REALTIME_ENABLED}}
379
+
380
+ ### WebSockets
381
+
382
+ **Enabled:** Yes
383
+
384
+ **Use Cases:**
385
+ {{#EACH WEBSOCKET_USE_CASE}}
386
+
387
+ - {{USE_CASE_DESCRIPTION}}
388
+ {{/EACH}}
389
+
390
+ **Implementation:**
391
+
392
+ - Library: {{WEBSOCKET_LIBRARY}}
393
+ - Protocol: {{WEBSOCKET_PROTOCOL}}
394
+ - Authentication: {{WEBSOCKET_AUTH}}
395
+
396
+ **Connection Management:**
397
+
398
+ - Max connections: {{WEBSOCKET_MAX_CONNECTIONS}}
399
+ - Heartbeat interval: {{WEBSOCKET_HEARTBEAT}}s
400
+ - Reconnection strategy: {{WEBSOCKET_RECONNECTION}}
401
+
402
+ **Example:**
403
+
404
+ ```{{LANGUAGE}}
405
+ {{WEBSOCKET_EXAMPLE}}
406
+ ```
407
+
408
+ ### Server-Sent Events (SSE)
409
+
410
+ {{#IF SSE_ENABLED}}
411
+ **Enabled:** Yes
412
+
413
+ **Use Cases:**
414
+ {{#EACH SSE_USE_CASE}}
415
+
416
+ - {{USE_CASE_DESCRIPTION}}
417
+ {{/EACH}}
418
+
419
+ **Implementation:**
420
+
421
+ ```{{LANGUAGE}}
422
+ {{SSE_EXAMPLE}}
423
+ ```
424
+
425
+ {{ELSE}}
426
+ **Enabled:** No
427
+ {{/IF}}
428
+
429
+ {{ELSE}}
430
+ **Real-time Communication:** Not implemented
431
+ {{/IF}}
432
+
433
+ ---
434
+
435
+ ## ๏ฟฝ File Storage
436
+
437
+ {{#IF FILE_STORAGE_ENABLED}}
438
+ **Storage Type:** {{FILE_STORAGE_TYPE}}
439
+
440
+ **Provider:** {{FILE_STORAGE_PROVIDER}}
441
+
442
+ **Configuration:**
443
+
444
+ - Bucket/Container: {{FILE_STORAGE_BUCKET}}
445
+ - Region: {{FILE_STORAGE_REGION}}
446
+ - CDN: {{FILE_CDN_ENABLED}}
447
+
448
+ **Allowed File Types:**
449
+ {{#EACH ALLOWED_FILE_TYPE}}
450
+
451
+ - {{FILE_TYPE}} (max: {{MAX_SIZE}})
452
+ {{/EACH}}
453
+
454
+ **Max File Size:** {{MAX_FILE_SIZE}} MB
455
+
456
+ **Upload Process:**
457
+
458
+ 1. Client requests presigned URL / upload endpoint
459
+ 2. File uploaded to {{FILE_STORAGE_PROVIDER}}
460
+ 3. Metadata stored in database
461
+ 4. {{#IF FILE_CDN_ENABLED}}CDN URL returned{{ELSE}}Direct URL returned{{/IF}}
462
+
463
+ **Security:**
464
+
465
+ - Presigned URLs: {{PRESIGNED_URL_EXPIRY}} expiry
466
+ - Access control: {{FILE_ACCESS_CONTROL}}
467
+ - Virus scanning: {{VIRUS_SCANNING_ENABLED}}
468
+
469
+ {{ELSE}}
470
+ **File Storage:** Not implemented
471
+ {{/IF}}
472
+
473
+ ---
474
+
475
+ ## ๏ฟฝ๐Ÿ“จ Message Broker Patterns
476
+
477
+ {{#IF MESSAGE_BROKER}}
478
+ **Broker:** {{MESSAGE_BROKER_NAME}}
479
+
480
+ **Patterns Used:**
481
+ {{#EACH MESSAGE_PATTERN}}
482
+
483
+ ### {{PATTERN_NAME}}
484
+
485
+ **Type:** {{PATTERN_TYPE}} ({{#IF PUB_SUB}}Pub/Sub{{ELSE}}Queue{{/IF}})
486
+
487
+ **Use Case:** {{PATTERN_USE_CASE}}
488
+
489
+ **Topics/Queues:**
490
+ {{#EACH TOPIC_QUEUE}}
491
+
492
+ - **{{NAME}}**: {{DESCRIPTION}}
493
+ - Producers: {{PRODUCERS}}
494
+ - Consumers: {{CONSUMERS}}
495
+ - Retention: {{RETENTION}}
496
+ {{/EACH}}
497
+
498
+ **Delivery Guarantees:** {{DELIVERY_GUARANTEES}} ({{#IF AT_LEAST_ONCE}}At-least-once{{ELSE}}{{#IF EXACTLY_ONCE}}Exactly-once{{ELSE}}At-most-once{{/IF}}{{/IF}})
499
+
500
+ **Implementation:**
501
+
502
+ ```{{LANGUAGE}}
503
+ {{PATTERN_EXAMPLE}}
504
+ ```
505
+
506
+ {{/EACH}}
507
+
508
+ **Error Handling:**
509
+
510
+ - Dead letter queue: {{#IF DLQ_ENABLED}}Enabled{{ELSE}}Disabled{{/IF}}
511
+ - Retry strategy: {{RETRY_STRATEGY}}
512
+ - Max retries: {{MAX_RETRIES}}
513
+
514
+ {{ELSE}}
515
+ **Message Broker:** Not used
516
+ {{/IF}}
517
+
518
+ ---
519
+
520
+ ## ๐Ÿ•ธ๏ธ Service Mesh
521
+
522
+ {{#IF SERVICE_MESH}}
523
+ **Mesh:** {{SERVICE_MESH_NAME}}
524
+
525
+ **Purpose:** {{SERVICE_MESH_PURPOSE}}
526
+
527
+ **Features:**
528
+
529
+ - Service discovery: {{SERVICE_DISCOVERY}}
530
+ - Load balancing: {{MESH_LOAD_BALANCING}}
531
+ - Traffic management: {{TRAFFIC_MANAGEMENT}}
532
+ - Security: {{MESH_SECURITY}} (mTLS)
533
+ - Observability: {{MESH_OBSERVABILITY}}
534
+
535
+ **Configuration:**
536
+
537
+ ```yaml
538
+ { { SERVICE_MESH_CONFIG_EXAMPLE } }
539
+ ```
540
+
541
+ {{ELSE}}
542
+ **Service Mesh:** Not used (monolith or simple microservices)
543
+ {{/IF}}
544
+
545
+ ---
546
+
547
+ ## ๐Ÿ” Security Architecture
548
+
549
+ ### Authentication Flow
550
+
551
+ ```
552
+ {{AUTH_FLOW_DIAGRAM}}
553
+ ```
554
+
555
+ ### Authorization Model
556
+
557
+ **Type:** {{AUTHORIZATION_MODEL}}
558
+
559
+ ## **Implementation:** See `specs/security.md` for details.
560
+
561
+ ## ๐Ÿ’พ Data Flow
562
+
563
+ ### Create Operation
564
+
565
+ ```
566
+ {{CREATE_FLOW_DIAGRAM}}
567
+ ```
568
+
569
+ ### Read Operation
570
+
571
+ ```
572
+ {{READ_FLOW_DIAGRAM}}
573
+ ```
574
+
575
+ ### Update Operation
576
+
577
+ ```
578
+ {{UPDATE_FLOW_DIAGRAM}}
579
+ ```
580
+
581
+ ### Delete Operation
582
+
583
+ ```
584
+ {{DELETE_FLOW_DIAGRAM}}
585
+ ```
586
+
587
+ ---
588
+
589
+ ## โšก Performance Considerations
590
+
591
+ ### Caching Strategy
592
+
593
+ {{#IF CACHING_ENABLED}}
594
+ **Cache Type:** {{CACHE_TYPE}}
595
+
596
+ **What We Cache:**
597
+ {{#EACH CACHED_ITEM}}
598
+
599
+ - {{ITEM_DESCRIPTION}} (TTL: {{TTL}})
600
+ {{/EACH}}
601
+
602
+ **Invalidation:**
603
+ {{CACHE_INVALIDATION_STRATEGY}}
604
+
605
+ {{ELSE}}
606
+ No caching implemented yet.
607
+ {{/IF}}
608
+
609
+ ### Database Optimization
610
+
611
+ {{#EACH DB_OPTIMIZATION}}
612
+
613
+ - {{OPTIMIZATION_DESCRIPTION}}
614
+ {{/EACH}}
615
+
616
+ ---
617
+
618
+ ## ๐Ÿ”ง Configuration Management
619
+
620
+ **Strategy:** {{CONFIG_STRATEGY}}
621
+
622
+ **Configuration Loaded From:**
623
+ {{#EACH CONFIG_SOURCE}}
624
+
625
+ - {{CONFIG_SOURCE_DESCRIPTION}}
626
+ {{/EACH}}
627
+
628
+ **Per Environment:**
629
+
630
+ - Development: {{DEV_CONFIG}}
631
+ - Staging: {{STAGING_CONFIG}}
632
+ - Production: {{PROD_CONFIG}}
633
+
634
+ ---
635
+
636
+ ## ๐Ÿ“ Error Handling Architecture
637
+
638
+ ### Error Hierarchy
639
+
640
+ ```{{LANGUAGE}}
641
+ {{ERROR_HIERARCHY_EXAMPLE}}
642
+ ```
643
+
644
+ ### Error Flow
645
+
646
+ ```
647
+ {{ERROR_FLOW_DIAGRAM}}
648
+ ```
649
+
650
+ ---
651
+
652
+ ## ๐Ÿงช Testing Architecture
653
+
654
+ **Strategy:** See `docs/testing.md`
655
+
656
+ **Testability Features:**
657
+
658
+ - Dependency injection enables mocking
659
+ - Services isolated from framework
660
+ - Repository pattern abstracts database
661
+ - DTOs validate at boundaries
662
+
663
+ ---
664
+
665
+ ## ๐Ÿ“ˆ Scalability
666
+
667
+ ### Horizontal Scaling
668
+
669
+ {{HORIZONTAL_SCALING_STRATEGY}}
670
+
671
+ ### Vertical Scaling
672
+
673
+ {{VERTICAL_SCALING_STRATEGY}}
674
+
675
+ ### Bottlenecks
676
+
677
+ {{#EACH BOTTLENECK}}
678
+
679
+ - **{{BOTTLENECK_NAME}}**: {{MITIGATION_STRATEGY}}
680
+ {{/EACH}}
681
+
682
+ ---
683
+
684
+ ## ๐Ÿš€ Deployment Architecture
685
+
686
+ See `docs/operations.md` for full deployment details.
687
+
688
+ **Deployment Model:** {{DEPLOYMENT_MODEL}}
689
+
690
+ ## **Infrastructure:** {{INFRASTRUCTURE}}
691
+
692
+ ## ๐Ÿ“š Architecture Decision Records (ADRs)
693
+
694
+ {{#IF ADR_ENABLED}}
695
+ Location: `specs/adr/`
696
+
697
+ {{#EACH ADR}}
698
+
699
+ - [ADR-{{ADR_NUMBER}}: {{ADR_TITLE}}](../specs/adr/{{ADR_FILE}})
700
+ {{/EACH}}
701
+
702
+ {{ELSE}}
703
+ ADRs will be added as significant architectural decisions are made.
704
+ {{/IF}}
705
+
706
+ ---
707
+
708
+ ## ๐Ÿ”„ Future Considerations
709
+
710
+ {{#EACH FUTURE_CONSIDERATION}}
711
+
712
+ ### {{CONSIDERATION_TITLE}}
713
+
714
+ {{CONSIDERATION_DESCRIPTION}}
715
+
716
+ **When:** {{CONSIDERATION_TIMELINE}}
717
+
718
+ ## {{/EACH}}
719
+
720
+ **Document Version:** 1.0
721
+
722
+ **Last Updated:** {{GENERATION_DATE}}
723
+
724
+ **Generated by:** AI Flow v1.0.0