ai-flow-dev 2.1.9 → 2.2.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 (77) hide show
  1. package/README.md +26 -29
  2. package/dist/cli.js +10 -4
  3. package/dist/cli.js.map +1 -1
  4. package/package.json +1 -1
  5. package/prompts/backend/flow-build-phase-0.md +278 -1738
  6. package/prompts/backend/flow-build-phase-1.md +19 -0
  7. package/prompts/backend/flow-build-phase-10.md +1 -0
  8. package/prompts/backend/flow-build-phase-2.md +19 -0
  9. package/prompts/backend/flow-build-phase-3.md +19 -0
  10. package/prompts/backend/flow-build-phase-4.md +19 -0
  11. package/prompts/backend/flow-build-phase-5.md +19 -0
  12. package/prompts/backend/flow-build-phase-6.md +19 -0
  13. package/prompts/backend/flow-build-phase-7.md +19 -0
  14. package/prompts/backend/flow-build-phase-8.md +6 -7
  15. package/prompts/backend/flow-build-phase-9.md +15 -0
  16. package/prompts/backend/flow-build.md +59 -836
  17. package/prompts/backend/flow-check-review.md +20 -0
  18. package/prompts/backend/flow-check-test.md +14 -0
  19. package/prompts/backend/flow-check.md +65 -0
  20. package/prompts/backend/flow-commit.md +51 -0
  21. package/prompts/backend/flow-docs-sync.md +53 -53
  22. package/prompts/backend/flow-work-feature.md +42 -0
  23. package/prompts/backend/flow-work-fix.md +33 -0
  24. package/prompts/backend/flow-work-refactor.md +32 -0
  25. package/prompts/backend/flow-work-resume.md +32 -0
  26. package/prompts/backend/flow-work.md +127 -0
  27. package/prompts/frontend/flow-build-phase-0.md +323 -426
  28. package/prompts/frontend/flow-build-phase-1.md +433 -404
  29. package/prompts/frontend/flow-build-phase-10.md +33 -0
  30. package/prompts/frontend/flow-build-phase-2.md +508 -872
  31. package/prompts/frontend/flow-build-phase-3.md +629 -562
  32. package/prompts/frontend/flow-build-phase-4.md +438 -382
  33. package/prompts/frontend/flow-build-phase-5.md +559 -362
  34. package/prompts/frontend/flow-build-phase-6.md +383 -452
  35. package/prompts/frontend/flow-build-phase-7.md +818 -392
  36. package/prompts/frontend/flow-build-phase-8.md +27 -16
  37. package/prompts/frontend/flow-build-phase-9.md +94 -0
  38. package/prompts/frontend/flow-build.md +68 -414
  39. package/prompts/frontend/flow-check-review.md +20 -0
  40. package/prompts/frontend/flow-check-test.md +14 -0
  41. package/prompts/frontend/flow-check.md +65 -0
  42. package/prompts/frontend/flow-commit.md +51 -0
  43. package/prompts/frontend/flow-docs-sync.md +36 -34
  44. package/prompts/frontend/flow-work-feature.md +42 -0
  45. package/prompts/frontend/flow-work-fix.md +33 -0
  46. package/prompts/frontend/flow-work-refactor.md +32 -0
  47. package/prompts/frontend/flow-work-resume.md +32 -0
  48. package/prompts/frontend/flow-work.md +127 -0
  49. package/prompts/mobile/flow-build-phase-0.md +335 -319
  50. package/prompts/mobile/flow-build-phase-1.md +438 -493
  51. package/prompts/mobile/flow-build-phase-10.md +32 -0
  52. package/prompts/mobile/flow-build-phase-2.md +458 -464
  53. package/prompts/mobile/flow-build-phase-3.md +613 -487
  54. package/prompts/mobile/flow-build-phase-4.md +439 -258
  55. package/prompts/mobile/flow-build-phase-5.md +582 -250
  56. package/prompts/mobile/flow-build-phase-6.md +389 -359
  57. package/prompts/mobile/flow-build-phase-7.md +871 -285
  58. package/prompts/mobile/flow-build-phase-8.md +27 -16
  59. package/prompts/mobile/flow-build-phase-9.md +90 -0
  60. package/prompts/mobile/flow-build.md +67 -426
  61. package/prompts/mobile/flow-check-review.md +20 -0
  62. package/prompts/mobile/flow-check-test.md +14 -0
  63. package/prompts/mobile/flow-check.md +65 -0
  64. package/prompts/mobile/flow-commit.md +51 -0
  65. package/prompts/mobile/flow-docs-sync.md +37 -40
  66. package/prompts/mobile/flow-work-feature.md +42 -0
  67. package/prompts/mobile/flow-work-fix.md +33 -0
  68. package/prompts/mobile/flow-work-refactor.md +32 -0
  69. package/prompts/mobile/flow-work-resume.md +32 -0
  70. package/prompts/mobile/flow-work.md +127 -0
  71. package/prompts/shared/smart-skip-preflight.md +214 -0
  72. package/prompts/backend/flow-dev-commit.md +0 -829
  73. package/prompts/backend/flow-dev-feature.md +0 -1948
  74. package/prompts/backend/flow-dev-fix.md +0 -952
  75. package/prompts/backend/flow-dev-refactor.md +0 -690
  76. package/prompts/backend/flow-dev-review.md +0 -372
  77. package/prompts/backend/flow-dev-work.md +0 -1081
@@ -1,415 +1,1001 @@
1
- # Phase 7: Store Deployment
1
+ ## PHASE 7: Operations & Deployment (10-15 min)
2
2
 
3
- **Duration:** 15-20 minutes
4
- **Questions:** ~12 questions
5
- **Output:** docs/app-store.md, specs/build-configuration.md, specs/deployment.md, parts of ai-instructions.md
6
- ---
7
- ## 🎯 Objective
3
+ > **Order for this phase:** 7.1 → 7.2 → 7.3 → 7.4 → 7.4.1 → 7.5 → 7.6 → 7.7 → 7.7.1 → 7.7.2 → 7.8 → 7.9 → 7.9.1 → 7.9.2 → 7.9.3 → 7.9.4 → 7.10
8
4
 
9
- Define your app store deployment strategy:
5
+ > **📌 Scope-based behavior:**
6
+ >
7
+ > - **MVP:** Ask 7.1-7.4 only (deployment basics), skip 7.5-7.10 (monitoring, scaling, backups), mark as "TBD"
8
+ > - **Production-Ready:** Ask 7.1-7.8, simplify 7.9-7.10 (advanced monitoring and resilience)
9
+ > - **Enterprise:** Ask all questions 7.1-7.10 with emphasis on reliability and disaster recovery
10
10
 
11
- 1. Which app stores will you publish to?
12
- 2. What CI/CD pipeline will you use?
13
- 3. How will you handle versioning?
14
- 4. What code signing strategy?
15
- 5. What beta testing approach?
16
- ---
17
- ## 📋 Questions
11
+ ### Objective
18
12
 
