omgkit 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin/skills/databases/mongodb/SKILL.md +60 -776
- package/plugin/skills/databases/prisma/SKILL.md +53 -744
- package/plugin/skills/databases/redis/SKILL.md +53 -860
- package/plugin/skills/devops/aws/SKILL.md +68 -672
- package/plugin/skills/devops/github-actions/SKILL.md +54 -657
- package/plugin/skills/devops/kubernetes/SKILL.md +67 -602
- package/plugin/skills/devops/performance-profiling/SKILL.md +59 -863
- package/plugin/skills/frameworks/django/SKILL.md +87 -853
- package/plugin/skills/frameworks/express/SKILL.md +95 -1301
- package/plugin/skills/frameworks/fastapi/SKILL.md +90 -1198
- package/plugin/skills/frameworks/laravel/SKILL.md +87 -1187
- package/plugin/skills/frameworks/nestjs/SKILL.md +106 -973
- package/plugin/skills/frameworks/react/SKILL.md +94 -962
- package/plugin/skills/frameworks/vue/SKILL.md +95 -1242
- package/plugin/skills/frontend/accessibility/SKILL.md +91 -1056
- package/plugin/skills/frontend/frontend-design/SKILL.md +69 -1262
- package/plugin/skills/frontend/responsive/SKILL.md +76 -799
- package/plugin/skills/frontend/shadcn-ui/SKILL.md +73 -921
- package/plugin/skills/frontend/tailwindcss/SKILL.md +60 -788
- package/plugin/skills/frontend/threejs/SKILL.md +72 -1266
- package/plugin/skills/languages/javascript/SKILL.md +106 -849
- package/plugin/skills/methodology/brainstorming/SKILL.md +70 -576
- package/plugin/skills/methodology/defense-in-depth/SKILL.md +79 -831
- package/plugin/skills/methodology/dispatching-parallel-agents/SKILL.md +81 -654
- package/plugin/skills/methodology/executing-plans/SKILL.md +86 -529
- package/plugin/skills/methodology/finishing-development-branch/SKILL.md +95 -586
- package/plugin/skills/methodology/problem-solving/SKILL.md +67 -681
- package/plugin/skills/methodology/receiving-code-review/SKILL.md +70 -533
- package/plugin/skills/methodology/requesting-code-review/SKILL.md +70 -610
- package/plugin/skills/methodology/root-cause-tracing/SKILL.md +70 -646
- package/plugin/skills/methodology/sequential-thinking/SKILL.md +70 -478
- package/plugin/skills/methodology/systematic-debugging/SKILL.md +66 -559
- package/plugin/skills/methodology/test-driven-development/SKILL.md +91 -752
- package/plugin/skills/methodology/testing-anti-patterns/SKILL.md +78 -687
- package/plugin/skills/methodology/token-optimization/SKILL.md +72 -602
- package/plugin/skills/methodology/verification-before-completion/SKILL.md +108 -529
- package/plugin/skills/methodology/writing-plans/SKILL.md +79 -566
- package/plugin/skills/omega/omega-architecture/SKILL.md +91 -752
- package/plugin/skills/omega/omega-coding/SKILL.md +161 -552
- package/plugin/skills/omega/omega-sprint/SKILL.md +132 -777
- package/plugin/skills/omega/omega-testing/SKILL.md +157 -845
- package/plugin/skills/omega/omega-thinking/SKILL.md +165 -606
- package/plugin/skills/security/better-auth/SKILL.md +46 -1034
- package/plugin/skills/security/oauth/SKILL.md +80 -934
- package/plugin/skills/security/owasp/SKILL.md +78 -862
- package/plugin/skills/testing/playwright/SKILL.md +77 -700
- package/plugin/skills/testing/pytest/SKILL.md +73 -811
- package/plugin/skills/testing/vitest/SKILL.md +60 -920
- package/plugin/skills/tools/document-processing/SKILL.md +111 -838
- package/plugin/skills/tools/image-processing/SKILL.md +126 -659
- package/plugin/skills/tools/mcp-development/SKILL.md +85 -758
- package/plugin/skills/tools/media-processing/SKILL.md +118 -735
- package/plugin/stdrules/SKILL_STANDARDS.md +490 -0
- package/plugin/skills/SKILL_STANDARDS.md +0 -743
|
@@ -1,113 +1,71 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: omega-
|
|
3
|
-
description:
|
|
2
|
+
name: architecting-omega-systems
|
|
3
|
+
description: Designs scalable, resilient architectures using the 7 Omega principles. Use when building systems that need to scale to millions of users or designing platform-level infrastructure.
|
|
4
4
|
category: omega
|
|
5
5
|
triggers:
|
|
6
6
|
- omega architecture
|
|
7
7
|
- system design
|
|
8
8
|
- scalable architecture
|
|
9
9
|
- distributed systems
|
|
10
|
-
- microservices design
|
|
11
|
-
- platform architecture
|
|
12
|
-
- infrastructure design
|
|
13
10
|
---
|
|
14
11
|
|
|
15
|
-
# Omega
|
|
12
|
+
# Architecting Omega Systems
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
Build **scalable, resilient, and future-proof systems** following the 7 Omega Principles for platform-grade architecture.
|
|
18
15
|
|
|
19
|
-
##
|
|
16
|
+
## Quick Start
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
```yaml
|
|
19
|
+
# 1. Define architectural requirements
|
|
20
|
+
Architecture:
|
|
21
|
+
Name: "E-commerce Platform"
|
|
22
|
+
Scale: "1M+ concurrent users"
|
|
23
|
+
Principles: [leverage, abstraction, agentic, antifragile]
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
25
|
+
# 2. Apply Omega decision framework
|
|
26
|
+
Decision:
|
|
27
|
+
Question: "Monolith or microservices?"
|
|
28
|
+
Omega_Check:
|
|
29
|
+
- Leverage: "Does this multiply capability?"
|
|
30
|
+
- Scale: "Zero-marginal-cost at 1000x?"
|
|
31
|
+
- Resilience: "Self-healing under stress?"
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
# 3. Design with antifragility
|
|
34
|
+
Pattern: Event-Driven + Circuit Breakers + Auto-Scaling
|
|
35
|
+
```
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
## Features
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
│ → Every component should be a force multiplier │
|
|
45
|
-
│ │
|
|
46
|
-
│ Ω2. TRANSCENDENT ABSTRACTION │
|
|
47
|
-
│ → Solve classes of problems, not individual instances │
|
|
48
|
-
│ → Build frameworks that spawn solutions │
|
|
49
|
-
│ │
|
|
50
|
-
│ Ω3. AGENTIC DECOMPOSITION │
|
|
51
|
-
│ → Autonomous components with clear boundaries │
|
|
52
|
-
│ → Self-managing, self-healing subsystems │
|
|
53
|
-
│ │
|
|
54
|
-
│ Ω4. RECURSIVE IMPROVEMENT │
|
|
55
|
-
│ → Systems that optimize themselves over time │
|
|
56
|
-
│ → Feedback loops that compound improvements │
|
|
57
|
-
│ │
|
|
58
|
-
│ Ω5. ZERO-MARGINAL-COST SCALING │
|
|
59
|
-
│ → No additional cost per user/request at scale │
|
|
60
|
-
│ → Platform economics, not service economics │
|
|
61
|
-
│ │
|
|
62
|
-
│ Ω6. ANTIFRAGILE DESIGN │
|
|
63
|
-
│ → Systems that grow stronger under stress │
|
|
64
|
-
│ → Chaos becomes catalyst for improvement │
|
|
65
|
-
│ │
|
|
66
|
-
│ Ω7. COMPOSABLE PRIMITIVES │
|
|
67
|
-
│ → Lego-block components that combine infinitely │
|
|
68
|
-
│ → New capabilities emerge from composition │
|
|
69
|
-
│ │
|
|
70
|
-
└─────────────────────────────────────────────────────────────────────────┘
|
|
71
|
-
```
|
|
39
|
+
| Feature | Description | Guide |
|
|
40
|
+
|---------|-------------|-------|
|
|
41
|
+
| 7 Omega Principles | Core architectural tenets for scalable systems | Apply all 7 to every decision |
|
|
42
|
+
| Leverage Architecture | Systems that amplify effort, not add to it | Build frameworks, not features |
|
|
43
|
+
| Agentic Services | Autonomous, self-healing microservices | Circuit breakers + health monitors |
|
|
44
|
+
| Zero-Marginal-Cost | Platform economics at scale | Edge compute + aggressive caching |
|
|
45
|
+
| Event-Driven Design | Loose coupling via event bus | Kafka/Redis streams + sagas |
|
|
46
|
+
| Antifragile Patterns | Systems that strengthen under stress | Chaos engineering + adaptive config |
|
|
47
|
+
| Decision Framework | Systematic architecture evaluation | Omega checklist for every choice |
|
|
72
48
|
|
|
73
|
-
|
|
49
|
+
## Common Patterns
|
|
74
50
|
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Leverage Multiplication: Build systems, not features
|
|
78
|
-
* Every architectural decision should multiply capability
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
// ❌ Linear Architecture (effort grows with features)
|
|
82
|
-
class LinearApproach {
|
|
83
|
-
createUser() { /* specific implementation */ }
|
|
84
|
-
createProduct() { /* specific implementation */ }
|
|
85
|
-
createOrder() { /* specific implementation */ }
|
|
86
|
-
// Each new entity = new implementation = linear growth
|
|
87
|
-
}
|
|
51
|
+
### The 7 Omega Principles
|
|
88
52
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
53
|
+
```
|
|
54
|
+
1. LEVERAGE MULTIPLICATION - Build systems that amplify effort
|
|
55
|
+
2. TRANSCENDENT ABSTRACTION - Solve classes of problems
|
|
56
|
+
3. AGENTIC DECOMPOSITION - Autonomous, self-managing services
|
|
57
|
+
4. RECURSIVE IMPROVEMENT - Systems that optimize themselves
|
|
58
|
+
5. ZERO-MARGINAL-COST - No cost per user at scale
|
|
59
|
+
6. ANTIFRAGILE DESIGN - Grow stronger under stress
|
|
60
|
+
7. COMPOSABLE PRIMITIVES - Lego blocks that combine infinitely
|
|
61
|
+
```
|
|
96
62
|
|
|
97
|
-
|
|
98
|
-
createdAt: Date;
|
|
99
|
-
updatedAt: Date;
|
|
100
|
-
version: number;
|
|
101
|
-
audit: AuditTrail[];
|
|
102
|
-
}
|
|
63
|
+
### Leverage Architecture Pattern
|
|
103
64
|
|
|
65
|
+
```typescript
|
|
66
|
+
// ONE implementation handles ALL entity types
|
|
104
67
|
class LeveragedEntitySystem {
|
|
105
|
-
|
|
106
|
-
private hooks: Map<string, Hook[]>;
|
|
107
|
-
private storage: UnifiedStorage;
|
|
108
|
-
|
|
109
|
-
async create<T extends Entity>(type: string, data: T): Promise<T> {
|
|
110
|
-
// One implementation handles ALL entity types
|
|
68
|
+
async create<T>(type: string, data: T): Promise<T> {
|
|
111
69
|
const validated = await this.validators.get(type)?.validate(data);
|
|
112
70
|
await this.runHooks(type, 'beforeCreate', validated);
|
|
113
71
|
const result = await this.storage.create(type, validated);
|
|
@@ -115,50 +73,17 @@ class LeveragedEntitySystem {
|
|
|
115
73
|
return result as T;
|
|
116
74
|
}
|
|
117
75
|
|
|
118
|
-
//
|
|
76
|
+
// New entity = configuration, not code
|
|
119
77
|
registerEntityType(type: string, config: EntityConfig): void {
|
|
120
78
|
this.validators.set(type, createValidator(config.schema));
|
|
121
|
-
this.hooks.set(type, config.hooks);
|
|
122
79
|
}
|
|
123
80
|
}
|
|
124
|
-
|
|
125
|
-
// Now ANY new entity is just configuration:
|
|
126
|
-
entitySystem.registerEntityType('user', {
|
|
127
|
-
schema: userSchema,
|
|
128
|
-
hooks: [auditHook, notificationHook]
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
entitySystem.registerEntityType('product', {
|
|
132
|
-
schema: productSchema,
|
|
133
|
-
hooks: [inventoryHook, searchIndexHook]
|
|
134
|
-
});
|
|
135
81
|
```
|
|
136
82
|
|
|
137
|
-
###
|
|
83
|
+
### Agentic Service Pattern
|
|
138
84
|
|
|
139
85
|
```typescript
|
|
140
|
-
|
|
141
|
-
* Agentic Decomposition: Autonomous, self-managing services
|
|
142
|
-
* Each service operates independently with clear contracts
|
|
143
|
-
*/
|
|
144
|
-
|
|
145
|
-
// Service Contract Definition
|
|
146
|
-
interface ServiceContract {
|
|
147
|
-
name: string;
|
|
148
|
-
version: string;
|
|
149
|
-
capabilities: string[];
|
|
150
|
-
dependencies: ServiceDependency[];
|
|
151
|
-
healthCheck: () => Promise<HealthStatus>;
|
|
152
|
-
metrics: () => MetricsSnapshot;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Self-Healing Service Base
|
|
156
|
-
abstract class AgenticService implements ServiceContract {
|
|
157
|
-
abstract name: string;
|
|
158
|
-
abstract version: string;
|
|
159
|
-
abstract capabilities: string[];
|
|
160
|
-
dependencies: ServiceDependency[] = [];
|
|
161
|
-
|
|
86
|
+
abstract class AgenticService {
|
|
162
87
|
private circuitBreaker: CircuitBreaker;
|
|
163
88
|
private healthMonitor: HealthMonitor;
|
|
164
89
|
private autoScaler: AutoScaler;
|
|
@@ -166,24 +91,14 @@ abstract class AgenticService implements ServiceContract {
|
|
|
166
91
|
constructor() {
|
|
167
92
|
// Self-monitoring
|
|
168
93
|
this.healthMonitor = new HealthMonitor({
|
|
169
|
-
checkInterval: 5000,
|
|
170
94
|
onUnhealthy: () => this.selfHeal()
|
|
171
95
|
});
|
|
172
96
|
|
|
173
97
|
// Self-protecting
|
|
174
98
|
this.circuitBreaker = new CircuitBreaker({
|
|
175
99
|
failureThreshold: 5,
|
|
176
|
-
resetTimeout: 30000,
|
|
177
100
|
onOpen: () => this.notifyDegradation()
|
|
178
101
|
});
|
|
179
|
-
|
|
180
|
-
// Self-scaling
|
|
181
|
-
this.autoScaler = new AutoScaler({
|
|
182
|
-
minInstances: 2,
|
|
183
|
-
maxInstances: 100,
|
|
184
|
-
targetCPU: 70,
|
|
185
|
-
targetMemory: 80
|
|
186
|
-
});
|
|
187
102
|
}
|
|
188
103
|
|
|
189
104
|
protected async executeWithResilience<T>(
|
|
@@ -192,667 +107,91 @@ abstract class AgenticService implements ServiceContract {
|
|
|
192
107
|
): Promise<T> {
|
|
193
108
|
return this.circuitBreaker.execute(operation, fallback);
|
|
194
109
|
}
|
|
195
|
-
|
|
196
|
-
private async selfHeal(): Promise<void> {
|
|
197
|
-
console.log(`[${this.name}] Self-healing initiated`);
|
|
198
|
-
await this.clearCaches();
|
|
199
|
-
await this.reconnectDependencies();
|
|
200
|
-
await this.reloadConfiguration();
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
async healthCheck(): Promise<HealthStatus> {
|
|
204
|
-
const dependencyHealth = await Promise.all(
|
|
205
|
-
this.dependencies.map(dep => dep.checkHealth())
|
|
206
|
-
);
|
|
207
|
-
|
|
208
|
-
return {
|
|
209
|
-
service: this.name,
|
|
210
|
-
status: dependencyHealth.every(h => h.healthy) ? 'healthy' : 'degraded',
|
|
211
|
-
dependencies: dependencyHealth,
|
|
212
|
-
metrics: this.metrics()
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
abstract metrics(): MetricsSnapshot;
|
|
217
|
-
protected abstract clearCaches(): Promise<void>;
|
|
218
|
-
protected abstract reconnectDependencies(): Promise<void>;
|
|
219
|
-
protected abstract reloadConfiguration(): Promise<void>;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
// Example: Autonomous Order Service
|
|
223
|
-
class OrderService extends AgenticService {
|
|
224
|
-
name = 'order-service';
|
|
225
|
-
version = '2.1.0';
|
|
226
|
-
capabilities = ['create-order', 'process-payment', 'track-fulfillment'];
|
|
227
|
-
|
|
228
|
-
async createOrder(request: CreateOrderRequest): Promise<Order> {
|
|
229
|
-
return this.executeWithResilience(
|
|
230
|
-
async () => {
|
|
231
|
-
const validated = await this.validateOrder(request);
|
|
232
|
-
const order = await this.persistOrder(validated);
|
|
233
|
-
await this.emitEvent('order.created', order);
|
|
234
|
-
return order;
|
|
235
|
-
},
|
|
236
|
-
() => this.queueForRetry(request) // Fallback: queue for later
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
110
|
}
|
|
240
111
|
```
|
|
241
112
|
|
|
242
|
-
###
|
|
113
|
+
### Zero-Marginal-Cost Pattern
|
|
243
114
|
|
|
244
115
|
```typescript
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
// Platform Architecture Blueprint
|
|
251
|
-
interface PlatformArchitecture {
|
|
252
|
-
// Compute: Serverless (pay per execution, not capacity)
|
|
253
|
-
compute: ServerlessConfig;
|
|
254
|
-
|
|
255
|
-
// Storage: Object storage with CDN (infinite scale, usage-based)
|
|
256
|
-
storage: EdgeStorageConfig;
|
|
257
|
-
|
|
258
|
-
// Data: Distributed with automatic sharding
|
|
259
|
-
database: DistributedDBConfig;
|
|
260
|
-
|
|
261
|
-
// Caching: Edge caching eliminates repeated computation
|
|
262
|
-
cache: EdgeCacheConfig;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
const platformConfig: PlatformArchitecture = {
|
|
266
|
-
compute: {
|
|
267
|
-
provider: 'cloudflare-workers',
|
|
268
|
-
// Runs at the edge - 0ms cold start
|
|
269
|
-
// Pay per request, not per hour
|
|
270
|
-
pricing: 'per-invocation',
|
|
271
|
-
limits: {
|
|
272
|
-
cpuTime: '50ms',
|
|
273
|
-
memory: '128MB'
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
storage: {
|
|
278
|
-
provider: 'r2', // S3-compatible, zero egress fees
|
|
279
|
-
cdn: {
|
|
280
|
-
enabled: true,
|
|
281
|
-
ttl: '1y', // Immutable assets cached forever
|
|
282
|
-
purgeOnDeploy: true
|
|
283
|
-
}
|
|
284
|
-
},
|
|
285
|
-
|
|
286
|
-
database: {
|
|
287
|
-
provider: 'planetscale', // MySQL-compatible, auto-sharding
|
|
288
|
-
// Or: cockroachdb, vitess, yugabyte
|
|
289
|
-
sharding: 'automatic',
|
|
290
|
-
replicas: {
|
|
291
|
-
read: 'multi-region',
|
|
292
|
-
write: 'primary-with-failover'
|
|
293
|
-
}
|
|
294
|
-
},
|
|
295
|
-
|
|
116
|
+
// Edge-first architecture
|
|
117
|
+
const platformConfig = {
|
|
118
|
+
compute: { provider: 'cloudflare-workers', pricing: 'per-invocation' },
|
|
119
|
+
storage: { provider: 'r2', cdn: { enabled: true, ttl: '1y' } },
|
|
120
|
+
database: { provider: 'planetscale', sharding: 'automatic' },
|
|
296
121
|
cache: {
|
|
297
122
|
layers: [
|
|
298
123
|
{ type: 'browser', ttl: '1h' },
|
|
299
124
|
{ type: 'cdn-edge', ttl: '24h' },
|
|
300
|
-
{ type: 'regional', ttl: '1h' },
|
|
301
125
|
{ type: 'origin', ttl: '5m' }
|
|
302
126
|
]
|
|
303
127
|
}
|
|
304
128
|
};
|
|
305
|
-
|
|
306
|
-
// Implementation: Compute moves to data, not vice versa
|
|
307
|
-
class ZeroMarginalCostAPI {
|
|
308
|
-
// Edge function - runs in 300+ locations worldwide
|
|
309
|
-
async handleRequest(request: Request): Promise<Response> {
|
|
310
|
-
const cacheKey = this.generateCacheKey(request);
|
|
311
|
-
|
|
312
|
-
// Layer 1: Edge cache (0 compute cost)
|
|
313
|
-
const cached = await this.edgeCache.get(cacheKey);
|
|
314
|
-
if (cached) return cached;
|
|
315
|
-
|
|
316
|
-
// Layer 2: Regional compute (minimal latency)
|
|
317
|
-
const result = await this.processAtEdge(request);
|
|
318
|
-
|
|
319
|
-
// Cache for future requests (amortize cost)
|
|
320
|
-
await this.edgeCache.set(cacheKey, result, { ttl: 3600 });
|
|
321
|
-
|
|
322
|
-
return result;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
private async processAtEdge(request: Request): Promise<Response> {
|
|
326
|
-
// Use read replicas closest to user
|
|
327
|
-
const db = this.getRegionalReplica(request.cf?.colo);
|
|
328
|
-
|
|
329
|
-
// Streaming response - start sending immediately
|
|
330
|
-
const stream = new TransformStream();
|
|
331
|
-
const writer = stream.writable.getWriter();
|
|
332
|
-
|
|
333
|
-
// Process in chunks - constant memory usage
|
|
334
|
-
this.streamResults(db, writer);
|
|
335
|
-
|
|
336
|
-
return new Response(stream.readable);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
129
|
```
|
|
340
130
|
|
|
341
|
-
###
|
|
131
|
+
### Event-Driven Saga Pattern
|
|
342
132
|
|
|
343
133
|
```typescript
|
|
344
|
-
/**
|
|
345
|
-
* Event-Driven: Loose coupling, infinite scalability
|
|
346
|
-
* Services communicate through events, not direct calls
|
|
347
|
-
*/
|
|
348
|
-
|
|
349
|
-
// Event Schema with Versioning
|
|
350
|
-
interface DomainEvent<T = unknown> {
|
|
351
|
-
id: string;
|
|
352
|
-
type: string;
|
|
353
|
-
version: number;
|
|
354
|
-
timestamp: Date;
|
|
355
|
-
source: string;
|
|
356
|
-
correlationId: string;
|
|
357
|
-
causationId?: string;
|
|
358
|
-
data: T;
|
|
359
|
-
metadata: EventMetadata;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
// Event Bus Implementation
|
|
363
|
-
class EventBus {
|
|
364
|
-
private handlers: Map<string, EventHandler[]> = new Map();
|
|
365
|
-
private deadLetterQueue: DeadLetterQueue;
|
|
366
|
-
private eventStore: EventStore;
|
|
367
|
-
|
|
368
|
-
async publish<T>(event: DomainEvent<T>): Promise<void> {
|
|
369
|
-
// 1. Persist event (event sourcing)
|
|
370
|
-
await this.eventStore.append(event);
|
|
371
|
-
|
|
372
|
-
// 2. Dispatch to handlers
|
|
373
|
-
const handlers = this.handlers.get(event.type) || [];
|
|
374
|
-
|
|
375
|
-
await Promise.allSettled(
|
|
376
|
-
handlers.map(handler =>
|
|
377
|
-
this.executeHandler(handler, event)
|
|
378
|
-
)
|
|
379
|
-
);
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
private async executeHandler(
|
|
383
|
-
handler: EventHandler,
|
|
384
|
-
event: DomainEvent
|
|
385
|
-
): Promise<void> {
|
|
386
|
-
const maxRetries = 3;
|
|
387
|
-
let attempt = 0;
|
|
388
|
-
|
|
389
|
-
while (attempt < maxRetries) {
|
|
390
|
-
try {
|
|
391
|
-
await handler.handle(event);
|
|
392
|
-
return;
|
|
393
|
-
} catch (error) {
|
|
394
|
-
attempt++;
|
|
395
|
-
if (attempt >= maxRetries) {
|
|
396
|
-
await this.deadLetterQueue.add(event, error);
|
|
397
|
-
}
|
|
398
|
-
await this.delay(Math.pow(2, attempt) * 1000);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
subscribe(eventType: string, handler: EventHandler): Unsubscribe {
|
|
404
|
-
const handlers = this.handlers.get(eventType) || [];
|
|
405
|
-
handlers.push(handler);
|
|
406
|
-
this.handlers.set(eventType, handlers);
|
|
407
|
-
|
|
408
|
-
return () => {
|
|
409
|
-
const index = handlers.indexOf(handler);
|
|
410
|
-
if (index > -1) handlers.splice(index, 1);
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
// Saga Pattern for Distributed Transactions
|
|
416
134
|
class OrderSaga {
|
|
417
|
-
private eventBus: EventBus;
|
|
418
|
-
|
|
419
135
|
constructor(eventBus: EventBus) {
|
|
420
|
-
this.eventBus = eventBus;
|
|
421
|
-
|
|
422
|
-
// React to events
|
|
423
136
|
eventBus.subscribe('order.created', this.handleOrderCreated);
|
|
424
|
-
eventBus.subscribe('payment.completed', this.handlePaymentCompleted);
|
|
425
137
|
eventBus.subscribe('payment.failed', this.handlePaymentFailed);
|
|
426
|
-
eventBus.subscribe('inventory.reserved', this.handleInventoryReserved);
|
|
427
138
|
}
|
|
428
139
|
|
|
429
|
-
handleOrderCreated = async (event: DomainEvent<Order>)
|
|
430
|
-
// Start saga - reserve inventory
|
|
140
|
+
handleOrderCreated = async (event: DomainEvent<Order>) => {
|
|
431
141
|
await this.eventBus.publish({
|
|
432
142
|
type: 'inventory.reserve',
|
|
433
|
-
data: {
|
|
434
|
-
|
|
435
|
-
items: event.data.items
|
|
436
|
-
},
|
|
437
|
-
correlationId: event.correlationId,
|
|
438
|
-
causationId: event.id
|
|
143
|
+
data: { orderId: event.data.id, items: event.data.items },
|
|
144
|
+
correlationId: event.correlationId
|
|
439
145
|
});
|
|
440
146
|
};
|
|
441
147
|
|
|
442
|
-
handlePaymentFailed = async (event: DomainEvent)
|
|
443
|
-
// Compensating action
|
|
444
|
-
await this.eventBus.publish({
|
|
445
|
-
|
|
446
|
-
data: { orderId: event.data.orderId },
|
|
447
|
-
correlationId: event.correlationId,
|
|
448
|
-
causationId: event.id
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
// Update order status
|
|
452
|
-
await this.eventBus.publish({
|
|
453
|
-
type: 'order.cancelled',
|
|
454
|
-
data: {
|
|
455
|
-
orderId: event.data.orderId,
|
|
456
|
-
reason: 'payment_failed'
|
|
457
|
-
},
|
|
458
|
-
correlationId: event.correlationId,
|
|
459
|
-
causationId: event.id
|
|
460
|
-
});
|
|
148
|
+
handlePaymentFailed = async (event: DomainEvent) => {
|
|
149
|
+
// Compensating action
|
|
150
|
+
await this.eventBus.publish({ type: 'inventory.release', ... });
|
|
151
|
+
await this.eventBus.publish({ type: 'order.cancelled', ... });
|
|
461
152
|
};
|
|
462
153
|
}
|
|
463
154
|
```
|
|
464
155
|
|
|
465
|
-
###
|
|
466
|
-
|
|
467
|
-
```typescript
|
|
468
|
-
/**
|
|
469
|
-
* Ω6 Antifragile: Systems that grow stronger under stress
|
|
470
|
-
* Embrace failure as a catalyst for improvement
|
|
471
|
-
*/
|
|
472
|
-
|
|
473
|
-
// Chaos Engineering Integration
|
|
474
|
-
class AntifragileSystem {
|
|
475
|
-
private chaosEngine: ChaosEngine;
|
|
476
|
-
private adaptiveConfig: AdaptiveConfiguration;
|
|
477
|
-
private learningSystem: LearningSystem;
|
|
478
|
-
|
|
479
|
-
constructor() {
|
|
480
|
-
this.chaosEngine = new ChaosEngine({
|
|
481
|
-
// Inject controlled failures
|
|
482
|
-
experiments: [
|
|
483
|
-
{ type: 'latency', probability: 0.01, maxDelay: 500 },
|
|
484
|
-
{ type: 'failure', probability: 0.001, services: ['non-critical'] },
|
|
485
|
-
{ type: 'resource-pressure', probability: 0.01 }
|
|
486
|
-
],
|
|
487
|
-
// Automatically disable during incidents
|
|
488
|
-
safetyLimits: {
|
|
489
|
-
errorRate: 0.05,
|
|
490
|
-
p99Latency: 1000
|
|
491
|
-
}
|
|
492
|
-
});
|
|
493
|
-
|
|
494
|
-
this.learningSystem = new LearningSystem();
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
// Adaptive Circuit Breaker - learns optimal thresholds
|
|
498
|
-
private createAdaptiveBreaker(serviceName: string): CircuitBreaker {
|
|
499
|
-
return new AdaptiveCircuitBreaker({
|
|
500
|
-
serviceName,
|
|
501
|
-
// Initial conservative settings
|
|
502
|
-
initialThreshold: 5,
|
|
503
|
-
initialTimeout: 30000,
|
|
504
|
-
// Learn from traffic patterns
|
|
505
|
-
adaptationRate: 0.1,
|
|
506
|
-
onStateChange: (from, to, metrics) => {
|
|
507
|
-
this.learningSystem.recordTransition(serviceName, from, to, metrics);
|
|
508
|
-
}
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
// Automatic fallback escalation
|
|
513
|
-
async executeWithEscalation<T>(
|
|
514
|
-
primary: () => Promise<T>,
|
|
515
|
-
fallbacks: Array<() => Promise<T>>,
|
|
516
|
-
options: ExecutionOptions
|
|
517
|
-
): Promise<T> {
|
|
518
|
-
// Try primary
|
|
519
|
-
try {
|
|
520
|
-
return await this.withTimeout(primary(), options.timeout);
|
|
521
|
-
} catch (primaryError) {
|
|
522
|
-
// Learn from failure
|
|
523
|
-
this.learningSystem.recordFailure('primary', primaryError);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
// Escalate through fallbacks
|
|
527
|
-
for (let i = 0; i < fallbacks.length; i++) {
|
|
528
|
-
try {
|
|
529
|
-
const result = await this.withTimeout(
|
|
530
|
-
fallbacks[i](),
|
|
531
|
-
options.timeout * (i + 2) // Progressively longer timeouts
|
|
532
|
-
);
|
|
533
|
-
// Record successful fallback
|
|
534
|
-
this.learningSystem.recordFallbackSuccess(i);
|
|
535
|
-
return result;
|
|
536
|
-
} catch (error) {
|
|
537
|
-
this.learningSystem.recordFailure(`fallback-${i}`, error);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
throw new AllFallbacksExhaustedError();
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
// Self-improving configuration
|
|
545
|
-
async adaptConfiguration(): Promise<void> {
|
|
546
|
-
const insights = await this.learningSystem.getInsights();
|
|
547
|
-
|
|
548
|
-
for (const insight of insights) {
|
|
549
|
-
switch (insight.type) {
|
|
550
|
-
case 'timeout-too-short':
|
|
551
|
-
await this.adaptiveConfig.increase(insight.key, 1.5);
|
|
552
|
-
break;
|
|
553
|
-
case 'retry-ineffective':
|
|
554
|
-
await this.adaptiveConfig.decrease(`${insight.service}.retries`, 0.5);
|
|
555
|
-
break;
|
|
556
|
-
case 'cache-miss-pattern':
|
|
557
|
-
await this.adaptiveConfig.set(
|
|
558
|
-
`${insight.key}.preload`,
|
|
559
|
-
insight.suggestedKeys
|
|
560
|
-
);
|
|
561
|
-
break;
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
// Bulkhead Pattern - Isolate failures
|
|
568
|
-
class BulkheadExecutor {
|
|
569
|
-
private pools: Map<string, ResourcePool>;
|
|
570
|
-
|
|
571
|
-
constructor(config: BulkheadConfig) {
|
|
572
|
-
// Separate pools for different concerns
|
|
573
|
-
this.pools = new Map([
|
|
574
|
-
['critical', new ResourcePool({ size: 20, queue: 100 })],
|
|
575
|
-
['standard', new ResourcePool({ size: 10, queue: 50 })],
|
|
576
|
-
['background', new ResourcePool({ size: 5, queue: 1000 })]
|
|
577
|
-
]);
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
async execute<T>(
|
|
581
|
-
priority: 'critical' | 'standard' | 'background',
|
|
582
|
-
task: () => Promise<T>
|
|
583
|
-
): Promise<T> {
|
|
584
|
-
const pool = this.pools.get(priority)!;
|
|
585
|
-
|
|
586
|
-
// Critical operations never affected by standard/background load
|
|
587
|
-
return pool.acquire(async (resource) => {
|
|
588
|
-
return task();
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
```
|
|
593
|
-
|
|
594
|
-
### 7. Architecture Decision Framework
|
|
156
|
+
### Architecture Decision Template
|
|
595
157
|
|
|
596
158
|
```markdown
|
|
597
|
-
## Omega Architecture Decision
|
|
159
|
+
## Omega Architecture Decision
|
|
598
160
|
|
|
599
161
|
### Context
|
|
600
|
-
|
|
601
|
-
What constraints exist?
|
|
162
|
+
[Problem and constraints]
|
|
602
163
|
|
|
603
164
|
### Omega Principles Check
|
|
604
|
-
For EVERY architecture decision, verify:
|
|
605
|
-
|
|
606
165
|
| Principle | Question | Assessment |
|
|
607
166
|
|-----------|----------|------------|
|
|
608
|
-
|
|
|
609
|
-
|
|
|
610
|
-
|
|
|
611
|
-
|
|
|
612
|
-
|
|
|
613
|
-
|
|
|
614
|
-
|
|
|
615
|
-
|
|
616
|
-
### Scale
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
4. What's the cost curve at each level?
|
|
621
|
-
|
|
622
|
-
### Failure Analysis
|
|
623
|
-
1. What's the blast radius of failure?
|
|
624
|
-
2. How do we detect it?
|
|
625
|
-
3. How do we recover?
|
|
626
|
-
4. How do we prevent recurrence?
|
|
167
|
+
| Leverage | Does this multiply capability? | |
|
|
168
|
+
| Abstraction | Solving class of problems? | |
|
|
169
|
+
| Agentic | Can it operate autonomously? | |
|
|
170
|
+
| Recursive | Will it self-improve? | |
|
|
171
|
+
| Zero-Marginal | Sub-linear cost scaling? | |
|
|
172
|
+
| Antifragile | Stronger under stress? | |
|
|
173
|
+
| Composable | Combines with other components? | |
|
|
174
|
+
|
|
175
|
+
### Scale Analysis
|
|
176
|
+
- 10x load: [Impact]
|
|
177
|
+
- 100x load: [Impact]
|
|
178
|
+
- 1000x load: [Impact]
|
|
627
179
|
|
|
628
180
|
### Decision
|
|
629
|
-
[
|
|
630
|
-
|
|
631
|
-
### Consequences
|
|
632
|
-
- Benefits:
|
|
633
|
-
- Risks:
|
|
634
|
-
- Technical debt incurred:
|
|
635
|
-
```
|
|
636
|
-
|
|
637
|
-
## Use Cases
|
|
638
|
-
|
|
639
|
-
### E-commerce Platform Architecture
|
|
640
|
-
|
|
641
|
-
```typescript
|
|
642
|
-
/**
|
|
643
|
-
* Complete e-commerce platform following Omega principles
|
|
644
|
-
*/
|
|
645
|
-
|
|
646
|
-
// Domain Events
|
|
647
|
-
type EcommerceEvent =
|
|
648
|
-
| { type: 'product.created'; data: Product }
|
|
649
|
-
| { type: 'cart.updated'; data: Cart }
|
|
650
|
-
| { type: 'order.placed'; data: Order }
|
|
651
|
-
| { type: 'payment.processed'; data: Payment }
|
|
652
|
-
| { type: 'inventory.updated'; data: InventoryChange }
|
|
653
|
-
| { type: 'shipment.dispatched'; data: Shipment };
|
|
654
|
-
|
|
655
|
-
// Service Boundaries (Agentic Decomposition)
|
|
656
|
-
const serviceArchitecture = {
|
|
657
|
-
// Each service is autonomous with clear boundaries
|
|
658
|
-
catalog: {
|
|
659
|
-
responsibilities: ['product-management', 'search', 'recommendations'],
|
|
660
|
-
data: ['products', 'categories', 'reviews'],
|
|
661
|
-
events: ['product.*'],
|
|
662
|
-
scaling: 'read-heavy, edge-cached'
|
|
663
|
-
},
|
|
664
|
-
|
|
665
|
-
cart: {
|
|
666
|
-
responsibilities: ['cart-management', 'pricing', 'promotions'],
|
|
667
|
-
data: ['carts', 'promotions'],
|
|
668
|
-
events: ['cart.*'],
|
|
669
|
-
scaling: 'session-based, regional'
|
|
670
|
-
},
|
|
671
|
-
|
|
672
|
-
order: {
|
|
673
|
-
responsibilities: ['order-processing', 'fulfillment-coordination'],
|
|
674
|
-
data: ['orders', 'order-items'],
|
|
675
|
-
events: ['order.*'],
|
|
676
|
-
scaling: 'write-heavy, strongly-consistent'
|
|
677
|
-
},
|
|
678
|
-
|
|
679
|
-
payment: {
|
|
680
|
-
responsibilities: ['payment-processing', 'refunds', 'fraud-detection'],
|
|
681
|
-
data: ['transactions', 'payment-methods'],
|
|
682
|
-
events: ['payment.*'],
|
|
683
|
-
scaling: 'PCI-compliant, isolated'
|
|
684
|
-
},
|
|
685
|
-
|
|
686
|
-
inventory: {
|
|
687
|
-
responsibilities: ['stock-management', 'reservations', 'alerts'],
|
|
688
|
-
data: ['inventory', 'warehouses'],
|
|
689
|
-
events: ['inventory.*'],
|
|
690
|
-
scaling: 'real-time, multi-region sync'
|
|
691
|
-
},
|
|
692
|
-
|
|
693
|
-
shipping: {
|
|
694
|
-
responsibilities: ['carrier-integration', 'tracking', 'returns'],
|
|
695
|
-
data: ['shipments', 'carriers'],
|
|
696
|
-
events: ['shipment.*'],
|
|
697
|
-
scaling: 'async, event-driven'
|
|
698
|
-
}
|
|
699
|
-
};
|
|
700
|
-
|
|
701
|
-
// Infrastructure Blueprint
|
|
702
|
-
const infrastructureConfig = `
|
|
703
|
-
# Kubernetes Architecture
|
|
704
|
-
|
|
705
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
706
|
-
│ EDGE LAYER │
|
|
707
|
-
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
|
|
708
|
-
│ │ CDN │ │ CDN │ │ CDN │ │ CDN │ │
|
|
709
|
-
│ │ US-EAST │ │ EU-WEST │ │ AP-SOUTH│ │ AP-NORTH│ │
|
|
710
|
-
│ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ │
|
|
711
|
-
└───────┼────────────┼────────────┼────────────┼──────────────────┘
|
|
712
|
-
│ │ │ │
|
|
713
|
-
┌───────┴────────────┴────────────┴────────────┴──────────────────┐
|
|
714
|
-
│ API GATEWAY (Global) │
|
|
715
|
-
│ ┌──────────────────────────────────────────────────────────┐ │
|
|
716
|
-
│ │ Rate Limiting │ Auth │ Routing │ Load Balancing │ │
|
|
717
|
-
│ └──────────────────────────────────────────────────────────┘ │
|
|
718
|
-
└─────────────────────────────┬───────────────────────────────────┘
|
|
719
|
-
│
|
|
720
|
-
┌─────────────────────────────┴───────────────────────────────────┐
|
|
721
|
-
│ SERVICE MESH (Istio) │
|
|
722
|
-
│ │
|
|
723
|
-
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
|
|
724
|
-
│ │ Catalog │ │ Cart │ │ Order │ │ Payment │ │Inventory│ │
|
|
725
|
-
│ │ Service │ │ Service │ │ Service │ │ Service │ │ Service │ │
|
|
726
|
-
│ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ │
|
|
727
|
-
│ │ │ │ │ │ │
|
|
728
|
-
└───────┼──────────┼──────────┼──────────┼──────────┼────────────┘
|
|
729
|
-
│ │ │ │ │
|
|
730
|
-
┌───────┴──────────┴──────────┴──────────┴──────────┴────────────┐
|
|
731
|
-
│ EVENT BUS (Kafka) │
|
|
732
|
-
│ ┌──────────────────────────────────────────────────────────┐ │
|
|
733
|
-
│ │ Topics: products│carts│orders│payments│inventory│shipments│ │
|
|
734
|
-
│ └──────────────────────────────────────────────────────────┘ │
|
|
735
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
736
|
-
`;
|
|
737
|
-
```
|
|
738
|
-
|
|
739
|
-
### SaaS Multi-Tenant Architecture
|
|
740
|
-
|
|
741
|
-
```typescript
|
|
742
|
-
/**
|
|
743
|
-
* Multi-tenant SaaS following Zero-Marginal-Cost principles
|
|
744
|
-
*/
|
|
745
|
-
|
|
746
|
-
// Tenant Isolation Strategies
|
|
747
|
-
type IsolationStrategy =
|
|
748
|
-
| 'shared-database' // Cost-efficient, row-level isolation
|
|
749
|
-
| 'schema-per-tenant' // Balance of isolation and cost
|
|
750
|
-
| 'database-per-tenant'; // Maximum isolation, higher cost
|
|
751
|
-
|
|
752
|
-
interface TenantConfig {
|
|
753
|
-
id: string;
|
|
754
|
-
tier: 'free' | 'pro' | 'enterprise';
|
|
755
|
-
isolation: IsolationStrategy;
|
|
756
|
-
customDomain?: string;
|
|
757
|
-
dataRegion: string;
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
class MultiTenantArchitecture {
|
|
761
|
-
// Tenant-aware query builder
|
|
762
|
-
createQueryContext(tenantId: string): QueryContext {
|
|
763
|
-
return {
|
|
764
|
-
// Automatic tenant filtering on all queries
|
|
765
|
-
defaultFilters: { tenant_id: tenantId },
|
|
766
|
-
// Connection pooling by tenant tier
|
|
767
|
-
pool: this.getPoolForTenant(tenantId),
|
|
768
|
-
// Read replica routing
|
|
769
|
-
readPreference: this.getReadPreference(tenantId)
|
|
770
|
-
};
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
// Dynamic resource allocation by tier
|
|
774
|
-
private getResourceLimits(tier: string): ResourceLimits {
|
|
775
|
-
const limits: Record<string, ResourceLimits> = {
|
|
776
|
-
free: {
|
|
777
|
-
requestsPerMinute: 60,
|
|
778
|
-
storageGB: 1,
|
|
779
|
-
computeUnits: 10,
|
|
780
|
-
features: ['core']
|
|
781
|
-
},
|
|
782
|
-
pro: {
|
|
783
|
-
requestsPerMinute: 600,
|
|
784
|
-
storageGB: 50,
|
|
785
|
-
computeUnits: 100,
|
|
786
|
-
features: ['core', 'advanced', 'integrations']
|
|
787
|
-
},
|
|
788
|
-
enterprise: {
|
|
789
|
-
requestsPerMinute: 6000,
|
|
790
|
-
storageGB: 500,
|
|
791
|
-
computeUnits: 1000,
|
|
792
|
-
features: ['core', 'advanced', 'integrations', 'sso', 'audit']
|
|
793
|
-
}
|
|
794
|
-
};
|
|
795
|
-
return limits[tier];
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
// Feature Flag System (Composable)
|
|
800
|
-
class FeatureFlagSystem {
|
|
801
|
-
async isEnabled(
|
|
802
|
-
flag: string,
|
|
803
|
-
context: { tenant: string; user?: string }
|
|
804
|
-
): Promise<boolean> {
|
|
805
|
-
// Layered evaluation
|
|
806
|
-
const checks = [
|
|
807
|
-
this.checkGlobalOverride(flag),
|
|
808
|
-
this.checkTenantOverride(flag, context.tenant),
|
|
809
|
-
this.checkUserOverride(flag, context.user),
|
|
810
|
-
this.checkPercentageRollout(flag, context),
|
|
811
|
-
this.checkDefaultValue(flag)
|
|
812
|
-
];
|
|
813
|
-
|
|
814
|
-
for (const check of checks) {
|
|
815
|
-
const result = await check;
|
|
816
|
-
if (result !== undefined) return result;
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
return false;
|
|
820
|
-
}
|
|
821
|
-
}
|
|
181
|
+
[Chosen approach with rationale]
|
|
822
182
|
```
|
|
823
183
|
|
|
824
184
|
## Best Practices
|
|
825
185
|
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
### Don'ts
|
|
840
|
-
|
|
841
|
-
- Don't build monoliths that can't be decomposed
|
|
842
|
-
- Don't create tight coupling between services
|
|
843
|
-
- Don't ignore failure modes in design
|
|
844
|
-
- Don't scale vertically when horizontal is possible
|
|
845
|
-
- Don't hardcode configuration
|
|
846
|
-
- Don't skip capacity planning
|
|
847
|
-
- Don't deploy without health checks
|
|
848
|
-
- Don't rely on synchronous calls for non-critical paths
|
|
849
|
-
- Don't ignore data consistency requirements
|
|
850
|
-
- Don't underestimate the cost of distributed systems
|
|
851
|
-
|
|
852
|
-
## References
|
|
853
|
-
|
|
854
|
-
- [Designing Data-Intensive Applications](https://dataintensive.net/)
|
|
855
|
-
- [Building Microservices](https://www.oreilly.com/library/view/building-microservices-2nd/9781492034018/)
|
|
856
|
-
- [Release It!](https://pragprog.com/titles/mnee2/release-it-second-edition/)
|
|
857
|
-
- [Site Reliability Engineering](https://sre.google/sre-book/table-of-contents/)
|
|
858
|
-
- [Cloud Design Patterns](https://docs.microsoft.com/en-us/azure/architecture/patterns/)
|
|
186
|
+
| Do | Avoid |
|
|
187
|
+
|----|-------|
|
|
188
|
+
| Apply all 7 Omega principles to every decision | Building monoliths that cannot decompose |
|
|
189
|
+
| Design for 1000x scale from day one | Tight coupling between services |
|
|
190
|
+
| Use event-driven patterns for loose coupling | Ignoring failure modes in design |
|
|
191
|
+
| Implement circuit breakers at all boundaries | Scaling vertically when horizontal is possible |
|
|
192
|
+
| Build self-healing capabilities into services | Hardcoding configuration values |
|
|
193
|
+
| Measure and optimize cost per transaction | Skipping capacity planning |
|
|
194
|
+
| Document decisions using ADR template | Deploying without health checks |
|
|
195
|
+
| Test failure scenarios with chaos engineering | Synchronous calls for non-critical paths |
|
|
196
|
+
| Use infrastructure as code | Ignoring data consistency requirements |
|
|
197
|
+
| Implement observability everywhere | Underestimating distributed system complexity |
|