ai-flow-dev 1.0.1

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 (99) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +408 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +791 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/fs-utils.d.ts +2 -0
  8. package/dist/fs-utils.d.ts.map +1 -0
  9. package/dist/fs-utils.js +46 -0
  10. package/dist/fs-utils.js.map +1 -0
  11. package/package.json +71 -0
  12. package/prompts/backend/flow-dev-feature.md +1318 -0
  13. package/prompts/backend/flow-dev-fix.md +903 -0
  14. package/prompts/backend/flow-dev-refactor.md +715 -0
  15. package/prompts/backend/flow-dev-review.md +401 -0
  16. package/prompts/backend/flow-dev-work.md +1129 -0
  17. package/prompts/backend/flow-docs-gen-phase-0.md +1840 -0
  18. package/prompts/backend/flow-docs-gen-phase-1.md +435 -0
  19. package/prompts/backend/flow-docs-gen-phase-2.md +460 -0
  20. package/prompts/backend/flow-docs-gen-phase-3.md +684 -0
  21. package/prompts/backend/flow-docs-gen-phase-4.md +516 -0
  22. package/prompts/backend/flow-docs-gen-phase-5.md +637 -0
  23. package/prompts/backend/flow-docs-gen-phase-6.md +465 -0
  24. package/prompts/backend/flow-docs-gen-phase-7.md +1207 -0
  25. package/prompts/backend/flow-docs-gen.md +820 -0
  26. package/prompts/backend/flow-docs-sync.md +526 -0
  27. package/prompts/backend/flow-project-init.md +248 -0
  28. package/prompts/backend/flow-project-roadmap.md +1159 -0
  29. package/prompts/frontend/flow-docs-gen-phase-0.md +494 -0
  30. package/prompts/frontend/flow-docs-gen-phase-1.md +449 -0
  31. package/prompts/frontend/flow-docs-gen-phase-2.md +983 -0
  32. package/prompts/frontend/flow-docs-gen-phase-3.md +685 -0
  33. package/prompts/frontend/flow-docs-gen-phase-4.md +480 -0
  34. package/prompts/frontend/flow-docs-gen-phase-5.md +483 -0
  35. package/prompts/frontend/flow-docs-gen-phase-6.md +570 -0
  36. package/prompts/frontend/flow-docs-gen-phase-7.md +582 -0
  37. package/prompts/frontend/flow-docs-gen.md +413 -0
  38. package/prompts/frontend/flow-docs-sync.md +561 -0
  39. package/prompts/mobile/flow-docs-gen-phase-0.md +387 -0
  40. package/prompts/mobile/flow-docs-gen-phase-1.md +530 -0
  41. package/prompts/mobile/flow-docs-gen-phase-2.md +584 -0
  42. package/prompts/mobile/flow-docs-gen-phase-3.md +659 -0
  43. package/prompts/mobile/flow-docs-gen-phase-4.md +363 -0
  44. package/prompts/mobile/flow-docs-gen-phase-5.md +369 -0
  45. package/prompts/mobile/flow-docs-gen-phase-6.md +490 -0
  46. package/prompts/mobile/flow-docs-gen-phase-7.md +407 -0
  47. package/prompts/mobile/flow-docs-gen.md +430 -0
  48. package/prompts/mobile/flow-docs-sync.md +634 -0
  49. package/templates/backend/.clauderules.template +111 -0
  50. package/templates/backend/.cursorrules.template +102 -0
  51. package/templates/backend/.env.example.template +122 -0
  52. package/templates/backend/README.template.md +200 -0
  53. package/templates/backend/ai-instructions.template.md +354 -0
  54. package/templates/backend/copilot-instructions.template.md +160 -0
  55. package/templates/backend/docs/api.template.md +251 -0
  56. package/templates/backend/docs/architecture.template.md +612 -0
  57. package/templates/backend/docs/business-flows.template.md +109 -0
  58. package/templates/backend/docs/code-standards.template.md +828 -0
  59. package/templates/backend/docs/contributing.template.md +163 -0
  60. package/templates/backend/docs/data-model.template.md +416 -0
  61. package/templates/backend/docs/operations.template.md +591 -0
  62. package/templates/backend/docs/testing.template.md +762 -0
  63. package/templates/backend/project-brief.template.md +176 -0
  64. package/templates/backend/specs/configuration.template.md +133 -0
  65. package/templates/backend/specs/security.template.md +422 -0
  66. package/templates/frontend/README.template.md +121 -0
  67. package/templates/frontend/ai-instructions.template.md +368 -0
  68. package/templates/frontend/docs/api-integration.template.md +390 -0
  69. package/templates/frontend/docs/components.template.md +567 -0
  70. package/templates/frontend/docs/error-handling.template.md +385 -0
  71. package/templates/frontend/docs/operations.template.md +123 -0
  72. package/templates/frontend/docs/performance.template.md +140 -0
  73. package/templates/frontend/docs/pwa.template.md +135 -0
  74. package/templates/frontend/docs/state-management.template.md +394 -0
  75. package/templates/frontend/docs/styling.template.md +779 -0
  76. package/templates/frontend/docs/testing.template.md +736 -0
  77. package/templates/frontend/project-brief.template.md +55 -0
  78. package/templates/frontend/specs/accessibility.template.md +111 -0
  79. package/templates/frontend/specs/configuration.template.md +520 -0
  80. package/templates/frontend/specs/security.template.md +197 -0
  81. package/templates/fullstack/README.template.md +282 -0
  82. package/templates/fullstack/ai-instructions.template.md +487 -0
  83. package/templates/fullstack/project-brief.template.md +197 -0
  84. package/templates/fullstack/specs/configuration.template.md +380 -0
  85. package/templates/mobile/AGENT.template.md +251 -0
  86. package/templates/mobile/README.template.md +195 -0
  87. package/templates/mobile/ai-instructions.template.md +221 -0
  88. package/templates/mobile/docs/app-store.template.md +163 -0
  89. package/templates/mobile/docs/architecture.template.md +100 -0
  90. package/templates/mobile/docs/native-features.template.md +137 -0
  91. package/templates/mobile/docs/navigation.template.md +81 -0
  92. package/templates/mobile/docs/offline-strategy.template.md +90 -0
  93. package/templates/mobile/docs/permissions.template.md +70 -0
  94. package/templates/mobile/docs/state-management.template.md +116 -0
  95. package/templates/mobile/docs/testing.template.md +146 -0
  96. package/templates/mobile/project-brief.template.md +97 -0
  97. package/templates/mobile/specs/build-configuration.template.md +116 -0
  98. package/templates/mobile/specs/deployment.template.md +114 -0
  99. package/templates/shared/AGENT.template.md +252 -0