19
- ### Question 7.1: Target App Stores
13
+ Define deployment, monitoring, and operational practices.
20
14
 
21
- **Which app stores will you publish to?**
15
+ ---
22
16
 
23
- A) **Apple App Store (iOS)** (Required for iOS)
17
+ ## 🔍 Pre-Flight Check (Smart Skip Logic)
24
18
 
25
- - Requires: Apple Developer Account ($99/year)
26
- - Review process: 1-3 days typically
27
- - Best for: iOS apps
19
+ > 📎 **Reference:** See [prompts/shared/smart-skip-preflight.md](../shared/smart-skip-preflight.md) for the complete smart skip logic.
28
20
 
29
- B) ⭐ **Google Play Store (Android)** (Required for Android)
21
+ **Execute Pre-Flight Check for Phase 7:**
30
22
 
31
- - Requires: Google Play Developer Account ($25 one-time)
32
- - Review process: Usually instant, can take hours
33
- - Best for: Android apps
23
+ - **Target File**: `docs/deployment.md`
24
+ - **Phase Name**: "OPERATIONS & DEPLOYMENT"
25
+ - **Key Items**: CI/CD pipeline, deployment platform, monitoring, logging
26
+ - **Typical Gaps**: Incident runbooks, disaster recovery, scaling strategy
34
27
 
35
- C) 🔥 **Both App Store + Play Store** (Recommended for cross-platform)
28
+ **Proceed with appropriate scenario based on audit data from `.ai-flow/cache/audit-data.json`**
36
29
 
37
- - Maximum reach
38
- - Best for: Most apps
30
+ ---
39
31
 
40
- D) **Enterprise Distribution Only**
32
+ ## Phase 7 Questions (Full Mode)
41
33
 
42
- - Internal distribution
43
- - No public store
44
- - Best for: Enterprise apps
34
+ **7.1 Deployment Environment**
45
35
 
46
- **Your answer:**
47
- ---
48
- ### Question 7.2: CI/CD Pipeline
36
+ ```
37
+
38
+ Where will you deploy?
39
+
40
+ A) ⭐ Cloud Platform
41
+
42
+ - AWS (ECS, Fargate, Lambda, EC2)
43
+ - Google Cloud (Cloud Run, GKE, Compute Engine)
44
+ - Azure (App Service, AKS, VMs)
45
+
46
+ B) 🔥 Platform-as-a-Service (PaaS)
47
+
48
+ - Heroku
49
+ - Railway
50
+ - Render
51
+ - Fly.io
52
+ - Vercel (for APIs)
53
+
54
+ C) 🏢 On-Premises
55
+
56
+ - Company servers
57
+ - Private cloud
49
58
 
50
- **What CI/CD tool will you use for builds and deployment?**
59
+ D) 🐳 Container Orchestration
51
60
 
52
- A) **Fastlane** (Recommended)
61
+ - Kubernetes (GKE, EKS, AKS)
62
+ - Docker Swarm
63
+ - Nomad
53
64
 
54
- - Automates builds, screenshots, deployment
55
- - Works with iOS and Android
56
- - Integrates with GitHub Actions, Bitrise, etc.
57
- - Best for: Most projects
65
+ Your choice: \_\_
66
+ Why?
58
67
 
59
- B) **Codemagic**
68
+ ```
69
+
70
+ **7.2 Containerization**
71
+
72
+ ````
73
+
74
+ Will you use Docker?
60
75
 
61
- - Cloud-based CI/CD for Flutter/React Native
62
- - Easy setup, good for small teams
63
- - Best for: Flutter/React Native apps
76
+ A) Yes - Dockerize application
64
77
 
65
- C) **GitHub Actions**
78
+ - Multi-stage build
79
+ - Optimized image size
80
+ - Docker Compose for local dev
66
81
 
67
- - Flexible, free for public repos
68
- - Custom workflows
69
- - Best for: GitHub-hosted projects
82
+ B) No - Deploy directly
70
83
 
71
- D) **Bitrise**
84
+ If yes:
85
+ Base image: **
86
+ Estimated image size: ** MB
72
87
 
73
- - Mobile-focused CI/CD
74
- - Good for complex workflows
75
- - Best for: Enterprise teams
88
+ Example stack (local development):
76
89
 
77
- E) **Manual Builds**
90
+ ```yaml
91
+ services:
92
+ app:
93
+ build: .
94
+ ports: [3000:3000]
95
+ db:
96
+ image: postgres:15
97
+ redis:
98
+ image: redis:7
99
+ ```
78
100
 
79
- - Build locally, upload manually
80
- - Best for: Learning, small projects
101
+ ````
81
102
 
82
- **Your answer:**
83
- ---
84
- ### Question 7.3: Versioning Strategy
103
+ **7.3 Environment Strategy**
85
104
 
86
- **How will you version your app?**
105
+ ```
87
106
 
88
- A) **Semantic Versioning** (Recommended)
107
+ How many environments will you have?
89
108
 
90
- - Format: `MAJOR.MINOR.PATCH` (e.g., `1.2.3`)
91
- - MAJOR: Breaking changes
92
- - MINOR: New features, backward compatible
93
- - PATCH: Bug fixes
94
- - Best for: Most apps
109
+ A) Three environments
95
110
 
96
- B) **Date-based Versioning**
111
+ - Development (local)
112
+ - Staging (pre-production, QA)
113
+ - Production (live)
97
114
 
98
- - Format: `YYYY.MM.DD` (e.g., `2025.01.20`)
99
- - Best for: Frequent releases
115
+ B) 🏆 Four+ environments
100
116
 
101
- C) **Build Number Only**
117
+ - Development
118
+ - Testing (automated tests)
119
+ - Staging
120
+ - Production
102
121
 
103
- - Incrementing build number
104
- - Best for: Simple apps
122
+ C) 🚀 Two environments
105
123
 
106
- **Your answer:**
124
+ - Development
125
+ - Production
107
126
 
108
- **Version code strategy (Android):**
127
+ Your choice: \_\_
109
128
 
110
- - A) ⭐ **Incrementing integer** (1, 2, 3, ...)
111
- - B) **Based on version** (e.g., 1.2.3 → 10203)
129
+ Environment configuration:
130
+ A) Environment variables (.env files)
131
+ B) ✅ Config service (AWS Secrets Manager, Vault)
132
+ C) ✅ Feature flags (LaunchDarkly, Unleash)
112
133
 
113
- **Build number strategy (iOS):**
134
+ ```
114
135
 
115
- - A) **Incrementing integer** (1, 2, 3, ...)
116
- - B) **Based on version** (e.g., 1.2.3 → 10203)
117
- ---
118
- ### Question 7.4: Code Signing Strategy
136
+ **7.4 CI/CD Pipeline**
119
137
 
