@enki-dev-expert/global-engineering-standards 0.0.0-stage → 0.1.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.
- package/AGENTS.md +303 -0
- package/CHANGELOG.md +28 -0
- package/CITATION.cff +21 -0
- package/CODE_OF_CONDUCT.md +13 -0
- package/CONTRIBUTING.md +27 -0
- package/LICENSE +21 -0
- package/README.md +159 -2
- package/SECURITY.md +25 -0
- package/dist/cli.js +40 -0
- package/dist/content.js +71 -0
- package/dist/filesystem.js +83 -0
- package/dist/installer.js +243 -0
- package/dist/layout.js +42 -0
- package/dist/transaction.js +143 -0
- package/docs/ai-and-llm.md +1312 -0
- package/docs/architecture.md +1007 -0
- package/docs/cost-engineering.md +1322 -0
- package/docs/data.md +993 -0
- package/docs/governance.md +1744 -0
- package/docs/mobile-and-web.md +1362 -0
- package/docs/observability.md +1345 -0
- package/docs/platforms-and-applications.md +1581 -0
- package/docs/privacy.md +566 -0
- package/docs/quality-and-testing.md +1278 -0
- package/docs/scalability.md +1012 -0
- package/docs/security.md +373 -0
- package/handbook/claude-plugin.md +31 -0
- package/handbook/compatibility.md +27 -0
- package/handbook/recovery.md +29 -0
- package/handbook/releasing.md +50 -0
- package/handbook/security-review.md +41 -0
- package/handbook/signing.md +18 -0
- package/handbook/validation.md +50 -0
- package/package.json +65 -4
- package/scripts/content-baseline.json +25 -0
- package/skills/engineering-architecture-review/SKILL.md +1531 -0
- package/skills/engineering-cost-estimate/SKILL.md +1599 -0
- package/skills/engineering-database-review/SKILL.md +1364 -0
- package/skills/engineering-privacy-check/SKILL.md +1295 -0
- package/skills/engineering-safe-implementation/SKILL.md +1502 -0
- package/skills/engineering-security-standards-check/SKILL.md +1112 -0
- package/src/cli.ts +45 -0
- package/src/content.ts +82 -0
- package/src/filesystem.ts +94 -0
- package/src/installer.ts +280 -0
- package/src/layout.ts +70 -0
- package/src/transaction.ts +167 -0
- package/templates/ADR.md +1302 -0
- package/templates/AUDIT_REPORT.md +1693 -0
- package/templates/EXCEPTIONS.md +647 -0
- package/templates/PROJECT_AGENTS.md +868 -0
|
@@ -0,0 +1,1007 @@
|
|
|
1
|
+
|
|
2
|
+
# Global Software Architecture Standards
|
|
3
|
+
|
|
4
|
+
## 1. Mission
|
|
5
|
+
|
|
6
|
+
Design, evolve and maintain production-grade software architectures that are secure, reliable, maintainable, testable, scalable and cost-efficient.
|
|
7
|
+
|
|
8
|
+
These standards apply to new and existing applications, including:
|
|
9
|
+
|
|
10
|
+
- Web applications.
|
|
11
|
+
- Native iOS applications.
|
|
12
|
+
- Native Android applications.
|
|
13
|
+
- Cross-platform mobile applications.
|
|
14
|
+
- Backend services and APIs.
|
|
15
|
+
- Database systems.
|
|
16
|
+
- AI-powered applications.
|
|
17
|
+
- Real-time systems.
|
|
18
|
+
- Enterprise SaaS platforms.
|
|
19
|
+
|
|
20
|
+
Architecture must be planned before significant implementation.
|
|
21
|
+
|
|
22
|
+
Architecture decisions must be justified by actual requirements, measurable constraints, operational risks and total cost of ownership.
|
|
23
|
+
|
|
24
|
+
Never assume that a complex architecture is better than a simple one.
|
|
25
|
+
|
|
26
|
+
## 2. Architecture-First Workflow
|
|
27
|
+
|
|
28
|
+
Before implementing significant functionality:
|
|
29
|
+
|
|
30
|
+
1. Inspect the existing project.
|
|
31
|
+
2. Identify business goals and user workflows.
|
|
32
|
+
3. Define functional requirements.
|
|
33
|
+
4. Define non-functional requirements.
|
|
34
|
+
5. Identify domain entities and invariants.
|
|
35
|
+
6. Identify system boundaries and dependencies.
|
|
36
|
+
7. Map data flows and trust boundaries.
|
|
37
|
+
8. Evaluate security and privacy.
|
|
38
|
+
9. Estimate expected capacity and cost.
|
|
39
|
+
10. Propose architectural alternatives.
|
|
40
|
+
11. Document the recommended architecture.
|
|
41
|
+
12. Define measurable acceptance criteria.
|
|
42
|
+
13. Present an implementation plan.
|
|
43
|
+
14. Wait for explicit human approval.
|
|
44
|
+
|
|
45
|
+
Do not write implementation code during a requested architecture-only assessment.
|
|
46
|
+
|
|
47
|
+
Separate confirmed requirements from assumptions and recommendations.
|
|
48
|
+
|
|
49
|
+
## 3. Architectural Principles
|
|
50
|
+
|
|
51
|
+
Apply the following principles pragmatically:
|
|
52
|
+
|
|
53
|
+
- Separation of Concerns.
|
|
54
|
+
- Single Responsibility.
|
|
55
|
+
- High Cohesion.
|
|
56
|
+
- Low Coupling.
|
|
57
|
+
- Dependency Inversion where useful.
|
|
58
|
+
- Encapsulation.
|
|
59
|
+
- Explicit interfaces and contracts.
|
|
60
|
+
- Information Hiding.
|
|
61
|
+
- Composition over Inheritance where appropriate.
|
|
62
|
+
- SOLID.
|
|
63
|
+
- DRY.
|
|
64
|
+
- KISS.
|
|
65
|
+
- YAGNI.
|
|
66
|
+
- Security by Design.
|
|
67
|
+
- Privacy by Design.
|
|
68
|
+
- Observability by Design.
|
|
69
|
+
- Cost-Aware Architecture.
|
|
70
|
+
|
|
71
|
+
Do not apply design patterns mechanically.
|
|
72
|
+
|
|
73
|
+
Avoid abstractions that increase complexity without providing measurable benefits.
|
|
74
|
+
|
|
75
|
+
Readable, understandable architecture is preferable to unnecessary sophistication.
|
|
76
|
+
|
|
77
|
+
## 4. Domain-Driven Design
|
|
78
|
+
|
|
79
|
+
Identify clear business domains and bounded contexts where useful.
|
|
80
|
+
|
|
81
|
+
Separate domain concepts from:
|
|
82
|
+
|
|
83
|
+
- User interface concerns.
|
|
84
|
+
- Database implementation details.
|
|
85
|
+
- Infrastructure frameworks.
|
|
86
|
+
- External providers.
|
|
87
|
+
- Transport protocols.
|
|
88
|
+
|
|
89
|
+
Protect important business rules from accidental duplication.
|
|
90
|
+
|
|
91
|
+
Identify ownership of business entities and invariants.
|
|
92
|
+
|
|
93
|
+
Use domain services, application services and repositories when they provide meaningful separation.
|
|
94
|
+
|
|
95
|
+
Do not introduce unnecessary layers into simple modules.
|
|
96
|
+
|
|
97
|
+
## 5. Modular Architecture
|
|
98
|
+
|
|
99
|
+
Prefer a modular architecture with explicit boundaries.
|
|
100
|
+
|
|
101
|
+
Each module should have:
|
|
102
|
+
|
|
103
|
+
- A clear responsibility.
|
|
104
|
+
- Defined ownership of business logic.
|
|
105
|
+
- Explicit public interfaces.
|
|
106
|
+
- Controlled dependencies.
|
|
107
|
+
- Testable behavior.
|
|
108
|
+
- Documented integration contracts.
|
|
109
|
+
|
|
110
|
+
Avoid circular dependencies.
|
|
111
|
+
|
|
112
|
+
Avoid modules accessing another module's internal implementation directly.
|
|
113
|
+
|
|
114
|
+
Prefer a modular monolith as the initial architecture unless requirements justify distributed services.
|
|
115
|
+
|
|
116
|
+
Do not introduce microservices solely because millions of users are a future objective.
|
|
117
|
+
|
|
118
|
+
## 6. Modular Monolith vs Microservices
|
|
119
|
+
|
|
120
|
+
Evaluate a modular monolith first.
|
|
121
|
+
|
|
122
|
+
Consider microservices when supported by evidence such as:
|
|
123
|
+
|
|
124
|
+
- Independent scaling requirements.
|
|
125
|
+
- Different reliability boundaries.
|
|
126
|
+
- Different deployment lifecycles.
|
|
127
|
+
- Organizational ownership needs.
|
|
128
|
+
- Strong isolation requirements.
|
|
129
|
+
- Measured operational bottlenecks.
|
|
130
|
+
|
|
131
|
+
Evaluate the additional costs of:
|
|
132
|
+
|
|
133
|
+
- Network communication.
|
|
134
|
+
- Distributed tracing.
|
|
135
|
+
- Service authentication.
|
|
136
|
+
- Data consistency.
|
|
137
|
+
- Infrastructure.
|
|
138
|
+
- Deployment complexity.
|
|
139
|
+
- Operational monitoring.
|
|
140
|
+
- Incident response.
|
|
141
|
+
|
|
142
|
+
Never recommend microservices without explaining measurable benefits and operational trade-offs.
|
|
143
|
+
|
|
144
|
+
## 7. Scalability Architecture
|
|
145
|
+
|
|
146
|
+
Design systems to evolve toward millions of users.
|
|
147
|
+
|
|
148
|
+
Evaluate scenarios involving:
|
|
149
|
+
|
|
150
|
+
- 10,000 users.
|
|
151
|
+
- 100,000 users.
|
|
152
|
+
- 1,000,000 users.
|
|
153
|
+
- 5,000,000 users.
|
|
154
|
+
- 10,000,000 users.
|
|
155
|
+
|
|
156
|
+
Distinguish:
|
|
157
|
+
|
|
158
|
+
- Registered users.
|
|
159
|
+
- Monthly active users.
|
|
160
|
+
- Daily active users.
|
|
161
|
+
- Concurrent users.
|
|
162
|
+
- Peak requests per second.
|
|
163
|
+
- Database operations per second.
|
|
164
|
+
- Storage growth.
|
|
165
|
+
- Real-time connections.
|
|
166
|
+
|
|
167
|
+
Define scaling thresholds based on measured or explicitly modeled demand.
|
|
168
|
+
|
|
169
|
+
Evaluate:
|
|
170
|
+
|
|
171
|
+
- Horizontal scaling.
|
|
172
|
+
- Stateless services.
|
|
173
|
+
- Load balancing.
|
|
174
|
+
- Database connection pooling.
|
|
175
|
+
- Appropriate caching.
|
|
176
|
+
- Background jobs.
|
|
177
|
+
- Queues.
|
|
178
|
+
- Concurrency control.
|
|
179
|
+
- Resource quotas.
|
|
180
|
+
- Rate limiting.
|
|
181
|
+
- Infrastructure resilience.
|
|
182
|
+
- Database partitioning when justified.
|
|
183
|
+
- Multi-region deployment when justified.
|
|
184
|
+
|
|
185
|
+
Never claim capacity for millions of users without evidence from modeling, testing or operational measurements.
|
|
186
|
+
|
|
187
|
+
Design for future scale while paying for current demand.
|
|
188
|
+
|
|
189
|
+
## 8. Performance Engineering
|
|
190
|
+
|
|
191
|
+
Define measurable performance objectives.
|
|
192
|
+
|
|
193
|
+
Evaluate:
|
|
194
|
+
|
|
195
|
+
- Response latency.
|
|
196
|
+
- p50, p95 and p99 latency.
|
|
197
|
+
- Throughput.
|
|
198
|
+
- Error rates.
|
|
199
|
+
- Memory usage.
|
|
200
|
+
- CPU consumption.
|
|
201
|
+
- Database query performance.
|
|
202
|
+
- Network payload size.
|
|
203
|
+
- Frontend rendering performance.
|
|
204
|
+
- Mobile startup time.
|
|
205
|
+
- Battery consumption.
|
|
206
|
+
- Real-time delivery latency.
|
|
207
|
+
|
|
208
|
+
Avoid premature optimization.
|
|
209
|
+
|
|
210
|
+
Use profiling, monitoring and load testing to identify bottlenecks.
|
|
211
|
+
|
|
212
|
+
Do not introduce caching without a consistency and invalidation strategy.
|
|
213
|
+
|
|
214
|
+
## 9. API Architecture
|
|
215
|
+
|
|
216
|
+
Design APIs with explicit contracts.
|
|
217
|
+
|
|
218
|
+
Requirements:
|
|
219
|
+
|
|
220
|
+
- Clear resource and operation boundaries.
|
|
221
|
+
- Consistent naming.
|
|
222
|
+
- Input validation.
|
|
223
|
+
- Output schemas.
|
|
224
|
+
- Authentication and authorization.
|
|
225
|
+
- Appropriate error handling.
|
|
226
|
+
- Pagination where relevant.
|
|
227
|
+
- Filtering and sorting controls.
|
|
228
|
+
- Rate limiting.
|
|
229
|
+
- Idempotency where necessary.
|
|
230
|
+
- Request timeouts.
|
|
231
|
+
- Bounded retries.
|
|
232
|
+
- Observability.
|
|
233
|
+
- Backward compatibility.
|
|
234
|
+
|
|
235
|
+
Use API versioning when required by compatibility needs.
|
|
236
|
+
|
|
237
|
+
Do not expose internal implementation details unnecessarily.
|
|
238
|
+
|
|
239
|
+
Protect existing clients during API evolution.
|
|
240
|
+
|
|
241
|
+
## 10. Cross-Platform Architecture
|
|
242
|
+
|
|
243
|
+
For applications supporting web, iOS and Android:
|
|
244
|
+
|
|
245
|
+
- Define consistent backend contracts.
|
|
246
|
+
- Centralize authoritative business rules.
|
|
247
|
+
- Avoid duplicating critical validation across platforms.
|
|
248
|
+
- Respect platform-specific capabilities.
|
|
249
|
+
- Keep authentication and authorization consistent.
|
|
250
|
+
- Handle network interruptions.
|
|
251
|
+
- Define offline behavior where required.
|
|
252
|
+
- Support appropriate state synchronization.
|
|
253
|
+
- Maintain backward compatibility with older mobile versions.
|
|
254
|
+
- Test platform-specific edge cases.
|
|
255
|
+
|
|
256
|
+
Client-side validation improves user experience but cannot replace server-side enforcement.
|
|
257
|
+
|
|
258
|
+
## 11. Frontend Architecture
|
|
259
|
+
|
|
260
|
+
Organize frontend code around cohesive features and responsibilities.
|
|
261
|
+
|
|
262
|
+
Separate:
|
|
263
|
+
|
|
264
|
+
- Presentation.
|
|
265
|
+
- State management.
|
|
266
|
+
- Business workflows.
|
|
267
|
+
- Data access.
|
|
268
|
+
- External integrations.
|
|
269
|
+
|
|
270
|
+
Prefer predictable state transitions.
|
|
271
|
+
|
|
272
|
+
Avoid unnecessary global state.
|
|
273
|
+
|
|
274
|
+
Define error, loading and empty states.
|
|
275
|
+
|
|
276
|
+
Design accessible, responsive interfaces.
|
|
277
|
+
|
|
278
|
+
Avoid excessive dependencies and duplicated UI logic.
|
|
279
|
+
|
|
280
|
+
Review performance implications of rendering and network usage.
|
|
281
|
+
|
|
282
|
+
## 12. Backend Architecture
|
|
283
|
+
|
|
284
|
+
Separate transport concerns from business rules where useful.
|
|
285
|
+
|
|
286
|
+
Define explicit service boundaries.
|
|
287
|
+
|
|
288
|
+
Use dependency injection when it improves testability and maintainability.
|
|
289
|
+
|
|
290
|
+
Validate authorization at trusted boundaries.
|
|
291
|
+
|
|
292
|
+
Apply controlled concurrency.
|
|
293
|
+
|
|
294
|
+
Use appropriate timeouts and cancellation.
|
|
295
|
+
|
|
296
|
+
Prevent unbounded resource usage.
|
|
297
|
+
|
|
298
|
+
Handle partial failures explicitly.
|
|
299
|
+
|
|
300
|
+
Use asynchronous processing where justified.
|
|
301
|
+
|
|
302
|
+
Avoid hidden side effects and uncontrolled background operations.
|
|
303
|
+
|
|
304
|
+
## 13. Data Architecture
|
|
305
|
+
|
|
306
|
+
Define authoritative data ownership.
|
|
307
|
+
|
|
308
|
+
Identify:
|
|
309
|
+
|
|
310
|
+
- Entities and relationships.
|
|
311
|
+
- Business invariants.
|
|
312
|
+
- Transaction boundaries.
|
|
313
|
+
- Data consistency requirements.
|
|
314
|
+
- Data access patterns.
|
|
315
|
+
- Indexing needs.
|
|
316
|
+
- Retention policies.
|
|
317
|
+
- Access controls.
|
|
318
|
+
- Backup requirements.
|
|
319
|
+
- Recovery requirements.
|
|
320
|
+
- Storage and transfer costs.
|
|
321
|
+
|
|
322
|
+
Prefer transactional consistency for critical business operations.
|
|
323
|
+
|
|
324
|
+
Use eventual consistency only where its trade-offs are understood and acceptable.
|
|
325
|
+
|
|
326
|
+
Document synchronization and reconciliation mechanisms.
|
|
327
|
+
|
|
328
|
+
## 14. Database Provider Independence
|
|
329
|
+
|
|
330
|
+
Support appropriate databases and services, including:
|
|
331
|
+
|
|
332
|
+
- PostgreSQL.
|
|
333
|
+
- Supabase.
|
|
334
|
+
- Firebase.
|
|
335
|
+
- Managed relational databases.
|
|
336
|
+
- Document databases.
|
|
337
|
+
- Search systems.
|
|
338
|
+
- Vector databases.
|
|
339
|
+
|
|
340
|
+
Choose technology according to requirements.
|
|
341
|
+
|
|
342
|
+
Do not introduce a new database simply because it is popular.
|
|
343
|
+
|
|
344
|
+
Use provider abstraction when portability, testing or risk reduction justifies it.
|
|
345
|
+
|
|
346
|
+
Avoid unnecessary abstraction for simple integrations.
|
|
347
|
+
|
|
348
|
+
Identify vendor lock-in risks and migration complexity.
|
|
349
|
+
|
|
350
|
+
## 15. External Service Integration
|
|
351
|
+
|
|
352
|
+
For external services such as:
|
|
353
|
+
|
|
354
|
+
- AI providers.
|
|
355
|
+
- Payment processors.
|
|
356
|
+
- Email and SMS services.
|
|
357
|
+
- Storage providers.
|
|
358
|
+
- Authentication services.
|
|
359
|
+
- Analytics platforms.
|
|
360
|
+
- Maps and geolocation providers.
|
|
361
|
+
|
|
362
|
+
Evaluate:
|
|
363
|
+
|
|
364
|
+
1. Business necessity.
|
|
365
|
+
2. Data exchanged.
|
|
366
|
+
3. Security and privacy.
|
|
367
|
+
4. Failure behavior.
|
|
368
|
+
5. Availability.
|
|
369
|
+
6. Latency.
|
|
370
|
+
7. Rate limits.
|
|
371
|
+
8. Pricing.
|
|
372
|
+
9. Vendor lock-in.
|
|
373
|
+
10. Alternatives.
|
|
374
|
+
11. Migration strategy.
|
|
375
|
+
|
|
376
|
+
Use stable integration boundaries.
|
|
377
|
+
|
|
378
|
+
Never expose privileged credentials to client applications.
|
|
379
|
+
|
|
380
|
+
## 16. AI System Architecture
|
|
381
|
+
|
|
382
|
+
For AI-powered applications:
|
|
383
|
+
|
|
384
|
+
- Separate business logic from model-provider integration.
|
|
385
|
+
- Define model responsibilities.
|
|
386
|
+
- Validate model inputs and outputs.
|
|
387
|
+
- Protect sensitive information.
|
|
388
|
+
- Restrict agent tool permissions.
|
|
389
|
+
- Treat external content as untrusted.
|
|
390
|
+
- Use retrieval where appropriate.
|
|
391
|
+
- Define human approval boundaries.
|
|
392
|
+
- Evaluate model quality using tests.
|
|
393
|
+
- Monitor latency, tokens and costs.
|
|
394
|
+
- Implement graceful fallback where justified.
|
|
395
|
+
|
|
396
|
+
Never allow unverified model output to directly perform high-impact operations without appropriate controls.
|
|
397
|
+
|
|
398
|
+
## 17. Event-Driven Architecture
|
|
399
|
+
|
|
400
|
+
Use events and messaging only when appropriate.
|
|
401
|
+
|
|
402
|
+
Evaluate:
|
|
403
|
+
|
|
404
|
+
- Event ownership.
|
|
405
|
+
- Delivery guarantees.
|
|
406
|
+
- Ordering requirements.
|
|
407
|
+
- Duplicate events.
|
|
408
|
+
- Idempotency.
|
|
409
|
+
- Retry behavior.
|
|
410
|
+
- Dead-letter handling.
|
|
411
|
+
- Failure recovery.
|
|
412
|
+
- Observability.
|
|
413
|
+
- Schema evolution.
|
|
414
|
+
|
|
415
|
+
Do not assume exactly-once processing without evidence.
|
|
416
|
+
|
|
417
|
+
Prefer simple synchronous interactions when sufficient.
|
|
418
|
+
|
|
419
|
+
## 18. Caching Architecture
|
|
420
|
+
|
|
421
|
+
Use caching when justified by measured or modeled workloads.
|
|
422
|
+
|
|
423
|
+
Define:
|
|
424
|
+
|
|
425
|
+
- Cache ownership.
|
|
426
|
+
- Time-to-live.
|
|
427
|
+
- Invalidation strategy.
|
|
428
|
+
- Consistency expectations.
|
|
429
|
+
- Security boundaries.
|
|
430
|
+
- Tenant isolation.
|
|
431
|
+
- Memory consumption.
|
|
432
|
+
- Cost impact.
|
|
433
|
+
- Failure handling.
|
|
434
|
+
|
|
435
|
+
Never use a shared cache in a way that exposes data between users or tenants.
|
|
436
|
+
|
|
437
|
+
Avoid caching sensitive information unnecessarily.
|
|
438
|
+
|
|
439
|
+
## 19. Reliability and Resilience
|
|
440
|
+
|
|
441
|
+
Design for foreseeable failures.
|
|
442
|
+
|
|
443
|
+
Evaluate:
|
|
444
|
+
|
|
445
|
+
- Service outages.
|
|
446
|
+
- Network failures.
|
|
447
|
+
- Database unavailability.
|
|
448
|
+
- Third-party API failures.
|
|
449
|
+
- Retry storms.
|
|
450
|
+
- Resource exhaustion.
|
|
451
|
+
- Partial transactions.
|
|
452
|
+
- Duplicate requests.
|
|
453
|
+
- Inconsistent external events.
|
|
454
|
+
|
|
455
|
+
Apply where appropriate:
|
|
456
|
+
|
|
457
|
+
- Timeouts.
|
|
458
|
+
- Bounded retries.
|
|
459
|
+
- Exponential backoff with jitter.
|
|
460
|
+
- Circuit breakers.
|
|
461
|
+
- Bulkheads.
|
|
462
|
+
- Graceful degradation.
|
|
463
|
+
- Health checks.
|
|
464
|
+
- Failover.
|
|
465
|
+
- Recovery procedures.
|
|
466
|
+
|
|
467
|
+
Avoid retry strategies that multiply costs or overload failing services.
|
|
468
|
+
|
|
469
|
+
## 20. Availability and Recovery
|
|
470
|
+
|
|
471
|
+
Define appropriate:
|
|
472
|
+
|
|
473
|
+
- Availability objectives.
|
|
474
|
+
- Service Level Objectives.
|
|
475
|
+
- Recovery Point Objectives.
|
|
476
|
+
- Recovery Time Objectives.
|
|
477
|
+
- Backup strategies.
|
|
478
|
+
- Restoration tests.
|
|
479
|
+
- Incident procedures.
|
|
480
|
+
|
|
481
|
+
Do not promise high availability without verified infrastructure and operational processes.
|
|
482
|
+
|
|
483
|
+
Multi-region architecture must be justified by requirements, risk and cost.
|
|
484
|
+
|
|
485
|
+
## 21. Observability
|
|
486
|
+
|
|
487
|
+
Design systems to provide relevant:
|
|
488
|
+
|
|
489
|
+
- Structured logs.
|
|
490
|
+
- Metrics.
|
|
491
|
+
- Distributed tracing.
|
|
492
|
+
- Error reporting.
|
|
493
|
+
- Health checks.
|
|
494
|
+
- Alerts.
|
|
495
|
+
- Resource utilization monitoring.
|
|
496
|
+
- Cost monitoring.
|
|
497
|
+
|
|
498
|
+
Avoid exposing secrets or unnecessary personal data.
|
|
499
|
+
|
|
500
|
+
Define actionable alerts.
|
|
501
|
+
|
|
502
|
+
Monitoring must support diagnosis rather than merely collecting large volumes of data.
|
|
503
|
+
|
|
504
|
+
## 22. Security Architecture
|
|
505
|
+
|
|
506
|
+
Identify trust boundaries.
|
|
507
|
+
|
|
508
|
+
Apply:
|
|
509
|
+
|
|
510
|
+
- Least privilege.
|
|
511
|
+
- Defense in depth.
|
|
512
|
+
- Secure defaults.
|
|
513
|
+
- Explicit authorization.
|
|
514
|
+
- Strong secret management.
|
|
515
|
+
- Network protection.
|
|
516
|
+
- Secure communication.
|
|
517
|
+
- Isolation of privileged operations.
|
|
518
|
+
- Threat modeling.
|
|
519
|
+
- Continuous verification.
|
|
520
|
+
|
|
521
|
+
Consult security.md for detailed requirements.
|
|
522
|
+
|
|
523
|
+
Never assume that authentication alone guarantees security.
|
|
524
|
+
|
|
525
|
+
## 23. Privacy Architecture
|
|
526
|
+
|
|
527
|
+
Apply data minimization and privacy-preserving defaults.
|
|
528
|
+
|
|
529
|
+
Document personal data flows.
|
|
530
|
+
|
|
531
|
+
Consider:
|
|
532
|
+
|
|
533
|
+
- Purpose limitation.
|
|
534
|
+
- Legal basis.
|
|
535
|
+
- Access control.
|
|
536
|
+
- Retention.
|
|
537
|
+
- Deletion.
|
|
538
|
+
- International transfers.
|
|
539
|
+
- Third-party processors.
|
|
540
|
+
- Individual rights.
|
|
541
|
+
- Sensitive information.
|
|
542
|
+
|
|
543
|
+
Consult privacy.md for detailed requirements.
|
|
544
|
+
|
|
545
|
+
## 24. Cost-Aware Architecture
|
|
546
|
+
|
|
547
|
+
For significant decisions, evaluate:
|
|
548
|
+
|
|
549
|
+
- Development complexity.
|
|
550
|
+
- Hosting and compute.
|
|
551
|
+
- Database capacity.
|
|
552
|
+
- Storage growth.
|
|
553
|
+
- Network and CDN usage.
|
|
554
|
+
- External API costs.
|
|
555
|
+
- AI inference costs.
|
|
556
|
+
- Monitoring costs.
|
|
557
|
+
- Operational staffing.
|
|
558
|
+
- Migration costs.
|
|
559
|
+
|
|
560
|
+
Estimate costs using verified prices and explicit assumptions.
|
|
561
|
+
|
|
562
|
+
Provide cost scenarios at different growth levels where relevant.
|
|
563
|
+
|
|
564
|
+
Prefer architectures that scale efficiently without unnecessary initial expense.
|
|
565
|
+
|
|
566
|
+
Never silently sacrifice security, reliability or correctness to reduce costs.
|
|
567
|
+
|
|
568
|
+
## 25. Architecture Decision Records
|
|
569
|
+
|
|
570
|
+
Record significant technical decisions using ADRs.
|
|
571
|
+
|
|
572
|
+
Each ADR should contain:
|
|
573
|
+
|
|
574
|
+
- Title.
|
|
575
|
+
- Status.
|
|
576
|
+
- Context.
|
|
577
|
+
- Decision.
|
|
578
|
+
- Alternatives considered.
|
|
579
|
+
- Benefits.
|
|
580
|
+
- Risks and trade-offs.
|
|
581
|
+
- Security implications.
|
|
582
|
+
- Data implications.
|
|
583
|
+
- Scalability implications.
|
|
584
|
+
- Cost implications.
|
|
585
|
+
- Consequences.
|
|
586
|
+
- Review conditions.
|
|
587
|
+
|
|
588
|
+
Do not rewrite historical ADRs to conceal previous decisions.
|
|
589
|
+
|
|
590
|
+
Supersede outdated decisions with new records.
|
|
591
|
+
|
|
592
|
+
## 26. Architecture Documentation
|
|
593
|
+
|
|
594
|
+
Maintain relevant documentation including:
|
|
595
|
+
|
|
596
|
+
- System context.
|
|
597
|
+
- Module boundaries.
|
|
598
|
+
- Component relationships.
|
|
599
|
+
- Data flows.
|
|
600
|
+
- Trust boundaries.
|
|
601
|
+
- API contracts.
|
|
602
|
+
- Deployment topology.
|
|
603
|
+
- Major external dependencies.
|
|
604
|
+
- Important operational assumptions.
|
|
605
|
+
|
|
606
|
+
Use diagrams when they improve understanding.
|
|
607
|
+
|
|
608
|
+
Documentation must reflect the actual implementation.
|
|
609
|
+
|
|
610
|
+
Do not invent architecture diagrams based on unverified assumptions.
|
|
611
|
+
|
|
612
|
+
## 27. Architecture Verification
|
|
613
|
+
|
|
614
|
+
Validate significant architecture changes using relevant:
|
|
615
|
+
|
|
616
|
+
- Unit tests.
|
|
617
|
+
- Integration tests.
|
|
618
|
+
- Contract tests.
|
|
619
|
+
- End-to-end tests.
|
|
620
|
+
- Security tests.
|
|
621
|
+
- Data integrity tests.
|
|
622
|
+
- Load tests.
|
|
623
|
+
- Performance measurements.
|
|
624
|
+
- Failure simulations.
|
|
625
|
+
- Infrastructure validation.
|
|
626
|
+
|
|
627
|
+
Report tests actually executed.
|
|
628
|
+
|
|
629
|
+
Distinguish measured results from expected behavior.
|
|
630
|
+
|
|
631
|
+
Never claim scalability or reliability without supporting evidence.
|
|
632
|
+
|
|
633
|
+
## 28. Existing Project Architecture Audits
|
|
634
|
+
|
|
635
|
+
For existing systems:
|
|
636
|
+
|
|
637
|
+
1. Inspect the actual repository.
|
|
638
|
+
2. Identify current modules and dependencies.
|
|
639
|
+
3. Map important business workflows.
|
|
640
|
+
4. Identify architectural strengths.
|
|
641
|
+
5. Identify confirmed weaknesses.
|
|
642
|
+
6. Evaluate security, data, cost and scaling implications.
|
|
643
|
+
7. Propose incremental improvements.
|
|
644
|
+
8. Estimate regression risk.
|
|
645
|
+
9. Define required tests.
|
|
646
|
+
10. Present a prioritized roadmap.
|
|
647
|
+
11. Wait for human approval.
|
|
648
|
+
|
|
649
|
+
Do not recommend a complete rewrite without extraordinary justification.
|
|
650
|
+
|
|
651
|
+
Protect existing working functionality.
|
|
652
|
+
|
|
653
|
+
## 29. Safe Architectural Evolution
|
|
654
|
+
|
|
655
|
+
Use incremental migration strategies.
|
|
656
|
+
|
|
657
|
+
Consider:
|
|
658
|
+
|
|
659
|
+
- Branch by Abstraction.
|
|
660
|
+
- Strangler Fig migration.
|
|
661
|
+
- Expand-Migrate-Contract.
|
|
662
|
+
- Feature flags.
|
|
663
|
+
- API versioning.
|
|
664
|
+
- Compatibility adapters.
|
|
665
|
+
- Staged rollout.
|
|
666
|
+
- Canary releases.
|
|
667
|
+
- Rollback procedures.
|
|
668
|
+
|
|
669
|
+
Select only techniques justified by the actual architecture.
|
|
670
|
+
|
|
671
|
+
Never change production data structures or critical interfaces without explicit approval.
|
|
672
|
+
|
|
673
|
+
## 30. Architectural Approval
|
|
674
|
+
|
|
675
|
+
Require explicit human approval before:
|
|
676
|
+
|
|
677
|
+
- Introducing major frameworks.
|
|
678
|
+
- Changing application-wide architecture.
|
|
679
|
+
- Introducing microservices.
|
|
680
|
+
- Changing database technology.
|
|
681
|
+
- Adding significant infrastructure.
|
|
682
|
+
- Breaking API contracts.
|
|
683
|
+
- Changing authentication or authorization architecture.
|
|
684
|
+
- Introducing material recurring costs.
|
|
685
|
+
- Making significant data-flow changes.
|
|
686
|
+
|
|
687
|
+
Explain alternatives, risks, costs and rollback options before approval.
|
|
688
|
+
|
|
689
|
+
## 31. Architecture Definition of Done
|
|
690
|
+
|
|
691
|
+
For significant architectural work:
|
|
692
|
+
|
|
693
|
+
- Requirements documented.
|
|
694
|
+
- Relevant architecture understood.
|
|
695
|
+
- Alternatives evaluated.
|
|
696
|
+
- Design approved.
|
|
697
|
+
- Data contracts verified.
|
|
698
|
+
- Security and privacy reviewed.
|
|
699
|
+
- Scalability implications assessed.
|
|
700
|
+
- Costs evaluated.
|
|
701
|
+
- Appropriate tests executed.
|
|
702
|
+
- Documentation updated.
|
|
703
|
+
- Regression risk evaluated.
|
|
704
|
+
- Remaining risks documented.
|
|
705
|
+
- Recovery strategy defined.
|
|
706
|
+
|
|
707
|
+
Do not declare an architectural change complete merely because code compiles.
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
## 31A. Cloud Architecture, Kubernetes and Infrastructure Portability
|
|
711
|
+
|
|
712
|
+
### Purpose
|
|
713
|
+
|
|
714
|
+
Design secure, resilient, scalable, maintainable and cost-efficient infrastructure architectures.
|
|
715
|
+
|
|
716
|
+
These requirements apply to applications running on:
|
|
717
|
+
|
|
718
|
+
- Amazon Web Services (AWS).
|
|
719
|
+
- Microsoft Azure.
|
|
720
|
+
- Google Cloud Platform (GCP).
|
|
721
|
+
- Other public cloud providers.
|
|
722
|
+
- Managed application platforms.
|
|
723
|
+
- Serverless environments.
|
|
724
|
+
- Container platforms.
|
|
725
|
+
- Kubernetes.
|
|
726
|
+
- Hybrid infrastructure.
|
|
727
|
+
- On-premises infrastructure.
|
|
728
|
+
- Self-hosted environments.
|
|
729
|
+
|
|
730
|
+
No infrastructure provider or orchestration platform is mandatory by default.
|
|
731
|
+
|
|
732
|
+
Always inspect existing infrastructure before recommending changes.
|
|
733
|
+
|
|
734
|
+
### Cloud Architecture Principles
|
|
735
|
+
|
|
736
|
+
Apply the following principles:
|
|
737
|
+
|
|
738
|
+
- Security by Design.
|
|
739
|
+
- Least Privilege.
|
|
740
|
+
- Infrastructure as Code where appropriate.
|
|
741
|
+
- High Availability according to business requirements.
|
|
742
|
+
- Fault Isolation.
|
|
743
|
+
- Observability by Design.
|
|
744
|
+
- Cost-Aware Architecture.
|
|
745
|
+
- Automated and controlled deployments.
|
|
746
|
+
- Backup and Disaster Recovery.
|
|
747
|
+
- Measurable Scalability.
|
|
748
|
+
- Provider Portability where justified.
|
|
749
|
+
|
|
750
|
+
Do not introduce unnecessary infrastructure complexity.
|
|
751
|
+
|
|
752
|
+
### Provider Independence
|
|
753
|
+
|
|
754
|
+
Evaluate AWS, Azure, GCP and other providers according to actual requirements.
|
|
755
|
+
|
|
756
|
+
Consider:
|
|
757
|
+
|
|
758
|
+
1. Existing infrastructure and dependencies.
|
|
759
|
+
2. Technical compatibility.
|
|
760
|
+
3. Security and regulatory requirements.
|
|
761
|
+
4. Expected workload and traffic.
|
|
762
|
+
5. Geographic availability and latency.
|
|
763
|
+
6. Service reliability.
|
|
764
|
+
7. Operational capabilities.
|
|
765
|
+
8. Scalability requirements.
|
|
766
|
+
9. Total cost of ownership.
|
|
767
|
+
10. Vendor lock-in and migration complexity.
|
|
768
|
+
|
|
769
|
+
Do not assume equivalent services across providers have identical behavior, security guarantees, reliability or pricing.
|
|
770
|
+
|
|
771
|
+
Preserve existing infrastructure when it meets verified requirements.
|
|
772
|
+
|
|
773
|
+
Do not recommend multi-cloud deployments without justified business, resilience or regulatory needs.
|
|
774
|
+
|
|
775
|
+
### Kubernetes Adoption
|
|
776
|
+
|
|
777
|
+
Kubernetes is an optional container orchestration platform.
|
|
778
|
+
|
|
779
|
+
It must never be treated as mandatory solely because an application targets millions of users.
|
|
780
|
+
|
|
781
|
+
Before recommending Kubernetes, compare it with:
|
|
782
|
+
|
|
783
|
+
- Modular monolith deployments.
|
|
784
|
+
- Managed application platforms.
|
|
785
|
+
- Serverless functions.
|
|
786
|
+
- Managed containers.
|
|
787
|
+
- Virtual machines.
|
|
788
|
+
- Simpler hosting architectures.
|
|
789
|
+
|
|
790
|
+
Consider Kubernetes when requirements justify:
|
|
791
|
+
|
|
792
|
+
- Independent workload scaling.
|
|
793
|
+
- Complex container orchestration.
|
|
794
|
+
- Controlled deployment strategies.
|
|
795
|
+
- Workload isolation.
|
|
796
|
+
- Specialized scheduling.
|
|
797
|
+
- Operational standardization.
|
|
798
|
+
- High availability.
|
|
799
|
+
- Multiple independently managed services.
|
|
800
|
+
|
|
801
|
+
Evaluate the operational complexity and additional costs.
|
|
802
|
+
|
|
803
|
+
Never introduce Kubernetes without a documented architectural decision and explicit human approval.
|
|
804
|
+
|
|
805
|
+
### Kubernetes Platforms
|
|
806
|
+
|
|
807
|
+
Support relevant environments, including:
|
|
808
|
+
|
|
809
|
+
- Amazon Elastic Kubernetes Service (EKS).
|
|
810
|
+
- Azure Kubernetes Service (AKS).
|
|
811
|
+
- Google Kubernetes Engine (GKE).
|
|
812
|
+
- Other managed Kubernetes platforms.
|
|
813
|
+
- Self-managed Kubernetes.
|
|
814
|
+
- Hybrid and on-premises Kubernetes.
|
|
815
|
+
|
|
816
|
+
Verify current provider capabilities and limitations.
|
|
817
|
+
|
|
818
|
+
### Kubernetes Application Architecture
|
|
819
|
+
|
|
820
|
+
When Kubernetes is already used or explicitly approved, evaluate:
|
|
821
|
+
|
|
822
|
+
- Workload boundaries.
|
|
823
|
+
- Deployments and StatefulSets.
|
|
824
|
+
- Services and network routing.
|
|
825
|
+
- Ingress or Gateway API configurations.
|
|
826
|
+
- Namespace design.
|
|
827
|
+
- Service accounts.
|
|
828
|
+
- RBAC.
|
|
829
|
+
- NetworkPolicies.
|
|
830
|
+
- Workload identity.
|
|
831
|
+
- Secrets management.
|
|
832
|
+
- Pod security controls.
|
|
833
|
+
- Resource requests and limits.
|
|
834
|
+
- Health and readiness probes.
|
|
835
|
+
- Horizontal and vertical scaling.
|
|
836
|
+
- Node scaling.
|
|
837
|
+
- Pod disruption budgets.
|
|
838
|
+
- Rolling deployments.
|
|
839
|
+
- Observability.
|
|
840
|
+
- Backup and recovery.
|
|
841
|
+
|
|
842
|
+
Use only the Kubernetes components justified by actual requirements.
|
|
843
|
+
|
|
844
|
+
### Kubernetes Security
|
|
845
|
+
|
|
846
|
+
Apply Defense in Depth and Least Privilege.
|
|
847
|
+
|
|
848
|
+
Evaluate:
|
|
849
|
+
|
|
850
|
+
- Cluster access permissions.
|
|
851
|
+
- Workload identity.
|
|
852
|
+
- Service account privileges.
|
|
853
|
+
- Network isolation.
|
|
854
|
+
- Container image provenance.
|
|
855
|
+
- Image vulnerability scanning.
|
|
856
|
+
- Secrets management.
|
|
857
|
+
- Admission controls and policy enforcement.
|
|
858
|
+
- Privileged containers.
|
|
859
|
+
- Host filesystem access.
|
|
860
|
+
- Administrative access.
|
|
861
|
+
- Supply-chain security.
|
|
862
|
+
- Audit logging.
|
|
863
|
+
|
|
864
|
+
Never give application workloads unrestricted cluster administration privileges.
|
|
865
|
+
|
|
866
|
+
Never embed privileged credentials in container images.
|
|
867
|
+
|
|
868
|
+
Do not assume namespaces alone provide complete security isolation.
|
|
869
|
+
|
|
870
|
+
### Data and Stateful Services
|
|
871
|
+
|
|
872
|
+
Evaluate managed database services before hosting databases inside Kubernetes.
|
|
873
|
+
|
|
874
|
+
Consider:
|
|
875
|
+
|
|
876
|
+
- Persistence requirements.
|
|
877
|
+
- Database availability.
|
|
878
|
+
- Storage performance.
|
|
879
|
+
- Backup and restoration.
|
|
880
|
+
- Replication.
|
|
881
|
+
- Data consistency.
|
|
882
|
+
- Recovery objectives.
|
|
883
|
+
- Operational maintenance.
|
|
884
|
+
- Cost implications.
|
|
885
|
+
|
|
886
|
+
Kubernetes does not automatically guarantee database consistency, backups or disaster recovery.
|
|
887
|
+
|
|
888
|
+
Detailed data requirements are defined in docs/data.md.
|
|
889
|
+
|
|
890
|
+
### Scalability and Reliability
|
|
891
|
+
|
|
892
|
+
Define measurable requirements for:
|
|
893
|
+
|
|
894
|
+
- Peak requests per second.
|
|
895
|
+
- Concurrent users.
|
|
896
|
+
- Response latency.
|
|
897
|
+
- Resource utilization.
|
|
898
|
+
- Error rates.
|
|
899
|
+
- Availability.
|
|
900
|
+
- Recovery objectives.
|
|
901
|
+
- Autoscaling behavior.
|
|
902
|
+
|
|
903
|
+
Do not assume autoscaling solves database bottlenecks, inefficient code or external API limitations.
|
|
904
|
+
|
|
905
|
+
Validate scaling behavior through appropriate testing.
|
|
906
|
+
|
|
907
|
+
Detailed capacity and autoscaling requirements belong in docs/scalability.md.
|
|
908
|
+
|
|
909
|
+
### Cloud and Kubernetes Costs
|
|
910
|
+
|
|
911
|
+
Evaluate:
|
|
912
|
+
|
|
913
|
+
- Compute and worker nodes.
|
|
914
|
+
- Control plane charges.
|
|
915
|
+
- Persistent storage.
|
|
916
|
+
- Network traffic and egress.
|
|
917
|
+
- Load balancers.
|
|
918
|
+
- Cross-zone and cross-region traffic.
|
|
919
|
+
- Monitoring and logging.
|
|
920
|
+
- Backup and recovery.
|
|
921
|
+
- Managed service charges.
|
|
922
|
+
- Operational maintenance.
|
|
923
|
+
|
|
924
|
+
Consider simpler alternatives when they provide equal or better value.
|
|
925
|
+
|
|
926
|
+
Detailed financial modeling belongs in docs/cost-engineering.md.
|
|
927
|
+
|
|
928
|
+
### Infrastructure as Code
|
|
929
|
+
|
|
930
|
+
Where appropriate, use version-controlled infrastructure definitions.
|
|
931
|
+
|
|
932
|
+
Evaluate tools such as:
|
|
933
|
+
|
|
934
|
+
- Terraform or OpenTofu.
|
|
935
|
+
- Cloud-native infrastructure templates.
|
|
936
|
+
- Kubernetes manifests.
|
|
937
|
+
- Helm.
|
|
938
|
+
- GitOps deployment tools.
|
|
939
|
+
|
|
940
|
+
Select tools according to existing project conventions.
|
|
941
|
+
|
|
942
|
+
Do not introduce new infrastructure tooling without justification.
|
|
943
|
+
|
|
944
|
+
Never include production secrets in infrastructure source files.
|
|
945
|
+
|
|
946
|
+
### Deployment and Recovery
|
|
947
|
+
|
|
948
|
+
Before significant infrastructure changes:
|
|
949
|
+
|
|
950
|
+
1. Inspect the current environment.
|
|
951
|
+
2. Identify affected services.
|
|
952
|
+
3. Assess data integrity and availability risks.
|
|
953
|
+
4. Review security implications.
|
|
954
|
+
5. Evaluate operating costs.
|
|
955
|
+
6. Validate proposed configurations.
|
|
956
|
+
7. Test changes in an appropriate environment.
|
|
957
|
+
8. Define rollout and rollback procedures.
|
|
958
|
+
9. Document expected impact.
|
|
959
|
+
10. Obtain explicit human approval.
|
|
960
|
+
|
|
961
|
+
Never automatically modify production infrastructure.
|
|
962
|
+
|
|
963
|
+
### Architecture Decision Requirements
|
|
964
|
+
|
|
965
|
+
Record significant infrastructure decisions using ADRs.
|
|
966
|
+
|
|
967
|
+
Document:
|
|
968
|
+
|
|
969
|
+
- Why the technology is required.
|
|
970
|
+
- Alternatives considered.
|
|
971
|
+
- Security implications.
|
|
972
|
+
- Scalability benefits.
|
|
973
|
+
- Availability implications.
|
|
974
|
+
- Operational complexity.
|
|
975
|
+
- Expected costs.
|
|
976
|
+
- Migration risks.
|
|
977
|
+
- Review conditions.
|
|
978
|
+
|
|
979
|
+
### Final Principle
|
|
980
|
+
|
|
981
|
+
Cloud-agnostic by design where practical.
|
|
982
|
+
Provider-neutral by default.
|
|
983
|
+
Kubernetes only when justified.
|
|
984
|
+
Design for millions of users.
|
|
985
|
+
Provision for actual demand.
|
|
986
|
+
Protect security and data integrity.
|
|
987
|
+
Measure performance and costs.
|
|
988
|
+
Preserve working production systems.
|
|
989
|
+
Require approval for significant infrastructure changes.
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
## 32. Final Architecture Principles
|
|
993
|
+
|
|
994
|
+
Architecture first.
|
|
995
|
+
Understand before changing.
|
|
996
|
+
Prefer simplicity over unnecessary complexity.
|
|
997
|
+
Protect domain boundaries.
|
|
998
|
+
Minimize coupling.
|
|
999
|
+
Design explicit contracts.
|
|
1000
|
+
Preserve existing behavior.
|
|
1001
|
+
Plan for millions of users.
|
|
1002
|
+
Scale based on evidence.
|
|
1003
|
+
Protect security and data integrity.
|
|
1004
|
+
Measure performance and operational costs.
|
|
1005
|
+
Document important decisions.
|
|
1006
|
+
Validate before release.
|
|
1007
|
+
Require approval before significant changes.
|