@@ -0,0 +1,684 @@
1
+ ## PHASE 3: System Architecture (15-20 min)
2
+
3
+ > **Order for this phase:** 3.1 β†’ 3.2 β†’ 3.3 β†’ 3.4 β†’ 3.5 β†’ 3.6 β†’ 3.7 β†’ 3.8 β†’ 3.9 β†’ 3.10 β†’ 3.11 β†’ 3.12
4
+
5
+ > **πŸ“Œ Scope-based behavior:**
6
+ >
7
+ > - **MVP:** Ask 3.1-3.6 (tech stack essentials) and 3.12 (API structure), skip 3.7-3.11 (advanced features), mark as "TBD"
8
+ > - **Production-Ready:** Ask all questions 3.1-3.12
9
+ > - **Enterprise:** Ask all questions 3.1-3.12 with emphasis on scalability and integrations
10
+
11
+ > **πŸ“Œ Note:** If Phase 0 detected framework/language/dependencies, those will be pre-filled. Review and confirm.
12
+
13
+ ### Objective
14
+
15
+ Define the technical stack, architecture patterns, and system design.
16
+
17
+ > **Note:** At the end of this phase, the AI will automatically generate a system architecture diagram in mermaid format, based on your answers. This diagram will be included in the docs/architecture.md document.
18
+
19
+ ---
20
+
21
+ #### 🎨 MERMAID ARCHITECTURE DIAGRAM FORMAT - CRITICAL
22
+
23
+ **Use this exact format** for system architecture diagrams:
24
+
25
+ ````markdown
26
+ ```mermaid
27
+ graph TD
28
+ Client[Client Application<br/>React/Mobile/Web]
29
+ LB[Load Balancer<br/>Nginx/ALB]
30
+ API[API Gateway<br/>Node.js/Express]
31
+ Auth[Auth Service<br/>JWT/OAuth]
32
+ Business[Business Logic Layer]
33
+ DB[(Primary Database<br/>PostgreSQL)]
34
+ Cache[(Redis Cache<br/>Session & Data)]
35
+ Queue[Message Queue<br/>RabbitMQ/SQS]
36
+ Storage[File Storage<br/>S3/MinIO]
37
+ Email[Email Service<br/>SendGrid/SES]
38
+ Monitor[Monitoring<br/>Prometheus/DataDog]
39
+
40
+ Client -->|HTTPS| LB
41
+ LB -->|Forward| API
42
+ API -->|Verify Token| Auth
43
+ API -->|Business Rules| Business
44
+ Business -->|Query/Write| DB
45
+ Business -->|Cache Check| Cache
46
+ Business -->|Async Tasks| Queue
47
+ Business -->|Upload/Download| Storage
48
+ Queue -->|Send Email| Email
49
+ API -->|Metrics| Monitor
50
+ Business -->|Logs| Monitor
51
+
52
+ style Client fill:#e1f5ff
53
+ style API fill:#fff4e1
54
+ style Auth fill:#ffe1e1
55
+ style DB fill:#e1ffe1
56
+ style Cache fill:#f0e1ff
57
+ style Queue fill:#ffe1f5
58
+ ```
59
+ ````
60
+
61
+ **Diagram Types:**
62
+
63
+ - `graph TD` = Top-Down flow (recommended for most architectures)
64
+ - `graph LR` = Left-Right flow (good for linear pipelines)
65
+ - `graph BT` = Bottom-Top (less common)
66
+ - `graph RL` = Right-Left (less common)
67
+
68
+ **Node Shapes:**
69
+
70
+ - `[Square Brackets]` = Services, applications, components
71
+ - `[(Cylinder)]` = Databases, persistent storage
72
+ - `([Rounded])` = Start/End points
73
+ - `{Diamond}` = Decision points
74
+ - `[[Double Square]]` = Subroutines
75
+ - `[/Parallelogram/]` = Input/Output
76
+
77
+ **Styling:**
78
+
79
+ - Use `<br/>` for line breaks in node labels
80
+ - Apply styles with: `style NodeName fill:#colorcode`
81
+ - Label connections: `A -->|Label Text| B`
82
+ - Use consistent colors for component types
83
+
84
+ **Common Architecture Patterns:**
85
+
86
+ ```mermaid
87
+ graph TD
88
+ subgraph "Client Layer"
89
+ Web[Web App]
90
+ Mobile[Mobile App]
91
+ end
92
+
93
+ subgraph "API Layer"
94
+ Gateway[API Gateway]
95
+ Auth[Auth Service]
96
+ end
97
+
98
+ subgraph "Business Layer"
99
+ Service1[User Service]
100
+ Service2[Order Service]
101
+ Service3[Payment Service]
102
+ end
103
+
104
+ subgraph "Data Layer"
105
+ DB[(PostgreSQL)]
106
+ Cache[(Redis)]
107
+ end
108
+
109
+ Web --> Gateway
110
+ Mobile --> Gateway
111
+ Gateway --> Auth
112
+ Gateway --> Service1
113
+ Gateway --> Service2
114
+ Service2 --> Service3
115
+ Service1 --> DB
116
+ Service2 --> DB
117
+ Service3 --> DB
118
+ Service1 --> Cache
119
+ Service2 --> Cache
120
+ ```
121
+
122
+ **Best Practices:**
123
+
124
+ - Group related components using `subgraph`
125
+ - Show external services (Email, SMS, Payment gateways)
126
+ - Include monitoring and logging components
127
+ - Label protocols on connections (HTTPS, gRPC, WebSocket)
128
+ - Use consistent naming conventions
129
+
130
+ **Validation:** Preview at https://mermaid.live/ before committing
131
+
132
+ ---
133
+
134
+ **3.1 Backend Framework**
135
+
136
+ ```
137
+ [If detected from Phase 0, show:]
138
+ βœ… Framework Detected: [NestJS/FastAPI/Spring Boot/etc.]
139
+ βœ… Language: [TypeScript 5.3/Python 3.11/Java 21/etc.]
140
+ βœ… Runtime: [Node 20/Python 3.11/JVM 21/etc.]
141
+
142
+ Is this correct? (Y/N)
143
+ If no, please specify the correct framework and language.
144
+
145
+ [If NOT detected, ask:]
146
+ Which backend framework will you use?
147
+
148
+ Node.js (JavaScript):
149
+ A) πŸ”₯ Express.js - Popular (minimal, flexible, lightweight)
150
+ B) Hapi.js - Enterprise (configuration-driven)
151
+
152
+ TypeScript (Node.js):
153
+ C) ⭐ NestJS - Recommended (structured, enterprise-ready, decorators)
154
+ D) ⚑ Fastify - Modern (high performance, schema validation)
155
+
156
+ Python:
157
+ E) ⭐ FastAPI - Recommended (modern, fast, auto-docs)
158
+ F) πŸ”₯ Django - Popular (batteries included, admin panel)
159
+ G) Flask - Minimal (micro-framework, flexible)
160
+
161
+ Java:
162
+ H) πŸ† Spring Boot - Enterprise standard
163
+ I) Quarkus - Modern (cloud-native, fast startup)
164
+
165
+ Go:
166
+ J) ⚑ Gin - Popular (fast, minimalist)
167
+ K) Echo - Feature-rich (middleware, routing)
168
+ L) Fiber - Express-like (high performance)
169
+
170
+ Rust:
171
+ M) ⚑ Actix-web - High performance (async, type-safe)
172
+ N) Rocket - Developer-friendly (macros, type-safe)
173
+ O) Axum - Modern (tokio-based, ergonomic)
174
+
175
+ Kotlin:
176
+ P) Ktor - Native Kotlin (coroutines, DSL)
177
+ Q) Spring Boot - Java interop (Kotlin support)
178
+
179
+ Other:
180
+ R) Ruby (Rails)
181
+ S) PHP (Laravel)
182
+ T) C# (.NET Core)
183
+
184
+ Your choice: __
185
+ Why?
186
+ ```
187
+
188
+ **3.2 Language & Version**
189
+
190
+ ```
191
+ Primary programming language and version:
192
+
193
+ Language: **
194
+ Version: ** (e.g., Node 20, Python 3.11, Java 21)
195
+
196
+ Type system:
197
+ A) ⭐ Strongly typed - TypeScript, Java, Go (Recommended for large projects)
198
+ B) Dynamically typed - JavaScript, Python, Ruby
199
+ C) Gradually typed - Python with type hints
200
+
201
+ Package Manager:
202
+ A) ⭐ npm - Standard, comes with Node
203
+ B) πŸ”₯ pnpm - Fast, disk efficient
204
+ C) ⚑ yarn - Popular alternative
205
+ D) πŸš€ bun - Ultra fast (if using Bun runtime)
206
+ E) 🐍 pip/poetry (Python)
207
+ F) β˜• Maven/Gradle (Java)
208
+ ```
209
+
210
+ **3.3 Architecture Pattern**
211
+
212
+ ```
213
+ What architecture pattern will you follow?
214
+
215
+ A) ⭐ Layered Architecture (Recommended for most projects)
216
+ - Presentation β†’ Business Logic β†’ Data Access
217
+ - Easy to understand and maintain
218
+
219
+ B) πŸ† Hexagonal/Clean Architecture (Enterprise)
220
+ - Core domain isolated from infrastructure
221
+ - Highly testable and flexible
222
+
223
+ C) πŸ”₯ MVC (Popular, traditional)
224
+ - Model-View-Controller separation
225
+ - Good for traditional web apps
226
+
227
+ D) πŸ“¦ Modular Monolith (Modern, scalable)
228
+ - Single deployment with independent modules
229
+ - Easier than microservices, more structured than monolith
230
+ - Good middle ground for growing applications
231
+
232
+ E) ⚑ Microservices (Modern, complex)
233
+ - Multiple independent services
234
+ - Best for large-scale distributed systems
235
+
236
+ F) Other: __
237
+
238
+ Your choice: __
239
+ Why this pattern?
240
+ ```
241
+
242
+ **3.4 API Style**
243
+
244
+ ```
245
+ What API style will you expose?
246
+
247
+ A) ⭐ REST API - Recommended (HTTP/JSON, standard, well-understood)
248
+ B) πŸ”₯ GraphQL - Popular (flexible queries, single endpoint)
249
+ C) ⚑ gRPC - Modern (high performance, protobuf, microservices)
250
+ D) Mixed - REST + GraphQL or REST + gRPC
251
+
252
+ Your choice: __
253
+
254
+ API versioning strategy:
255
+ A) URL versioning (/v1/users, /v2/users)
256
+ B) Header versioning (Accept: application/vnd.api.v1+json)
257
+ C) No versioning yet (will add when needed)
258
+ ```
259
+
260
+ **3.5 API Reference (Automated)**
261
+
262
+ ````
263
+ The AI will automatically generate standard CRUD endpoints for each entity defined in Phase 2.
264
+
265
+ Please answer the following questions to define the global API conventions (these will apply to all endpoints unless otherwise specified):
266
+
267
+ **A) Authentication and Access Control**
268
+ 1. Do all CRUD endpoints require authentication?
269
+ A) ⭐ Yes, all endpoints require authentication (recommended)
270
+ B) Only some (specify which ones)
271
+ C) No authentication required
272
+
273
+ 2. Which roles can access each CRUD operation?
274
+ - GET (list): [admin, manager, user]
275
+ - GET (detail): [admin, manager, user]
276
+ - POST (create): [admin, manager, user]
277
+ - PUT (update): [admin, manager]
278
+ - DELETE (delete): [admin]
279
+ (Standard example: admin, manager, user. Adjust as needed.)
280
+
281
+ **B) Listing and Filter Conventions**
282
+ 3. Which pagination scheme do you prefer?
283
+ A) ⭐ offset/limit (recommended)
284
+ B) cursor-based
285
+ C) No pagination
286
+
287
+ 4. Which filter and sorting fields will be supported by default?
288
+ - Filters: [id, name, date, etc.]
289
+ - Sorting: [field, asc/desc]
290
+
291
+ 5. How will filters be passed for GET list endpoints?
292
+ A) ⭐ Query parameters (recommended for simple filters)
293
+ Example: GET /users?name=John&status=active&page=1&limit=10
294
+
295
+ B) POST /search endpoint with body (for complex filters)
296
+ Example: POST /users/search
297
+ Body: { "filters": { "name": "John", "status": "active" }, "page": 1, "limit": 10 }
298
+
299
+ C) Both (query params for simple, POST /search for complex)
300
+
301
+ 6. For POST/PUT/PATCH endpoints, will you use DTOs for request validation?
302
+ A) ⭐ Yes, strict DTOs with validation (recommended)
303
+ B) Accept raw JSON without strict schema
304
+
305
+ If yes, validation library: [from Phase 3.6 - class-validator, Zod, Pydantic, Joi]
306
+
307
+ **C) Error and Response Structure**
308
+ 7. What error response format will be used?
309
+ A) Standard JSON:
310
+ ```json
311
+ {
312
+ "error": "Descriptive message",
313
+ "code": 400,
314
+ "details": {}
315
+ }
316
+ ```
317
+
318
+ B) Other (specify)
319
+
320
+ 8. Which fields will be included in the default successful response?
321
+ - data, meta (pagination), links, etc.
322
+
323
+ **D) Relationships and Expansions**
324
+ 9. Allow expanding relationships (include/expand)?
325
+ A) ⭐ Yes, support `include` parameter (recommended)
326
+ B) No, flat data only
327
+
328
+ **E) Custom Endpoint Example**
329
+ 10. If you want to customize an endpoint (e.g., add special logic, validations, or unique parameters), describe the case here:
330
+
331
+ - [Brief description, example endpoint, parameters, special logic]
332
+
333
+ ---
334
+
335
+ The AI will use these conventions to automatically document all CRUD endpoints for each entity in api.md. If you need additional or custom endpoints, you can add them manually later.
336
+ ````
337
+
338
+ **3.6 Key Dependencies**
339
+
340
+ ```
341
+ What major libraries/tools will you use?
342
+
343
+ ORM/Database:
344
+ A) TypeORM (Node.js)
345
+ B) Prisma (Node.js) ⭐
346
+ C) Sequelize (Node.js)
347
+ D) SQLAlchemy (Python)
348
+ E) Hibernate (Java)
349
+ F) Other: __
350
+
351
+ Validation:
352
+ A) class-validator + class-transformer (NestJS) ⭐
353
+ B) Joi (Node.js)
354
+ C) Zod (TypeScript)
355
+ D) Pydantic (Python) ⭐
356
+ E) Yup (JavaScript)
357
+
358
+ Authentication:
359
+ A) Passport.js (Node.js) πŸ”₯
360
+ B) JWT libraries
361
+ C) Auth0/Clerk/Supabase Auth (External service)
362
+ D) Framework built-in
363
+
364
+ Other critical libraries:
365
+ -
366
+ ```
367
+
368
+ **3.7 Caching Strategy**
369
+
370
+ ```
371
+ Will you use caching?
372
+
373
+ A) ⭐ Redis - Recommended (in-memory, fast, pub/sub)
374
+ B) Memcached - Simple key-value cache
375
+ C) Application-level - In-process caching (node-cache, etc.)
376
+ D) Database query cache
377
+ E) No caching (simple projects)
378
+
379
+ If using cache:
380
+ - What will be cached? (sessions, query results, computed data)
381
+ - Cache invalidation strategy? (TTL, manual, event-driven)
382
+ ```
383
+
384
+ **3.8 Background Jobs**
385
+
386
+ ```
387
+ Do you need background/async jobs?
388
+
389
+ A) ⭐ Yes - Using queue system (Bull, BullMQ, Celery, Sidekiq)
390
+ B) Yes - Using cron jobs
391
+ C) Yes - Using serverless functions (Lambda, Cloud Functions)
392
+ D) No - All operations are synchronous
393
+
394
+ If yes, common job types:
395
+ - Email sending
396
+ - Report generation
397
+ - Data processing
398
+ - External API calls
399
+ - Cleanup tasks
400
+ - Other: __
401
+ ```
402
+
403
+ **3.9 File Storage**
404
+
405
+ ```
406
+ How will you handle file uploads?
407
+
408
+ A) ⭐ Cloud storage - S3, Google Cloud Storage, Azure Blob ⭐
409
+ B) Local filesystem - Storing on server disk
410
+ C) Database - Storing binary data in DB (not recommended for large files)
411
+ D) CDN - Cloudflare, CloudFront, etc.
412
+ E) Not needed
413
+
414
+ If storing files:
415
+ - File types: [images, PDFs, videos, documents, etc.]
416
+ - Max file size: __ MB
417
+ - Storage quota estimate: __ GB
418
+ ```
419
+
420
+ **3.10 API Gateway**
421
+
422
+ ```
423
+ Will you use an API Gateway?
424
+
425
+ A) ⭐ Yes - Using API Gateway (Kong, AWS API Gateway, Azure API Management, etc.)
426
+ B) No - Direct API access
427
+
428
+ If yes:
429
+ - Gateway: __
430
+ - Purpose: [Rate limiting, Authentication, Request routing, Load balancing, etc.]
431
+ - Routes: __
432
+ ```
433
+
434
+ **3.11 Real-time Communication**
435
+
436
+ ```
437
+ Do you need real-time communication?
438
+
439
+ A) ⭐ WebSockets - Bidirectional communication (chat, notifications, live updates)
440
+ B) Server-Sent Events (SSE) - Server-to-client streaming (live feeds, updates)
441
+ C) Both - Different use cases
442
+ D) No - Standard HTTP requests only
443
+
444
+ If WebSockets or SSE:
445
+ - Use cases: __
446
+ - Library: __
447
+ - Authentication: __
448
+ ```
449
+
450
+ **3.12 Message Broker Details** (if using background jobs from 3.8)
451
+
452
+ ```
453
+ What message broker will you use?
454
+
455
+ A) ⭐ RabbitMQ - Popular, reliable, feature-rich
456
+ B) πŸ”₯ Apache Kafka - High throughput, event streaming
457
+ C) ⚑ AWS SQS - Managed, serverless
458
+ D) Google Pub/Sub - Managed, scalable
459
+ E) Redis Streams - Simple, fast
460
+ F) Other: __
461
+
462
+ Message patterns:
463
+ A) ⭐ Queue - Point-to-point messaging
464
+ B) Pub/Sub - Publish-subscribe pattern
465
+ C) Both - Different use cases
466
+
467
+ Delivery guarantees:
468
+ A) ⭐ At-least-once - Messages delivered at least once (may have duplicates)
469
+ B) Exactly-once - Messages delivered exactly once (more complex)
470
+ C) At-most-once - Messages may be lost (rarely used)
471
+
472
+ Dead letter queue:
473
+ A) ⭐ Yes - Handle failed messages
474
+ B) No
475
+ ```
476
+
477
+ **3.13 API Documentation**
478
+
479
+ ```
480
+ How will you document your API?
481
+
482
+ A) ⭐ Swagger/OpenAPI - Auto-generated from code (code-first)
483
+ - Tool: [@nestjs/swagger, FastAPI docs, Swagger UI, etc.]
484
+ - Endpoint: /api-docs or /swagger
485
+
486
+ B) πŸ“ OpenAPI Spec - Write spec first, generate code (design-first)
487
+ - File: openapi.yaml
488
+ - Tool: [OpenAPI Generator, etc.]
489
+
490
+ C) Manual - Markdown documentation
491
+ - Not recommended (hard to keep in sync)
492
+
493
+ Your choice: __
494
+ ```
495
+
496
+ **3.14 Service Mesh** (if microservices architecture)
497
+
498
+ ```
499
+ Will you use a Service Mesh?
500
+
501
+ A) ⭐ Yes - Using Service Mesh (Istio, Linkerd, Consul Connect)
502
+ B) No - Not needed (monolith or simple microservices)
503
+
504
+ If yes:
505
+ - Mesh: __
506
+ - Features: [Service discovery, Load balancing, mTLS, Observability]
507
+ ```
508
+
509
+ **3.15 External Integrations**
510
+
511
+ ```
512
+ Will you integrate with external services?
513
+
514
+ Select all that apply:
515
+
516
+ πŸ’³ Payment Providers:
517
+ β–‘ Stripe - Credit cards, subscriptions ⭐
518
+ β–‘ PayPal - Popular payment method
519
+ β–‘ Square - POS and online payments
520
+ β–‘ Mercado Pago - Latin America
521
+ β–‘ Other: __
522
+
523
+ πŸ“§ Email Services:
524
+ β–‘ AWS SES - Cost-effective, scalable ⭐
525
+ β–‘ SendGrid - Feature-rich, analytics
526
+ β–‘ Mailgun - Developer-friendly
527
+ β–‘ Postmark - Transactional focus
528
+ β–‘ Resend - Modern, simple API ⚑
529
+ β–‘ Other: __
530
+
531
+ πŸ“± SMS/Messaging:
532
+ β–‘ Twilio - SMS, WhatsApp, voice ⭐
533
+ β–‘ AWS SNS - Simple notifications
534
+ β–‘ MessageBird - Multi-channel
535
+ β–‘ Other: __
536
+
537
+ ☁️ Cloud Storage:
538
+ β–‘ AWS S3 - Object storage standard ⭐
539
+ β–‘ Google Cloud Storage
540
+ β–‘ Azure Blob Storage
541
+ β–‘ Cloudflare R2 - S3-compatible, no egress fees ⚑
542
+ β–‘ Other: __
543
+
544
+ πŸ“Š Analytics:
545
+ β–‘ Google Analytics - Web analytics
546
+ β–‘ Mixpanel - Product analytics ⭐
547
+ β–‘ Segment - Data pipeline
548
+ β–‘ PostHog - Open-source analytics ⚑
549
+ β–‘ Amplitude - Behavioral analytics
550
+ β–‘ Other: __
551
+
552
+ πŸ” Monitoring/Error Tracking:
553
+ β–‘ Sentry - Error tracking ⭐
554
+ β–‘ Datadog - Full observability πŸ†
555
+ β–‘ New Relic - APM
556
+ β–‘ LogRocket - Session replay
557
+ β–‘ Other: __
558
+
559
+ πŸ—ΊοΈ Maps/Location:
560
+ β–‘ Google Maps API
561
+ β–‘ Mapbox
562
+ β–‘ OpenStreetMap
563
+ β–‘ Other: __
564
+
565
+ πŸ” Authentication:
566
+ β–‘ Auth0 - Identity platform πŸ†
567
+ β–‘ Clerk - Modern auth ⚑
568
+ β–‘ Supabase Auth - Open-source
569
+ β–‘ Firebase Auth - Google ecosystem
570
+ β–‘ Other: __
571
+
572
+ πŸ€– AI/ML Services:
573
+ β–‘ OpenAI API - GPT models
574
+ β–‘ Anthropic Claude - AI assistant
575
+ β–‘ Google Gemini - Multimodal AI
576
+ β–‘ AWS Bedrock - Managed AI
577
+ β–‘ Other: __
578
+
579
+ πŸ“ž Communication:
580
+ β–‘ Slack - Team notifications
581
+ β–‘ Discord - Community integration
582
+ β–‘ Webhooks - Custom integrations
583
+ β–‘ Other: __
584
+
585
+ πŸ”„ Other Integrations:
586
+ β–‘ GitHub/GitLab API
587
+ β–‘ Calendar (Google/Outlook)
588
+ β–‘ CRM (Salesforce, HubSpot)
589
+ β–‘ Accounting (QuickBooks, Xero)
590
+ β–‘ Other: __
591
+
592
+ ---
593
+
594
+ For each selected, briefly describe the use case:
595
+
596
+ Example:
597
+ - Stripe: Process credit card payments for subscriptions
598
+ - AWS SES: Send transactional emails (order confirmations, password resets)
599
+ - Sentry: Track and alert on production errors
600
+ ```
601
+
602
+ ### Phase 3 Output
603
+
604
+ ```
605
+ πŸ“‹ PHASE 3 SUMMARY:
606
+
607
+ Framework: [name + version]
608
+ Language: [name + version]
609
+ Architecture: [pattern]
610
+ API Style: [REST/GraphQL/gRPC]
611
+ API Versioning: [strategy]
612
+ API Conventions: [auth, pagination, error format, expansions]
613
+ API Gateway: [yes/no + tool + purpose]
614
+ Real-time Communication: [WebSockets/SSE/none + use cases]
615
+ Message Broker: [tool + patterns + delivery guarantees]
616
+ API Documentation: [Swagger/OpenAPI/manual + strategy]
617
+ Service Mesh: [yes/no + tool if applicable]
618
+ Database: [from Phase 2]
619
+ ORM: [name]
620
+ Validation: [library]
621
+ Auth: [method]
622
+ Caching: [strategy]
623
+ Background Jobs: [yes/no + method]
624
+ File Storage: [strategy]
625
+ External Services: [list with use cases]
626
+
627
+ Is this correct? (Yes/No)
628
+ ```
629
+
630
+ ---
631
+
632
+ ### πŸ“„ Generate Phase 3 Documents
633
+
634
+ **Before starting generation:**
635
+
636
+ ```
637
+ πŸ“– Loading context from previous phases...
638
+ βœ… Re-reading project-brief.md
639
+ βœ… Re-reading docs/data-model.md
640
+ ```
641
+
642
+ Once confirmed, generate:
643
+
644
+ **1. `docs/architecture.md`**
645
+
646
+ - Use template: `.ai-flow/templates/docs/architecture.template.md`
647
+ - Fill with system architecture, patterns, tech stack
648
+ - Include architecture diagram (mermaid format)
649
+
650
+ **2. `ai-instructions.md`**
651
+
652
+ - Use template: `.ai-flow/templates/ai-instructions.template.md`
653
+ - Fill with tech stack, framework, language, key dependencies
654
+ - Include NEVER/ALWAYS rules specific to chosen stack
655
+ - Generate idiomatic code examples for Controller, Service, Repository, DTO and Module placeholders, strictly following the selected Architecture Pattern (e.g., if Hexagonal, show Ports & Adapters).
656
+
657
+ ```
658
+ βœ… Generated: docs/architecture.md
659
+ βœ… Generated: ai-instructions.md
660
+
661
+ πŸ“ Please review these documents. Do you need to make any corrections?
662
+
663
+ A) βœ… Look perfect, continue to Phase 4
664
+ B) πŸ“ I'll edit them now (I'll wait)
665
+ C) πŸ”„ Regenerate with changes (tell me what to modify)
666
+ ```
667
+
668
+ **If user selects B:**
669
+
670
+ ```
671
+ Perfect. Please edit the documents and type "ready" when you're done.
672
+ I'll re-read all files to update my context before continuing.
673
+ ```
674
+
675
+ Then execute: `read_file()` for both documents to refresh context.
676
+
677
+ ---
678
+
679
+ **Proceed to Phase 4 only after documents are validated.**
680
+
681
+ ---
682
+
683
+ ## PHASE 4: Security & Authentication (15-20 min)
684
+