120
- **How will you handle code signing?**
138
+ ```
121
139
 
122
- **For iOS:**
140
+ CI/CD platform:
123
141
 
124
- - A) ⭐ **Automatic Signing** (Recommended)
125
- - Xcode manages certificates
126
- - Easier for most developers
127
- - Best for: Most apps
142
+ A) ⭐ GitHub Actions - If using GitHub
143
+ B) 🔥 GitLab CI - If using GitLab
144
+ C) Jenkins - Self-hosted
145
+ D) CircleCI
146
+ E) Travis CI
147
+ F) AWS CodePipeline
148
+ G) Azure DevOps
128
149
 
129
- - B) **Manual Signing**
130
- - More control
131
- - Required for enterprise apps
132
- - Best for: Advanced scenarios
150
+ Your choice: \_\_
133
151
 
134
- **For Android:**
152
+ Pipeline stages:
135
153
 
136
- - A) **Automatic Signing** (Recommended)
137
- - Gradle manages keystores
138
- - Easier for most developers
139
- - Best for: Most apps
154
+ 1. Checkout code
155
+ 2. Install dependencies
156
+ 3. Lint
157
+ 4. Test (with coverage)
158
+ 5. ✅ Build
159
+ 6. ✅ Security scan (optional)
160
+ 7. ✅ Deploy to staging
161
+ 8. ⏸️ Manual approval (optional)
162
+ 9. ✅ Deploy to production
140
163
 
141
- - B) **Manual Signing**
142
- - More control
143
- - Required for some enterprise scenarios
144
- - Best for: Advanced scenarios
164
+ Auto-deploy strategy:
165
+ A) ⭐ Auto-deploy to staging, manual approval for production
166
+ B) 🚀 Auto-deploy to production (main branch)
167
+ C) Manual deploy for all environments
145
168
 
146
- **Your answer:**
169
+ ```
147
170
 
148
- **Keystore management:**
171
+ **7.4.1 Deployment Strategy** (Production-Ready and Enterprise only)
149
172
 
150
- - A) ⭐ **Store in CI/CD secrets** (Recommended)
151
- - GitHub Secrets, Bitrise Secrets, etc.
152
- - Secure, automated
173
+ ```
174
+ What deployment strategy will you use for production?
175
+
176
+ A) ⭐ Rolling Deployment - Gradual replacement
177
+ - Replace instances one at a time
178
+ - Zero downtime
179
+ - Easy rollback
180
+
181
+ B) 🔥 Blue-Green Deployment - Instant switch
182
+ - Two identical environments
183
+ - Switch traffic instantly
184
+ - Higher infrastructure cost
185
+
186
+ C) ⚡ Canary Deployment - Progressive rollout
187
+ - Deploy to small percentage first
188
+ - Monitor for issues
189
+ - Gradually increase traffic
190
+
191
+ D) 🏆 Feature Flags - Code-level control
192
+ - Deploy code, toggle features
193
+ - Instant enable/disable
194
+ - Best with: LaunchDarkly, Unleash
195
+
196
+ Your choice: __
197
+
198
+ Rollback plan:
199
+ - How quickly must rollback complete? __ minutes
200
+ - Who can trigger rollback? [DevOps/Tech Lead/Any developer]
201
+ - Rollback trigger criteria? [Error rate > X%, latency > Y ms, manual]
202
+
203
+ If Blue-Green:
204
+ - Traffic switching: [Load balancer, DNS, etc.]
205
+ - Database migrations: [Strategy for zero-downtime]
206
+
207
+ If Canary:
208
+ - Initial traffic: __%
209
+ - Gradual increase: __% per __ minutes
210
+ - Success criteria: __
211
+ ```
153
212
 
154
- - B) **Store locally**
155
- - Manual management
156
- - Best for: Small teams
157
- ---
158
- ### Question 7.5: Beta Testing Strategy
213
+ **7.5 Monitoring & Logging**
159
214
 
160
- **How will you handle beta testing?**
215
+ ````
161
216
 
162
- A) ⭐ **TestFlight (iOS) + Firebase App Distribution (Android)** (Recommended)
217
+ Monitoring tools:
163
218
 
164
- - Free, easy to use
165
- - TestFlight: Up to 10,000 testers
166
- - Firebase: Unlimited testers
167
- - Best for: Most projects
219
+ Application Performance Monitoring (APM):
220
+ A) Datadog - Full-featured, expensive
221
+ B) 🔥 New Relic - Popular
222
+ C) Sentry - Error tracking focus
223
+ D) ⚡ OpenTelemetry + Grafana - Open source
224
+ E) AWS CloudWatch
225
+ F) None yet
168
226
 
169
- B) **TestFlight (iOS) + Google Play Internal Testing (Android)**
227
+ Your choice: \_\_
170
228
 
171
- - Official store channels
172
- - Internal testing: Up to 100 testers
173
- - Best for: Store-focused testing
229
+ Logging:
230
+ A) Centralized logging
174
231
 
175
- C) **TestFlight (iOS) + Google Play Closed Beta (Android)**
232
+ - Winston/Pino (Node.js) CloudWatch/Datadog
233
+ - Python logging → ELK Stack
176
234
 
177
- - Closed beta: Up to 20,000 testers
178
- - Best for: Larger beta programs
235
+ B) Basic console logs
179
236
 
180
- D) **HockeyApp / App Center**
237
+ C) Structured JSON logging
181
238
 
182
- - Microsoft's solution
183
- - Good for enterprise
239
+ ```json
240
+ {
241
+ "level": "info",
242
+ "timestamp": "2024-01-15T10:30:00Z",
243
+ "userId": "123",
244
+ "action": "user.login",
245
+ "ip": "192.168.1.1",
246
+ "message": "User logged in successfully"
247
+ }
248
+ ```
184
249
 
185
- E) **No Beta Testing**
250
+ Your logging strategy: \_\_
186
251
 
187
- - Direct to production
188
- - Best for: MVPs, internal apps
252
+ Metrics to track:
189
253
 
190
- **Your answer:**
191
- ---
192
- ### Question 7.6: Release Strategy
254
+ - ✅ Request rate (requests/sec)
255
+ - ✅ Error rate (% of failed requests)
256
+ - Response time (p50, p95, p99)
257
+ - ✅ Database query time
258
+ - ✅ Cache hit rate
259
+ - ✅ CPU/Memory usage
260
+ - Custom business metrics: \_\_
193
261
 
194
- **What release strategy will you use?**
262
+ ````
195
263
 
196
- A) ⭐ **Staged Rollout** (Recommended)
264
+ **7.6 Alerts**
197
265
 
