@mytechtoday/augment-extensions 1.2.0 → 1.2.2

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 (35) hide show
  1. package/AGENTS.md +35 -3
  2. package/README.md +3 -3
  3. package/augment-extensions/domain-rules/software-architecture/README.md +143 -0
  4. package/augment-extensions/domain-rules/software-architecture/examples/banking-layered.md +961 -0
  5. package/augment-extensions/domain-rules/software-architecture/examples/ecommerce-microservices.md +990 -0
  6. package/augment-extensions/domain-rules/software-architecture/examples/iot-eventdriven.md +882 -0
  7. package/augment-extensions/domain-rules/software-architecture/examples/monolith-to-microservices-migration.md +703 -0
  8. package/augment-extensions/domain-rules/software-architecture/examples/serverless-imageprocessing.md +957 -0
  9. package/augment-extensions/domain-rules/software-architecture/examples/trading-eventdriven.md +747 -0
  10. package/augment-extensions/domain-rules/software-architecture/module.json +119 -0
  11. package/augment-extensions/domain-rules/software-architecture/rules/challenges-solutions.md +763 -0
  12. package/augment-extensions/domain-rules/software-architecture/rules/definitions-terminology.md +409 -0
  13. package/augment-extensions/domain-rules/software-architecture/rules/design-principles.md +684 -0
  14. package/augment-extensions/domain-rules/software-architecture/rules/evaluation-testing.md +1381 -0
  15. package/augment-extensions/domain-rules/software-architecture/rules/event-driven-architecture.md +616 -0
  16. package/augment-extensions/domain-rules/software-architecture/rules/fundamentals.md +306 -0
  17. package/augment-extensions/domain-rules/software-architecture/rules/industry-architectures.md +554 -0
  18. package/augment-extensions/domain-rules/software-architecture/rules/layered-architecture.md +776 -0
  19. package/augment-extensions/domain-rules/software-architecture/rules/microservices-architecture.md +503 -0
  20. package/augment-extensions/domain-rules/software-architecture/rules/modeling-documentation.md +1199 -0
  21. package/augment-extensions/domain-rules/software-architecture/rules/monolithic-architecture.md +351 -0
  22. package/augment-extensions/domain-rules/software-architecture/rules/principles.md +556 -0
  23. package/augment-extensions/domain-rules/software-architecture/rules/quality-attributes.md +797 -0
  24. package/augment-extensions/domain-rules/software-architecture/rules/scalability-performance.md +1345 -0
  25. package/augment-extensions/domain-rules/software-architecture/rules/security-architecture.md +1039 -0
  26. package/augment-extensions/domain-rules/software-architecture/rules/serverless-architecture.md +711 -0
  27. package/augment-extensions/domain-rules/software-architecture/rules/skills-development.md +568 -0
  28. package/augment-extensions/domain-rules/software-architecture/rules/tools-methodologies.md +961 -0
  29. package/augment-extensions/workflows/beads/examples/complete-workflow-example.md +8 -8
  30. package/augment-extensions/workflows/beads/rules/best-practices.md +2 -2
  31. package/augment-extensions/workflows/beads/rules/file-format.md +4 -4
  32. package/augment-extensions/workflows/beads/rules/manual-setup.md +4 -4
  33. package/augment-extensions/workflows/beads/rules/workflow.md +3 -3
  34. package/modules.md +40 -3
  35. package/package.json +1 -1