198
- - Release to 10% → 50% → 100% of users
199
- - Monitor for issues before full release
200
- - Best for: Most apps
266
+ ```
201
267
 
202
- B) **Gradual Rollout**
268
+ When should you be alerted?
203
269
 
204
- - Release to specific countries/regions first
205
- - Expand gradually
206
- - Best for: Global apps
270
+ A) Error rate > **% (e.g., 1%)
271
+ B) Response time > **ms (e.g., 1000ms)
272
+ C) 5xx errors (server errors)
273
+ D) ✅ Service down (health check failure)
274
+ E) ✅ Database connection failures
275
+ F) ✅ Disk space > 80%
276
+ G) ✅ Memory usage > 85%
207
277
 
208
- C) **Full Release**
278
+ Alert channels:
279
+ A) ⭐ Email
280
+ B) 🔥 Slack/Discord
281
+ C) ⚡ PagerDuty/Opsgenie (on-call)
282
+ D) SMS (critical only)
209
283
 
210
- - Release to 100% immediately
211
- - Best for: Small updates, bug fixes
284
+ Your preferences: \_\_
212
285
 
213
- **Your answer:**
214
- ---
215
- ### Question 7.7: App Store Metadata
286
+ On-call rotation:
287
+ A) Yes - Using [PagerDuty/Opsgenie]
288
+ B) No - Monitor during business hours
216
289
 
217
- **What metadata will you prepare for stores?**
290
+ ```
218
291
 
219
- **Required:**
292
+ **7.7 Backup & Disaster Recovery**
220
293
 
221
- - [ ] App name (30 chars iOS, 50 chars Android)
222
- - [ ] App description (4000 chars)
223
- - [ ] Screenshots (various sizes)
224
- - [ ] App icon (1024x1024 iOS, 512x512 Android)
225
- - [ ] Privacy policy URL
294
+ ```
226
295
 
227
- **Optional:**
296
+ Backup strategy:
228
297
 
229
- - [ ] Promotional text
230
- - [ ] Keywords (iOS only)
231
- - [ ] App preview videos
232
- - [ ] Feature graphic (Android)
298
+ Database backups:
299
+ A) Automated daily backups
233
300
 
234
- **Your answer:**
235
- ---
236
- ### Question 7.8: Screenshot Automation
301
+ - Retention: 30 days
302
+ - Point-in-time recovery
237
303
 
238
- **Will you automate screenshot generation?**
304
+ B) 🏆 Continuous backups
239
305
 
240
- A) ⭐ **Yes - Fastlane Screenshots** (Recommended)
306
+ - Every hour
307
+ - 90 days retention
241
308
 
242
- - Automate screenshots for all devices
243
- - Update automatically on each release
244
- - Best for: Most apps
309
+ C) Manual backups weekly
245
310
 
246
- B) **Yes - Manual Scripts**
311
+ Your strategy: **
312
+ Retention period: ** days
247
313
 
248
- - Custom screenshot scripts
249
- - Best for: Custom requirements
314
+ Disaster recovery:
250
315
 
251
- C) **No - Manual Screenshots**
316
+ - Recovery Time Objective (RTO): \_\_ (how fast to restore)
317
+ - Recovery Point Objective (RPO): \_\_ (acceptable data loss)
252
318
 
253
- - Take screenshots manually
254
- - Best for: Small teams, infrequent updates
319
+ Example:
255
320
 
256
- **Your answer:**
257
- ---
258
- ### Question 7.9: App Review Preparation
321
+ - RTO: 1 hour (service restored within 1 hour)
322
+ - RPO: 15 minutes (lose max 15 min of data)
259
323
 
260
- **How will you prepare for app review?**
324
+ ```
261
325
 
262
- **For iOS App Store:**
326
+ **7.7.1 Database Migrations in Production**
263
327
 
264
- - [ ] Test on latest iOS version
265
- - [ ] Test on multiple device sizes
266
- - [ ] Ensure all features work
267
- - [ ] Prepare demo account credentials
268
- - [ ] Review App Store guidelines
269
- - [ ] Test in TestFlight first
328
+ ```
329
+ How will you handle database migrations in production?
270
330
 
271
- **For Google Play:**
331
+ Zero-downtime migrations:
332
+ A) ⭐ Yes - Plan for zero-downtime migrations (Production-Ready/Enterprise)
333
+ B) No - Accept maintenance windows (MVP)
272
334
 
273
- - [ ] Test on latest Android version
274
- - [ ] Test on multiple device sizes
275
- - [ ] Ensure all features work
276
- - [ ] Prepare demo account credentials
277
- - [ ] Review Play Store policies
278
- - [ ] Test in internal testing first
335
+ If zero-downtime:
336
+ - Strategy: [Expand/Contract, Blue-Green migrations, etc.]
337
+ - Rollback plan: __
338
+ - Testing: [Tested on staging, Dry-run process]
279
339
 
280
- **Your answer:**
281
- ---
282
- ### Question 7.10: Update Frequency
340
+ Migration windows (if not zero-downtime):
341
+ - Preferred time: __
342
+ - Duration: __ minutes
343
+ - Notification: __
344
+ ```
283
345
 
284
- **How often will you release updates?**
346
+ **7.7.2 Database Connection Pooling**
285
347
 
286
- A) ⭐ **As Needed** (Recommended)
348
+ ```
349
+ Database connection pooling configuration:
287
350
 
288
- - Release when features are ready
289
- - Best for: Most apps
351
+ Pool tool: [ORM built-in, pgBouncer, HikariCP, etc.]
290
352
 
291
- B) **Weekly**
353
+ Settings:
354
+ - Min connections: __
355
+ - Max connections: __
356
+ - Connection timeout: __ ms
357
+ - Idle timeout: __ ms
358
+ - Max lifetime: __ ms
292
359
 
293
- - Regular weekly releases
294
- - Best for: Rapid iteration
360
+ Monitoring:
361
+ - Track active/idle connections: [Yes/No]
362
+ - Alert on pool exhaustion: [Yes/No]
363
+ ```
295
364
 
296
- C) **Bi-weekly**
365
+ **7.8 Scaling Strategy**
297
366
 
298
- - Every two weeks
299
- - Best for: Balanced approach
367
+ ```
300
368
 
301
- D) **Monthly**
369
+ How will you handle growth?
302
370
 
303
- - Once per month
304
- - Best for: Stable apps
371
+ A) ⭐ Horizontal scaling - Add more instances
305
372
 
306
- **Your answer:**
307
- ---
308
- ### Question 7.11: Rollback Strategy
373
+ - Load balancer distributes traffic
374
+ - Stateless application design
309
375
 
310
- **How will you handle rollbacks?**
376
+ B) Vertical scaling - Bigger instances
311
377
 
312
- A) **Store Rollback** (Recommended)
378
+ - Increase CPU/RAM
379
+ - Simpler but limited
313
380
 
314
- - Revert to previous version in store
315
- - Best for: Critical bugs
381
+ C) ⚡ Auto-scaling - Automatic based on load
316
382
 
317
- B) **Hotfix Release**
383
+ - Scale up during high traffic
384
+ - Scale down to save costs
385
+ - Metrics: CPU > 70%, requests > threshold
318
386
 
319
- - Release emergency fix
320
- - Best for: Quick fixes
387
+ Your strategy: \_\_
321
388
 
322
- C) **No Rollback Plan**
389
+ Expected load:
323
390
 
324
- - Not recommended
325
- - Best for: Very small apps
391
+ - Initial: \_\_ requests/minute
392
+ - Year 1: \_\_ requests/minute
393
+ - Peak traffic: \_\_x normal load
326
394
 
327
- **Your answer:**
328
- ---
329
- ### Question 7.12: Monitoring & Analytics
395
+ Database scaling:
396
+ A) Read replicas - Scale reads
397
+ B) Sharding - Split data across DBs
398
+ C) Vertical scaling - Bigger DB instance
399
+ D) Not needed yet
330
400
 
331
- **What monitoring will you use post-deployment?**
401
+ ```
332
402
 
333
- A) ⭐ **Firebase Analytics + Crashlytics** (Recommended)
403
+ **7.9 Health Checks**
334
404
 
335
- - Free, comprehensive
336
- - Works with iOS and Android
337
- - Best for: Most apps
405
+ ````
338
406
 
339
- B) **Sentry**
407
+ Health check endpoints:
340
408
 
341
- - Excellent error tracking
342
- - Good for: Production apps
409
+ A) ✅ /health - Basic liveness
343
410
 
344
- C) **App Store Connect Analytics + Play Console Analytics**
411
+ - Returns 200 OK if app is running
345
412
 
346
- - Built-in store analytics
347
- - Best for: Store metrics
413
+ B) ✅ /health/ready - Readiness check
348
414
 
349
- D) **Custom Analytics**
415
+ - Returns 200 OK if app can handle traffic
416
+ - Checks: DB connected, Redis connected, etc.
350
417
 
351
- - Mixpanel, Amplitude, etc.
352
- - Best for: Advanced analytics
418
+ C) ✅ /health/live - Liveness check
353
419
 
354
- **Your answer:**
355
- ---
356
- ## ✅ Phase 7 Completion
420
+ - Returns 200 OK if app is alive
421
+ - Load balancer uses this
357
422
 
358
- After answering all questions, summarize:
423
+ Example response:
359
424
 
425
+ ```json
426
+ {
427
+ "status": "healthy",
428
+ "timestamp": "2024-01-15T10:30:00Z",
429
+ "checks": {
430
+ "database": "ok",
431
+ "redis": "ok",
432
+ "disk_space": "ok"
433
+ },
434
+ "version": "1.2.3"
435
+ }
360
436
  ```
361
- ---
362
- ✅ Phase 7 Complete: Store Deployment
363
- ---
364
- Selected Deployment Strategy:
365
- - Stores: {{TARGET_STORES}}
366
- - CI/CD: {{CICD_PIPELINE}}
367
- - Versioning: {{VERSIONING_STRATEGY}}
368
- - Code Signing: {{CODE_SIGNING}}
369
- - Beta Testing: {{BETA_TESTING}}
370
- - Release Strategy: {{RELEASE_STRATEGY}}
371
- - Monitoring: {{MONITORING_TOOLS}}
372
437
 