@@ -0,0 +1,503 @@
1
+ # Microservices Architecture
2
+
3
+ ## Overview
4
+
5
+ This document covers microservices architecture patterns, service discovery, API gateways, and best practices for building distributed systems.
6
+
7
+ ---
8
+
9
+ ## Knowledge
10
+
11
+ ### What is Microservices Architecture?
12
+
13
+ **Definition**
14
+ - Collection of small, autonomous services
15
+ - Each service runs in its own process
16
+ - Communicates via lightweight protocols (HTTP, messaging)
17
+ - Independently deployable and scalable
18
+ - Organized around business capabilities
19
+
20
+ **Core Principles**
21
+ - Single Responsibility: Each service does one thing well
22
+ - Autonomy: Services are independent
23
+ - Decentralization: Distributed governance and data
24
+ - Resilience: Failure isolation
25
+ - Observable: Comprehensive monitoring
26
+
27
+ **Characteristics**
28
+ - Polyglot persistence (different databases per service)
29
+ - Technology diversity (different tech stacks)
30
+ - Decentralized data management
31
+ - Infrastructure automation
32
+ - Design for failure
33
+
34
+ ### When to Use Microservices
35
+
36
+ **Good Fit**
37
+ - Large, complex domains
38
+ - Multiple teams (> 15 developers)
39
+ - Need for independent scaling
40
+ - Frequent deployments
41
+ - Technology diversity requirements
42
+ - High availability requirements
43
+
44
+ **Poor Fit**
45
+ - Small applications
46
+ - Simple domains
47
+ - Small teams (< 5 developers)
48
+ - Limited DevOps maturity
49
+ - Tight latency requirements
50
+ - Strong consistency needs
51
+
52
+ ---
53
+
54
+ ## Skills
55
+
56
+ ### Service Decomposition
57
+
58
+ **Decomposition Strategies**
59
+
60
+ 1. **By Business Capability**
61
+ - User Management Service
62
+ - Order Service
63
+ - Payment Service
64
+ - Inventory Service
65
+ - Notification Service
66
+
67
+ 2. **By Subdomain (DDD)**
68
+ - Core Domain: Order Processing
69
+ - Supporting: User Authentication
70
+ - Generic: Email Notifications
71
+
72
+ 3. **By Use Case**
73
+ - Place Order Service
74
+ - Track Shipment Service
75
+ - Process Return Service
76
+
77
+ **Service Boundaries**
78
+ - Bounded contexts from Domain-Driven Design
79
+ - High cohesion within service
80
+ - Low coupling between services
81
+ - Independent data ownership
82
+
83
+ **Service Size Guidelines**
84
+ - Team can maintain 5-10 services
85
+ - Service can be rewritten in 2 weeks
86
+ - Single business capability
87
+ - 100-1000 lines of code (guideline, not rule)
88
+
89
+ ### API Gateway Pattern
90
+
91
+ **Purpose**
92
+ - Single entry point for clients
93
+ - Request routing to services
94
+ - Authentication and authorization
95
+ - Rate limiting and throttling
96
+ - Request/response transformation
97
+ - Protocol translation
98
+
99
+ **Implementation**
100
+ ```
101
+ Client → API Gateway → [Service A, Service B, Service C]
102
+ ```
103
+
104
+ **Features**
105
+ - Reverse proxy
106
+ - Load balancing
107
+ - Caching
108
+ - Request aggregation
109
+ - Circuit breaking
110
+
111
+ **Popular Tools**
112
+ - Kong
113
+ - AWS API Gateway
114
+ - Azure API Management
115
+ - Nginx
116
+ - Traefik
117
+
118
+ ### Service Discovery
119
+
120
+ **Purpose**
121
+ - Dynamic service location
122
+ - Health checking
123
+ - Load balancing
124
+ - Failover
125
+
126
+ **Client-Side Discovery**
127
+ ```
128
+ Client → Service Registry → Service Instance
129
+ ```
130
+ - Client queries registry
131
+ - Client selects instance
132
+ - Client makes request
133
+ - Examples: Netflix Eureka, Consul
134
+
135
+ **Server-Side Discovery**
136
+ ```
137
+ Client → Load Balancer → Service Registry → Service Instance
138
+ ```
139
+ - Load balancer queries registry
140
+ - Load balancer routes request
141
+ - Examples: AWS ELB, Kubernetes Service
142
+
143
+ **Service Registry**
144
+ - Maintains service locations
145
+ - Health checks
146
+ - Dynamic updates
147
+ - Examples: Consul, etcd, ZooKeeper
148
+
149
+ ### Inter-Service Communication
150
+
151
+ **Synchronous Communication**
152
+
153
+ **REST APIs**
154
+ ```http
155
+ GET /api/orders/123
156
+ POST /api/orders
157
+ PUT /api/orders/123
158
+ DELETE /api/orders/123
159
+ ```
160
+
161
+ **gRPC**
162
+ ```protobuf
163
+ service OrderService {
164
+ rpc GetOrder(OrderRequest) returns (OrderResponse);
165
+ rpc CreateOrder(CreateOrderRequest) returns (OrderResponse);
166
+ }
167
+ ```
168
+
169
+ **Asynchronous Communication**
170
+
171
+ **Message Queues**
172
+ - Point-to-point communication
173
+ - Guaranteed delivery
174
+ - Examples: RabbitMQ, AWS SQS
175
+
176
+ **Event Streaming**
177
+ - Pub/sub pattern
178
+ - Event sourcing
179
+ - Examples: Apache Kafka, AWS Kinesis
180
+
181
+ **Message Patterns**
182
+ - Command: Request action
183
+ - Event: Notify of occurrence
184
+ - Query: Request data
185
+
186
+ ### Data Management
187
+
188
+ **Database per Service**
189
+ - Each service owns its data
190
+ - No direct database access between services
191
+ - Data duplication acceptable
192
+ - Eventual consistency
193
+
194
+ **Data Consistency Patterns**
195
+
196
+ **Saga Pattern**
197
+ - Distributed transaction alternative
198
+ - Sequence of local transactions
199
+ - Compensating transactions for rollback
200
+
201
+ **Event Sourcing**
202
+ - Store events, not state
203
+ - Rebuild state from events
204
+ - Complete audit trail
205
+
206
+ **CQRS (Command Query Responsibility Segregation)**
207
+ - Separate read and write models
208
+ - Optimize each independently
209
+ - Event-driven synchronization
210
+
211
+ ---
212
+
213
+ ## Examples
214
+
215
+ ### E-Commerce Microservices Architecture
216
+
217
+ **Service Inventory**
218
+ ```
219
+ ┌─────────────────┐
220
+ │ API Gateway │
221
+ └────────┬────────┘
222
+
223
+ ┌────┴────┬────────┬─────────┬──────────┐
224
+ │ │ │ │ │
225
+ ┌───▼───┐ ┌──▼──┐ ┌───▼────┐ ┌──▼─────┐ ┌─▼────────┐
226
+ │ User │ │Order│ │Product │ │Payment │ │Inventory │
227
+ │Service│ │Svc │ │Service │ │Service │ │ Service │
228
+ └───┬───┘ └──┬──┘ └───┬────┘ └──┬─────┘ └─┬────────┘
229
+ │ │ │ │ │
230
+ ┌───▼────────▼────────▼─────────▼──────────▼───┐
231
+ │ Message Bus (Kafka) │
232
+ └───────────────────────────────────────────────┘
233
+ ```
234
+
235
+ **Order Service Example**
236
+ ```java
237
+ @RestController
238
+ @RequestMapping("/api/orders")
239
+ public class OrderController {
240
+ private final OrderService orderService;
241
+ private final EventPublisher eventPublisher;
242
+
243
+ @PostMapping
244
+ public ResponseEntity<OrderResponse> createOrder(
245
+ @RequestBody CreateOrderRequest request
246
+ ) {
247
+ // Create order
248
+ Order order = orderService.createOrder(request);
249
+
250
+ // Publish event
251
+ eventPublisher.publish(new OrderCreatedEvent(
252
+ order.getId(),
253
+ order.getCustomerId(),
254
+ order.getItems(),
255
+ order.getTotal()
256
+ ));
257
+
258
+ return ResponseEntity.ok(
259
+ OrderResponse.from(order)
260
+ );
261
+ }
262
+ }
263
+
264
+ @Service
265
+ public class OrderService {
266
+ private final OrderRepository orderRepository;
267
+ private final ProductServiceClient productClient;
268
+ private final InventoryServiceClient inventoryClient;
269
+
270
+ @Transactional
271
+ public Order createOrder(CreateOrderRequest request) {
272
+ // Validate products via Product Service
273
+ List<Product> products = productClient.getProducts(
274
+ request.getProductIds()
275
+ );
276
+
277
+ // Check inventory via Inventory Service
278
+ boolean available = inventoryClient.checkAvailability(
279
+ request.getProductIds(),
280
+ request.getQuantities()
281
+ );
282
+
283
+ if (!available) {
284
+ throw new InsufficientInventoryException();
285
+ }
286
+
287
+ // Create order
288
+ Order order = new Order();
289
+ order.setCustomerId(request.getCustomerId());
290
+ order.setItems(createOrderItems(products, request));
291
+ order.setTotal(calculateTotal(order.getItems()));
292
+ order.setStatus(OrderStatus.PENDING);
293
+
294
+ return orderRepository.save(order);
295
+ }
296
+ }
297
+ ```
298
+
299
+ **Service Client with Circuit Breaker**
300
+ ```java
301
+ @Component
302
+ public class ProductServiceClient {
303
+ private final RestTemplate restTemplate;
304
+ private final CircuitBreaker circuitBreaker;
305
+
306
+ public List<Product> getProducts(List<String> productIds) {
307
+ return circuitBreaker.executeSupplier(() -> {
308
+ String url = "http://product-service/api/products";
309
+ return restTemplate.postForObject(
310
+ url,
311
+ productIds,
312
+ ProductListResponse.class
313
+ ).getProducts();
314
+ });
315
+ }
316
+ }
317
+ ```
318
+
319
+ **Event Handler Example**
320
+ ```java
321
+ @Component
322
+ public class OrderEventHandler {
323
+ private final InventoryService inventoryService;
324
+ private final NotificationService notificationService;
325
+
326
+ @KafkaListener(topics = "order-created")
327
+ public void handleOrderCreated(OrderCreatedEvent event) {
328
+ // Reserve inventory
329
+ inventoryService.reserveItems(
330
+ event.getOrderId(),
331
+ event.getItems()
332
+ );
333
+
334
+ // Send notification
335
+ notificationService.sendOrderConfirmation(
336
+ event.getCustomerId(),
337
+ event.getOrderId()
338
+ );
339
+ }
340
+ }
341
+ ```
342
+
343
+ ### API Gateway Configuration
344
+
345
+ **Kong Gateway Example**
346
+ ```yaml
347
+ services:
348
+ - name: order-service
349
+ url: http://order-service:8080
350
+ routes:
351
+ - name: orders
352
+ paths:
353
+ - /api/orders
354
+ methods:
355
+ - GET
356
+ - POST
357
+ - PUT
358
+ - DELETE
359
+ plugins:
360
+ - name: rate-limiting
361
+ config:
362
+ minute: 100
363
+ - name: jwt
364
+ - name: cors
365
+
366
+ - name: product-service
367
+ url: http://product-service:8080
368
+ routes:
369
+ - name: products
370
+ paths:
371
+ - /api/products
372
+ ```
373
+
374
+ ---
375
+
376
+ ## Understanding
377
+
378
+ ### Advantages of Microservices
379
+
380
+ **Independent Deployment**
381
+ - Deploy services independently
382
+ - Faster release cycles
383
+ - Reduced deployment risk
384
+ - Parallel development
385
+
386
+ **Independent Scaling**
387
+ - Scale services based on demand
388
+ - Resource optimization
389
+ - Cost efficiency
390
+ - Performance tuning per service
391
+
392
+ **Technology Diversity**
393
+ - Choose best tool for each service
394
+ - Experiment with new technologies
395
+ - Gradual technology migration
396
+ - Polyglot programming
397
+
398
+ **Fault Isolation**
399
+ - Service failures don't cascade
400
+ - Graceful degradation
401
+ - Higher availability
402
+ - Resilience patterns
403
+
404
+ **Team Autonomy**
405
+ - Teams own services end-to-end
406
+ - Faster decision making
407
+ - Clear ownership
408
+ - Reduced coordination
409
+
410
+ ### Challenges and Disadvantages
411
+
412
+ **Distributed System Complexity**
413
+ - Network latency
414
+ - Partial failures
415
+ - Distributed transactions
416
+ - Data consistency
417
+
418
+ **Operational Overhead**
419
+ - More services to deploy
420
+ - More infrastructure to manage
421
+ - Complex monitoring
422
+ - Debugging difficulties
423
+
424
+ **Data Management**
425
+ - No ACID transactions across services
426
+ - Eventual consistency
427
+ - Data duplication
428
+ - Complex queries
429
+
430
+ **Testing Complexity**
431
+ - Integration testing harder
432
+ - End-to-end testing complex
433
+ - Test environment management
434
+ - Contract testing needed
435
+
436
+ **Network Overhead**
437
+ - Inter-service communication cost
438
+ - Serialization/deserialization
439
+ - Higher latency
440
+ - Bandwidth consumption
441
+
442
+ ### Best Practices
443
+
444
+ **Design Principles**
445
+ - Design for failure (circuit breakers, retries, timeouts)
446
+ - Decentralize everything (data, governance, decisions)
447
+ - Automate everything (deployment, testing, monitoring)
448
+ - Isolate failures (bulkheads, rate limiting)
449
+ - Keep services small and focused
450
+
451
+ **Communication**
452
+ - Use asynchronous messaging when possible
453
+ - Implement circuit breakers
454
+ - Set timeouts on all calls
455
+ - Use idempotent operations
456
+ - Version APIs
457
+
458
+ **Data Management**
459
+ - Database per service
460
+ - Use sagas for distributed transactions
461
+ - Implement event sourcing for audit trails
462
+ - Use CQRS for read/write optimization
463
+ - Accept eventual consistency
464
+
465
+ **Observability**
466
+ - Distributed tracing (Jaeger, Zipkin)
467
+ - Centralized logging (ELK, Splunk)
468
+ - Metrics and monitoring (Prometheus, Grafana)
469
+ - Health checks
470
+ - Service mesh (Istio, Linkerd)
471
+
472
+ **Security**
473
+ - API Gateway for authentication
474
+ - Service-to-service authentication (mTLS)
475
+ - Secrets management (Vault, AWS Secrets Manager)
476
+ - Network segmentation
477
+ - Rate limiting and throttling
478
+
479
+ ---
480
+
481
+ ## References
482
+
483
+ - **Books**
484
+ - "Building Microservices" by Sam Newman
485
+ - "Microservices Patterns" by Chris Richardson
486
+ - "Release It!" by Michael Nygard
487
+
488
+ - **Patterns**
489
+ - API Gateway Pattern
490
+ - Service Discovery Pattern
491
+ - Circuit Breaker Pattern
492
+ - Saga Pattern
493
+ - CQRS Pattern
494
+ - Event Sourcing Pattern
495
+
496
+ - **Tools**
497
+ - Service Mesh: Istio, Linkerd, Consul Connect
498
+ - API Gateway: Kong, AWS API Gateway, Traefik
499
+ - Service Discovery: Consul, etcd, Eureka
500
+ - Messaging: Kafka, RabbitMQ, AWS SQS/SNS
501
+ - Monitoring: Prometheus, Grafana, Datadog
502
+
503
+