373
- Generated Documents:
374
- ✅ docs/app-store.md
375
- ✅ specs/build-configuration.md
376
- ✅ specs/deployment.md
377
- .env.example
378
- ---
379
- 📊 Progress Summary:
438
+ Your health check endpoints: \_\_
439
+
440
+ ````
441
+
442
+ **7.9.1 Graceful Shutdown**
443
+
444
+ ```
445
+ Will you implement graceful shutdown?
446
+
447
+ A) ⭐ Yes - Handle shutdown gracefully (Production-Ready/Enterprise)
448
+ B) No - Standard shutdown
449
+
450
+ If yes:
451
+ Shutdown sequence:
452
+ 1. Stop accepting new requests (timeout: __s)
453
+ 2. Finish processing current requests (timeout: __s)
454
+ 3. Close database connections (timeout: __s)
455
+ 4. Close other connections (Redis, message queues, etc.)
456
+ 5. Exit process
457
+
458
+ Total shutdown timeout: __s
459
+
460
+ Implementation:
461
+ - Signal handling: [SIGTERM, SIGINT]
462
+ - Health check grace period: __s
463
+ - Connection drain timeout: __s
464
+ ```
465
+
466
+ **7.9.2 Circuit Breakers & Resilience**
467
+
468
+ ```
469
+ Will you implement circuit breakers?
470
+
471
+ A) ⭐ Yes - Protect against cascading failures (Production-Ready/Enterprise)
472
+ B) No - Direct service calls
473
+
474
+ If yes:
475
+ Circuit breaker tool: [Resilience4j, Hystrix, Polly, etc.]
476
+
477
+ Configuration:
478
+ - Failure threshold: __% (open circuit after X% failures)
479
+ - Success threshold: __% (close circuit after X% successes)
480
+ - Timeout: __ms
481
+ - Half-open retries: __
482
+ - Reset timeout: __s
483
+
484
+ Fallback strategy:
485
+ A) ⭐ Return cached data
486
+ B) Return default/empty response
487
+ C) Call alternative service
488
+ D) Return error gracefully
489
+
490
+ Services to protect:
491
+ {{#EACH SERVICE_TO_PROTECT}}
492
+ - **{{SERVICE_NAME}}**: {{FAILURE_THRESHOLD}}% threshold, fallback: {{FALLBACK_STRATEGY}}
493
+ {{/EACH}}
494
+ ```
495
+
496
+ **7.9.3 Retry & Timeout Policies**
497
+
498
+ ```
499
+ Define retry and timeout policies for external dependencies:
500
+
501
+ | Service/Dependency | Timeout | Retries | Backoff Strategy | Notes |
502
+ |--------------------|-----------|---------|----------------------|----------------------|
503
+ | Database queries | 5000ms | 2 | None (fail fast) | Connection pooled |
504
+ | Redis cache | 1000ms | 1 | None | Cache miss = OK |
505
+ | Payment API | 30000ms | 3 | Exponential (1s,2s,4s)| Must complete |
506
+ | Email service | 5000ms | 3 | Fixed (2s) | Queue if fails |
507
+ | External REST APIs | 10000ms | 2 | Exponential | Circuit breaker |
508
+ | File storage (S3) | 15000ms | 3 | Exponential | Large files |
509
+
510
+ Your policies:
511
+
512
+ | Service/Dependency | Timeout | Retries | Backoff Strategy | Notes |
513
+ |--------------------|-----------|---------|----------------------|----------------------|
514
+ | | | | | |
515
+ | | | | | |
516
+
517
+ Global defaults:
518
+ - Default HTTP timeout: __ ms (recommended: 10000)
519
+ - Default retries: __ (recommended: 2)
520
+ - Default backoff: [None/Fixed/Exponential]
521
+
522
+ Non-retryable errors:
523
+ - 400 Bad Request (client error, won't succeed on retry)
524
+ - 401/403 Unauthorized/Forbidden
525
+ - 404 Not Found
526
+ - [Your additions]
527
+ ```
528
+
529
+ **7.9.4 Request/Response Logging & Masking**
530
+
531
+ ```
532
+ What request/response data will you log?
533
+
534
+ Log levels by environment:
535
+ | Environment | Level | Body Logging | Performance Logging |
536
+ |-------------|----------|--------------|---------------------|
537
+ | Development | debug | Full | Yes |
538
+ | Staging | info | Truncated | Yes |
539
+ | Production | info | Minimal | Yes |
540
+
541
+ Request logging:
542
+ - ✅ HTTP method and URL
543
+ - ✅ Request ID (correlation)
544
+ - ✅ User ID (if authenticated)
545
+ - ✅ IP address (optional, may hash for privacy)
546
+ - ✅ Request duration (ms)
547
+ - ❓ Request body (careful with size and PII)
548
+ - ❓ Query parameters
549
+
550
+ Response logging:
551
+ - ✅ Status code
552
+ - ✅ Response duration (ms)
553
+ - ❓ Response body (careful with size)
554
+
555
+ Sensitive data masking (CRITICAL):
556
+
557
+ | Field Pattern | Masking Strategy |
558
+ |------------------------|----------------------------|
559
+ | password, secret | Completely redact |
560
+ | token, api_key | Show last 4 chars only |
561
+ | email | j***@example.com |
562
+ | phone | ***-***-1234 |
563
+ | credit_card | ****-****-****-1234 |
564
+ | ssn, national_id | Completely redact |
565
+ | [Your patterns] | __ |
566
+
567
+ Log format:
568
+ A) ⭐ Structured JSON (recommended for aggregation)
569
+ B) Plain text with patterns
570
+ C) Framework default
571
+
572
+ Log aggregation:
573
+ A) ⭐ Centralized (ELK, Datadog, CloudWatch)
574
+ B) File-based with rotation
575
+ C) Console only (development)
576
+ ```
577
+
578
+ **7.10 Documentation & Runbooks**
579
+
580
+ ```
581
+
582
+ Operational documentation:
583
+
584
+ A) ✅ Deployment guide - How to deploy
585
+ B) ✅ Runbooks - How to handle incidents
586
+
587
+ - Database connection failure → steps to diagnose/fix
588
+ - High CPU usage → steps to investigate
589
+ - Service down → recovery procedure
590
+
591
+ C) ✅ Architecture diagrams (Mermaid format)
592
+
593
+ - System architecture diagram (mermaid)
594
+ - Data flow diagram (mermaid)
595
+ - Infrastructure diagram (mermaid)
596
+
597
+ D) ✅ API documentation
598
+
599
+ - Swagger/OpenAPI
600
+ - Auto-generated from code
601
+
602
+ Will you create these?
603
+ A) Yes - All of them ⭐
604
+ B) Yes - Critical ones only (deployment, runbooks)
605
+ C) Later - Start without docs
606
+
607
+ API documentation strategy:
608
+ A) ⭐ Code-First (Recommended)
380
609
 
381
- Phases 1-7 completed:
382
- ✅ project-brief.md (Phase 1)
383
- docs/app-structure.md (Phase 2)
384
- ✅ docs/architecture.md (Phase 3)
385
- ✅ ai-instructions.md (Phase 3)
386
- ✅ docs/code-standards.md (Phase 5)
387
- ✅ docs/testing.md (Phase 6)
388
- ✅ docs/app-store.md (Phase 7)
389
- ✅ specs/build-configuration.md (Phase 7)
390
- ✅ specs/deployment.md (Phase 7)
391
- ✅ .env.example (Phase 7)
610
+ - Generate docs from code (Swagger/OpenAPI decorators)
611
+ - Always in sync with code
612
+ - Tools: @nestjs/swagger, FastAPI docs
392
613
 
393
- Remaining:
394
- ⏭️ Phase 8: Project setup & final documentation
395
- ---
396
- 🎯 Next: Phase 8 - Project Setup & Final Documentation
397
- ---
398
- Phase 8 will:
399
- - 🔍 Detect project state (new vs existing)
400
- - 🚀 Initialize framework (optional, for new projects)
401
- - 📝 Generate final docs (platform-guides, navigation-guide, contributing)
402
- - 📖 Generate AGENT.md (master documentation index)
403
- - 📄 Generate README.md (with intelligent merge if needed)
404
- - 🤖 Create tool-specific configs (based on AI selection)
614
+ B) 📝 Design-First
405
615
 
406
- Continue to Phase 8? (yes/no)
616
+ - Write openapi.yaml manually first
617
+ - Generate code from spec
618
+ - Better for large teams/contracts
619
+
620
+ C) 📄 Manual
621
+
622
+ - Write Markdown/Notion docs
623
+ - Hard to keep in sync (Not recommended)
624
+
625
+ ```
626
+
627
+ ---
628
+
629
+ #### 🎨 MERMAID OPERATIONS DIAGRAM FORMATS - CRITICAL
630
+
631
+ ## **Use these exact formats** for operational and infrastructure diagrams mentioned in question 7.10:
632
+
633
+ ##### 1️⃣ System Architecture Diagram (Deployment View)
634
+
635
+ Use `graph TD` to show deployed system components with scaling and redundancy:
636
+
637
+ ````markdown
638
+ ```mermaid
639
+ graph TD
640
+ subgraph "Production Environment"
641
+ subgraph "Load Balancer Layer"
642
+ LB1[Load Balancer 1]
643
+ LB2[Load Balancer 2]
644
+ end
645
+
646
+ subgraph "Application Layer"
647
+ App1[API Server 1<br/>4 vCPU, 8GB RAM]
648
+ App2[API Server 2<br/>4 vCPU, 8GB RAM]
649
+ App3[API Server 3<br/>4 vCPU, 8GB RAM]
650
+ end
651
+
652
+ subgraph "Data Layer"
653
+ Primary[(Primary DB<br/>PostgreSQL 15)]
654
+ Replica1[(Read Replica 1)]
655
+ Replica2[(Read Replica 2)]
656
+ Cache[Redis Cluster<br/>3 Nodes]
657
+ end
658
+
659
+ subgraph "Message Queue"
660
+ Queue[RabbitMQ Cluster<br/>3 Nodes]
661
+ end
662
+ end
663
+
664
+ Internet[Internet] -->|HTTPS| LB1
665
+ Internet -->|HTTPS| LB2
666
+ LB1 --> App1
667
+ LB1 --> App2
668
+ LB2 --> App2
669
+ LB2 --> App3
670
+
671
+ App1 -->|Write| Primary
672
+ App2 -->|Write| Primary
673
+ App3 -->|Write| Primary
674
+
675
+ App1 -->|Read| Replica1
676
+ App2 -->|Read| Replica2
677
+ App3 -->|Read| Replica1
678
+
679
+ App1 -->|Cache| Cache
680
+ App2 -->|Cache| Cache
681
+ App3 -->|Cache| Cache
682
+
683
+ App1 -->|Async Jobs| Queue
684
+ App2 -->|Async Jobs| Queue
685
+ App3 -->|Async Jobs| Queue
686
+
687
+ Primary -.->|Replication| Replica1
688
+ Primary -.->|Replication| Replica2
689
+
690
+ style Internet fill:#e1f5ff
691
+ style Primary fill:#e1ffe1
692
+ style Cache fill:#f0e1ff
693
+ style Queue fill:#ffe1f5
694
+ ```
695
+ ````
696
+
697
+ ## **Use for:** Showing deployed infrastructure, scaling configuration, redundancy, high availability
698
+
699
+ ##### 2️⃣ Data Flow Diagram (Request Flow)
700
+
701
+ Use `flowchart LR` to show how data moves through the system step-by-step:
702
+
703
+ ````markdown
704
+ ```mermaid
705
+ flowchart LR
706
+ User[User Request] -->|1. HTTPS POST| LB[Load Balancer]
707
+ LB -->|2. Route| API[API Server]
708
+ API -->|3. Validate JWT| Auth[Auth Service]
709
+ Auth -->|4. Token Valid| API
710
+
711
+ API -->|5. Check Cache| Cache[(Redis Cache)]
712
+ Cache -->|6. Cache Miss| API
713
+
714
+ API -->|7. Query| DB[(PostgreSQL)]
715
+ DB -->|8. Data| API
716
+
717
+ API -->|9. Store in Cache| Cache
718
+ API -->|10. Enqueue Job| Queue[Message Queue]
719
+
720
+ Queue -->|11. Process| Worker[Background Worker]
721
+ Worker -->|12. Send Email| Email[Email Service]
722
+
723
+ API -->|13. JSON Response| User
724
+
725
+ style User fill:#e1f5ff
726
+ style Cache fill:#f0e1ff
727
+ style DB fill:#e1ffe1
728
+ style Email fill:#fff4e1
729
+ ```
730
+ ````
731
+
732
+ ## **Use for:** Documenting request/response cycles, async processing flows, numbered execution steps
733
+
734
+ ##### 3️⃣ Infrastructure Diagram (Cloud Resources)
735
+
736
+ Use `graph TB` with subgraphs to show cloud infrastructure and network topology:
737
+
738
+ ````markdown
739
+ ```mermaid
740
+ graph TB
741
+ subgraph "AWS Cloud - Production (us-east-1)"
742
+ subgraph "VPC (10.0.0.0/16)"
743
+ subgraph "Public Subnet (10.0.1.0/24)"
744
+ ALB[Application Load Balancer]
745
+ NAT[NAT Gateway]
746
+ end
747
+
748
+ subgraph "Private Subnet 1 (10.0.10.0/24)"
749
+ ECS1[ECS Cluster<br/>Auto Scaling Group]
750
+ App1[Container: API<br/>Fargate Task]
751
+ App2[Container: API<br/>Fargate Task]
752
+ end
753
+
754
+ subgraph "Private Subnet 2 (10.0.20.0/24)"
755
+ RDS[(RDS PostgreSQL<br/>Multi-AZ)]
756
+ ElastiCache[ElastiCache Redis<br/>Cluster Mode]
757
+ end
758
+
759
+ subgraph "Private Subnet 3 (10.0.30.0/24)"
760
+ SQS[Amazon SQS<br/>Message Queue]
761
+ Lambda[Lambda Functions<br/>Background Workers]
762
+ end
763
+ end
764
+
765
+ subgraph "Supporting Services"
766
+ S3[S3 Bucket<br/>File Storage]
767
+ CloudWatch[CloudWatch<br/>Monitoring & Logs]
768
+ SecretsManager[Secrets Manager<br/>API Keys & Credentials]
769
+ end
770
+ end
771
+
772
+ Internet[Internet Users] -->|HTTPS| ALB
773
+ ALB --> App1
774
+ ALB --> App2
775
+
776
+ App1 --> RDS
777
+ App2 --> RDS
778
+ App1 --> ElastiCache
779
+ App2 --> ElastiCache
780
+
781
+ App1 -->|Upload/Download| S3
782
+ App2 -->|Upload/Download| S3
783
+
784
+ App1 -->|Send Message| SQS
785
+ SQS -->|Trigger| Lambda
786
+ Lambda --> RDS
787
+
788
+ App1 -->|Logs & Metrics| CloudWatch
789
+ App2 -->|Logs & Metrics| CloudWatch
790
+ Lambda -->|Logs| CloudWatch
791
+
792
+ App1 -->|Fetch Secrets| SecretsManager
793
+ App2 -->|Fetch Secrets| SecretsManager
794
+
795
+ style Internet fill:#e1f5ff
796
+ style RDS fill:#e1ffe1
797
+ style ElastiCache fill:#f0e1ff
798
+ style S3 fill:#fff4e1
799
+ style CloudWatch fill:#ffe1e1
800
+ ```
801
+ ````
802
+
803
+ ## **Use for:** Documenting cloud architecture, network topology, AWS/GCP/Azure resources, VPC design
804
+
805
+ ##### 4️⃣ Monitoring & Observability Diagram (Optional)
806
+
807
+ Use `graph TD` to show monitoring, logging, and alerting stack:
808
+
809
+ ````markdown
810
+ ```mermaid
811
+ graph TD
812
+ subgraph "Application Layer"
813
+ App[API Servers]
814
+ Worker[Background Workers]
815
+ end
816
+
817
+ subgraph "Monitoring Stack"
818
+ Prometheus[Prometheus<br/>Metrics Collection]
819
+ Grafana[Grafana<br/>Dashboards]
820
+ AlertManager[Alert Manager<br/>Notifications]
821
+ end
822
+
823
+ subgraph "Logging Stack"
824
+ FluentBit[Fluent Bit<br/>Log Collector]
825
+ Elasticsearch[Elasticsearch<br/>Log Storage]
826
+ Kibana[Kibana<br/>Log Viewer]
827
+ end
828
+
829
+ subgraph "Tracing"
830
+ Jaeger[Jaeger<br/>Distributed Tracing]
831
+ end
832
+
833
+ subgraph "Alerts"
834
+ PagerDuty[PagerDuty]
835
+ Slack[Slack Notifications]
836
+ end
837
+
838
+ App -->|Metrics| Prometheus
839
+ Worker -->|Metrics| Prometheus
840
+ Prometheus --> Grafana
841
+ Prometheus --> AlertManager
842
+
843
+ App -->|Logs| FluentBit
844
+ Worker -->|Logs| FluentBit
845
+ FluentBit --> Elasticsearch
846
+ Elasticsearch --> Kibana
847
+
848
+ App -->|Traces| Jaeger
849
+ Worker -->|Traces| Jaeger
850
+
851
+ AlertManager --> PagerDuty
852
+ AlertManager --> Slack
853
+
854
+ style Grafana fill:#e1f5ff
855
+ style Kibana fill:#f0e1ff
856
+ style PagerDuty fill:#ffe1e1
857
+ ```
858
+ ````
859
+
860
+ ## **Use for:** Documenting observability strategy, monitoring infrastructure, alerting workflows
861
+
862
+ **Best Practices for Operations Diagrams:**
863
+
864
+ 1. **Include Resource Specs:** Add CPU/RAM/disk info to nodes (e.g., `[API Server<br/>4 vCPU, 8GB RAM]`)
865
+ 2. **Show Redundancy:** Display load balancers, replicas, multi-AZ deployments, failover paths
866
+ 3. **Label Network Boundaries:** Use subgraphs for VPCs, subnets, availability zones, regions
867
+ 4. **Document Protocols:** Label connections with HTTPS, gRPC, TCP, WebSocket, etc.
868
+ 5. **Add IP Ranges:** Include CIDR blocks for network subnets (e.g., `10.0.1.0/24`)
869
+ 6. **Show Auto-Scaling:** Indicate which components scale horizontally/vertically
870
+ 7. **Include External Services:** SaaS tools, third-party APIs, CDNs, email providers
871
+ 8. **Color Code by Layer:** Infrastructure (blue), data (green), monitoring (purple), alerts (red)
872
+
873
+ **Common Formatting Rules:**
874
+
875
+ - Code fence: ` ```mermaid ` (lowercase, no spaces, three backticks)
876
+ - Use `subgraph "Name"` to group related components by layer/zone
877
+ - Use `[(Cylinder)]` for databases, data stores, and persistent storage
878
+ - Use `[Square Brackets]` for services, servers, and compute resources
879
+ - Use dotted arrows `-.->` for replication, backup, and async flows
880
+ - Apply consistent styling: `style NodeName fill:#colorcode`
881
+
882
+ **Deployment Context Examples:**
883
+
884
+ - For Docker: Show containers, volumes, networks, registries
885
+ - For Kubernetes: Show pods, services, ingress, namespaces, persistent volumes
886
+ - For Serverless: Show Lambda functions, API Gateway, S3 triggers, event sources
887
+ - For VMs: Show instances, security groups, load balancers, auto-scaling groups
888
+
889
+ ## **Validation:** Test diagrams at https://mermaid.live/ before saving to ensure syntax is correct
890
+
891
+ ### Phase 7 Output
892
+
893
+ ```
894
+ 📋 PHASE 7 SUMMARY:
895
+
896
+ Deployment Environment: [cloud/PaaS/on-premises/container-orchestration + platform choice + rationale] (7.1)
897
+ Containerization: [yes/no + Docker setup (base image, size, compose stack)] (7.2)
898
+ Environments: [number of environments (dev/staging/prod) + config approach (env vars/secrets/feature flags)] (7.3)
899
+ CI/CD Pipeline: [platform (GitHub Actions/GitLab CI/etc.) + pipeline stages + auto-deploy strategy] (7.4)
900
+ Deployment Strategy: [standard/blue-green/canary/rolling + zero-downtime approach + rollback plan] (7.4.1)
901
+ Monitoring & Logging: [APM tool + logging strategy (centralized/structured JSON) + metrics to track] (7.5)
902
+ Alerts: [alert conditions (error rate/response time/5xx/etc.) + channels (email/Slack/PagerDuty) + on-call rotation] (7.6)
903
+ Backup & Disaster Recovery: [backup strategy + retention period + RTO/RPO targets] (7.7)
904
+ Database Migrations in Production: [zero-downtime strategy + rollback plan + migration windows] (7.7.1)
905
+ Database Connection Pooling: [pool tool + settings (min/max/timeouts) + monitoring] (7.7.2)
906
+ Scaling Strategy: [horizontal/vertical/auto-scaling + expected load + database scaling approach] (7.8)
907
+ Health Checks: [endpoints (/health, /health/ready, /health/live) + checks performed] (7.9)
908
+ Graceful Shutdown: [yes/no + shutdown sequence + timeouts] (7.9.1)
909
+ Circuit Breakers & Resilience: [yes/no + tool + configuration + fallback strategies] (7.9.2)
910
+ Documentation & Runbooks: [what will be created (deployment guide/runbooks/architecture diagrams in mermaid format/API docs) + API doc strategy (code-first/design-first)] (7.10)
911
+
912
+ Is this correct? (Yes/No)
913
+ ```
914
+
915
+ ---
916
+
917
+ ### 📄 Generate Phase 7 Documents
918
+
919
+ **Before starting generation:**
920
+
921
+ ```
922
+ 📖 Loading context from previous phases...
923
+ ✅ Re-reading docs/testing.md
924
+ ✅ Re-reading ai-instructions.md
925
+ ```
926
+
927
+ **Generate documents automatically:**
928
+
929
+ **1. `docs/operations.md`**
930
+
931
+ - Use template: `.ai-flow/templates/docs/operations.template.md`
932
+ - Fill with deployment, monitoring, alerting, backup, scaling
933
+ - Write to: `docs/operations.md`
934
+
935
+ **2. `specs/configuration.md`**
936
+
937
+ - Use template: `.ai-flow/templates/specs/configuration.template.md`
938
+ - Fill with environment variables, secrets management, feature flags
939
+ - Write to: `specs/configuration.md`
940
+
941
+ **3. `.env.example`**
942
+
943
+ - List all environment variables needed
944
+ - Include comments explaining each variable
945
+ - Write to: `.env.example`
946
+
947
+ ```
948
+ ✅ Generated: docs/operations.md
949
+ ✅ Generated: specs/configuration.md
950
+ ✅ Generated: .env.example
951
+
952
+ Documents have been created with all Phase 7 information.
953
+
954
+ 📝 Would you like to make any corrections before continuing?
955
+
956
+ → If yes: Edit the files and type "ready" when done. I'll re-read them.
957
+ → If no: Type "continue" to proceed to final checkpoint.
958
+ ```
959
+
960
+ **If user edits files:**
961
+ Re-read files to refresh context before continuing.
962
+
963
+ ---
964
+
965
+ ### Phase 7 Completion
966
+
967
+ ```
968
+ ✅ Phase 7 Complete!
969
+
970
+ Generated documents:
971
+ ✅ docs/operations.md
972
+ ✅ specs/configuration.md
973
+ ✅ .env.example
974
+
975
+ 📝 Would you like to review these documents before proceeding to Phase 8?
976
+
977
+ → If yes: Edit the files and type "ready" when done.
978
+ → If no: Type "continue" to proceed to Phase 8.
407
979
  ```
408
- ---
409
- **Last Updated:** 2025-12-09
410
980
 
411
- **Version:** 2.0.0 (Unified workflow with Phase 8)
981
+ ---
982
+
983
+ ## 📝 Generated Documents
984
+
985
+ After Phase 7, generate/update:
986
+
987
+ - `docs/operations.md` - Operations and deployment guide
988
+ - `specs/configuration.md` - Configuration specification
989
+ - `.env.example` - Environment variables template
990
+
991
+ ---
992
+
993
+ **Next Phase:** Phase 8 - Project Setup & Final Documentation
412
994
 
995
+ Read: `.ai-flow/prompts/backend/flow-build-phase-8.md`
413
996
 
997
+ ---
414
998
 
999
+ **Last Updated:** 2025-12-20
415
1000
 
1001
+ **Version:** 2.1.8