@mytechtoday/augment-extensions 1.2.1 → 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 (31) hide show
  1. package/AGENTS.md +33 -1
  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/rules/workflow.md +1 -1
  30. package/modules.md +40 -3
  31. package/package.json +1 -1
@@ -0,0 +1,703 @@
1
+ # Monolith to Microservices Migration Example
2
+
3
+ ## Overview
4
+
5
+ This document provides a comprehensive example of migrating a monolithic e-commerce application to microservices architecture using the Strangler Fig Pattern.
6
+
7
+ ---
8
+
9
+ ## Initial State: Monolithic Application
10
+
11
+ ### System Context
12
+
13
+ **Current Architecture**
14
+ - Single Java Spring Boot application
15
+ - 500,000 lines of code
16
+ - 50 developers across 5 teams
17
+ - Shared PostgreSQL database
18
+ - Deployment takes 2 hours
19
+ - Downtime required for deployments
20
+
21
+ **Pain Points**
22
+ - Long deployment cycles (weekly releases)
23
+ - Difficult to scale individual components
24
+ - Technology lock-in (Java only)
25
+ - Team coordination overhead
26
+ - Database bottlenecks
27
+ - Tight coupling between modules
28
+ - Difficult to onboard new developers
29
+
30
+ **Business Drivers for Migration**
31
+ - Need for faster time-to-market
32
+ - Independent team autonomy
33
+ - Technology diversity (Node.js, Python for ML)
34
+ - Better scalability
35
+ - Improved fault isolation
36
+
37
+ ---
38
+
39
+ ## Target State: Microservices Architecture
40
+
41
+ ### Service Decomposition
42
+
43
+ **Identified Bounded Contexts (Domain-Driven Design)**
44
+
45
+ ```
46
+ Monolith (500K LOC)
47
+ ├── User Management (50K LOC) → User Service
48
+ ├── Product Catalog (100K LOC) → Product Service + Search Service
49
+ ├── Shopping Cart (30K LOC) → Cart Service
50
+ ├── Order Processing (150K LOC) → Order Service + Fulfillment Service
51
+ ├── Payment (40K LOC) → Payment Service
52
+ ├── Inventory (60K LOC) → Inventory Service
53
+ ├── Shipping (50K LOC) → Shipping Service
54
+ └── Notifications (20K LOC) → Notification Service
55
+ ```
56
+
57
+ **Service Prioritization**
58
+
59
+ 1. **Priority 1: Product Catalog** (Low risk, high value)
60
+ - Read-heavy, low coupling
61
+ - Can be extracted with minimal impact
62
+ - Immediate performance benefits
63
+
64
+ 2. **Priority 2: User Management** (Foundation)
65
+ - Authentication needed by all services
66
+ - Well-defined boundaries
67
+ - Critical for security
68
+
69
+ 3. **Priority 3: Order Processing** (High value)
70
+ - Complex business logic
71
+ - High transaction volume
72
+ - Needs independent scaling
73
+
74
+ 4. **Priority 4: Payment** (Compliance)
75
+ - PCI DSS compliance requirements
76
+ - Needs isolation for security
77
+ - Third-party integrations
78
+
79
+ 5. **Priority 5: Remaining Services**
80
+ - Cart, Inventory, Shipping, Notifications
81
+
82
+ ---
83
+
84
+ ## Migration Strategy: Strangler Fig Pattern
85
+
86
+ ### Phase 1: Assessment and Planning (Month 1-2)
87
+
88
+ **1. Dependency Analysis**
89
+
90
+ ```bash
91
+ # Use tools to analyze dependencies
92
+ mvn dependency:tree
93
+ jdepend -file src/
94
+ ```
95
+
96
+ **Dependency Graph**
97
+ ```
98
+ User Management
99
+
100
+ Order Processing → Payment
101
+ ↓ ↓
102
+ Inventory Shipping
103
+
104
+ Product Catalog
105
+ ```
106
+
107
+ **2. Data Analysis**
108
+
109
+ ```sql
110
+ -- Identify shared tables
111
+ SELECT table_name, COUNT(DISTINCT module) as module_count
112
+ FROM table_usage
113
+ GROUP BY table_name
114
+ HAVING COUNT(DISTINCT module) > 1;
115
+
116
+ -- Results:
117
+ -- users: 8 modules (high coupling!)
118
+ -- products: 5 modules
119
+ -- orders: 4 modules
120
+ ```
121
+
122
+ **3. Team Structure**
123
+
124
+ ```
125
+ Before:
126
+ - 5 teams, each working on multiple modules
127
+ - Shared codebase, merge conflicts
128
+
129
+ After:
130
+ - 8 teams, each owning 1-2 services
131
+ - Independent repositories
132
+ - Clear ownership
133
+ ```
134
+
135
+ ### Phase 2: Infrastructure Setup (Month 3)
136
+
137
+ **1. API Gateway**
138
+
139
+ ```yaml
140
+ # kong.yml
141
+ services:
142
+ - name: legacy-monolith
143
+ url: http://monolith:8080
144
+ routes:
145
+ - name: default-route
146
+ paths:
147
+ - /
148
+ strip_path: false
149
+
150
+ - name: product-service
151
+
152
+ ---
153
+
154
+ ## Phase 3: Extract First Service - Product Catalog (Month 4-5)
155
+
156
+ ### Step 1: Create New Microservice
157
+
158
+ **Product Service (Node.js/TypeScript)**
159
+
160
+ ```typescript
161
+ // product-service/src/domain/product.ts
162
+ export interface Product {
163
+ id: string;
164
+ name: string;
165
+ description: string;
166
+ price: number;
167
+ categoryId: string;
168
+ inventory: number;
169
+ images: string[];
170
+ }
171
+
172
+ // product-service/src/application/product.service.ts
173
+ export class ProductService {
174
+ constructor(
175
+ private readonly productRepo: ProductRepository,
176
+ private readonly cache: CacheService,
177
+ private readonly eventBus: EventBus
178
+ ) {}
179
+
180
+ async getProduct(productId: string): Promise<Product> {
181
+ // Check cache first (new optimization)
182
+ const cached = await this.cache.get(`product:${productId}`);
183
+ if (cached) return cached;
184
+
185
+ // Fetch from new database
186
+ const product = await this.productRepo.findById(productId);
187
+ if (!product) throw new NotFoundException('Product not found');
188
+
189
+ // Cache for 1 hour
190
+ await this.cache.set(`product:${productId}`, product, 3600);
191
+ return product;
192
+ }
193
+
194
+ async updateProduct(productId: string, updates: Partial<Product>): Promise<Product> {
195
+ const product = await this.productRepo.update(productId, updates);
196
+
197
+ // Invalidate cache
198
+ await this.cache.delete(`product:${productId}`);
199
+
200
+ // Publish event for other services
201
+ await this.eventBus.publish('product.updated', {
202
+ productId,
203
+ updates,
204
+ timestamp: new Date()
205
+ });
206
+
207
+ return product;
208
+ }
209
+ }
210
+ ```
211
+
212
+ ### Step 2: Create Facade in Monolith
213
+
214
+ **Strangler Fig Facade Pattern**
215
+
216
+ ```java
217
+ // monolith/src/main/java/com/ecommerce/product/ProductFacade.java
218
+ @Service
219
+ public class ProductFacade {
220
+ private final LegacyProductService legacyService;
221
+ private final ProductServiceClient newServiceClient;
222
+ private final FeatureFlagService featureFlags;
223
+ private final MetricsService metrics;
224
+
225
+ public Product getProduct(String productId) {
226
+ boolean useNewService = featureFlags.isEnabled("new-product-service", productId);
227
+
228
+ long startTime = System.currentTimeMillis();
229
+ try {
230
+ Product product;
231
+ if (useNewService) {
232
+ product = newServiceClient.getProduct(productId);
233
+ metrics.recordServiceCall("product-service-new", System.currentTimeMillis() - startTime);
234
+ } else {
235
+ product = legacyService.getProduct(productId);
236
+ metrics.recordServiceCall("product-service-legacy", System.currentTimeMillis() - startTime);
237
+ }
238
+ return product;
239
+ } catch (Exception e) {
240
+ // Fallback to legacy on error
241
+ if (useNewService) {
242
+ logger.error("New service failed, falling back to legacy", e);
243
+ return legacyService.getProduct(productId);
244
+ }
245
+ throw e;
246
+ }
247
+ }
248
+ }
249
+
250
+ // Feature flag configuration
251
+ @Configuration
252
+ public class FeatureFlagConfig {
253
+ @Bean
254
+ public FeatureFlagService featureFlagService() {
255
+ return new FeatureFlagService()
256
+ .addFlag("new-product-service", new PercentageRollout(0)); // Start at 0%
257
+ }
258
+ }
259
+ ```
260
+
261
+ ### Step 3: Data Migration Strategy
262
+
263
+ **Dual-Write Pattern**
264
+
265
+ ```java
266
+ // monolith/src/main/java/com/ecommerce/product/ProductService.java
267
+ @Service
268
+ public class ProductService {
269
+ private final ProductRepository legacyRepo;
270
+ private final ProductServiceClient newServiceClient;
271
+ private final EventPublisher eventPublisher;
272
+
273
+ @Transactional
274
+ public Product updateProduct(String productId, ProductUpdate update) {
275
+ // 1. Write to legacy database (source of truth during migration)
276
+ Product product = legacyRepo.update(productId, update);
277
+
278
+ // 2. Async write to new service
279
+ CompletableFuture.runAsync(() -> {
280
+ try {
281
+ newServiceClient.updateProduct(productId, update);
282
+ } catch (Exception e) {
283
+ logger.error("Failed to sync to new service", e);
284
+ // Publish event for retry
285
+ eventPublisher.publish("product.sync.failed", productId);
286
+ }
287
+ });
288
+
289
+ return product;
290
+ }
291
+ }
292
+ ```
293
+
294
+ **Data Synchronization Job**
295
+
296
+ ```java
297
+ // monolith/src/main/java/com/ecommerce/migration/DataSyncJob.java
298
+ @Component
299
+ public class ProductDataSyncJob {
300
+
301
+ @Scheduled(cron = "0 0 2 * * *") // Run at 2 AM daily
302
+ public void syncProducts() {
303
+ logger.info("Starting product data sync");
304
+
305
+ int batchSize = 1000;
306
+ int offset = 0;
307
+ int synced = 0;
308
+
309
+ while (true) {
310
+ List<Product> products = legacyRepo.findAll(offset, batchSize);
311
+ if (products.isEmpty()) break;
312
+
313
+ for (Product product : products) {
314
+ try {
315
+ newServiceClient.upsertProduct(product);
316
+ synced++;
317
+ } catch (Exception e) {
318
+ logger.error("Failed to sync product: " + product.getId(), e);
319
+ }
320
+ }
321
+
322
+ offset += batchSize;
323
+ logger.info("Synced {} products", synced);
324
+ }
325
+
326
+ logger.info("Product data sync completed. Total synced: {}", synced);
327
+ }
328
+ }
329
+ ```
330
+
331
+ ### Step 4: Gradual Traffic Migration
332
+
333
+ **Week-by-Week Rollout**
334
+
335
+ ```java
336
+ // Week 1: 5% traffic
337
+ featureFlagService.updateFlag("new-product-service", new PercentageRollout(5));
338
+
339
+ // Week 2: Monitor metrics, increase to 25%
340
+ featureFlagService.updateFlag("new-product-service", new PercentageRollout(25));
341
+
342
+ // Week 3: 50% traffic
343
+ featureFlagService.updateFlag("new-product-service", new PercentageRollout(50));
344
+
345
+ // Week 4: 100% traffic
346
+ featureFlagService.updateFlag("new-product-service", new PercentageRollout(100));
347
+ ```
348
+
349
+ **Monitoring Dashboard**
350
+
351
+ ```typescript
352
+ // Grafana dashboard queries
353
+ // Error rate comparison
354
+ sum(rate(http_requests_total{service="product-service-new",status=~"5.."}[5m])) /
355
+ sum(rate(http_requests_total{service="product-service-new"}[5m]))
356
+
357
+ vs
358
+
359
+ sum(rate(http_requests_total{service="product-service-legacy",status=~"5.."}[5m])) /
360
+ sum(rate(http_requests_total{service="product-service-legacy"}[5m]))
361
+
362
+ // Latency comparison (P95)
363
+ histogram_quantile(0.95,
364
+ sum(rate(http_request_duration_seconds_bucket{service="product-service-new"}[5m])) by (le)
365
+ )
366
+
367
+ vs
368
+
369
+ histogram_quantile(0.95,
370
+ sum(rate(http_request_duration_seconds_bucket{service="product-service-legacy"}[5m])) by (le)
371
+ )
372
+ ```
373
+
374
+ ### Step 5: Database Cutover
375
+
376
+ **Switch to New Database as Source of Truth**
377
+
378
+ ```java
379
+ // Phase 1: Dual-write (legacy primary)
380
+ // Legacy DB ← Write
381
+ // New DB ← Async write
382
+
383
+ // Phase 2: Dual-write (new primary)
384
+ // New DB ← Write
385
+ // Legacy DB ← Async write (for rollback safety)
386
+
387
+ // Phase 3: New only
388
+ // New DB ← Write
389
+ // Legacy DB ← Read-only (archived)
390
+
391
+ @Service
392
+ public class ProductService {
393
+
394
+ @Transactional
395
+ public Product updateProduct(String productId, ProductUpdate update) {
396
+ // Phase 2: New database is primary
397
+ Product product = newServiceClient.updateProduct(productId, update);
398
+
399
+ // Async write to legacy for safety
400
+ CompletableFuture.runAsync(() -> {
401
+ try {
402
+ legacyRepo.update(productId, update);
403
+ } catch (Exception e) {
404
+ logger.warn("Failed to sync to legacy DB", e);
405
+ }
406
+ });
407
+
408
+ return product;
409
+ }
410
+ }
411
+ ```
412
+
413
+ ---
414
+
415
+ ## Phase 4: Extract Remaining Services (Month 6-12)
416
+
417
+ ### Service Extraction Order
418
+
419
+ **Month 6: User Service**
420
+ - Authentication and authorization
421
+ - JWT token generation
422
+ - User profile management
423
+ - OAuth integration
424
+
425
+ **Month 7-8: Order Service**
426
+ - Order creation and processing
427
+ - Saga pattern for distributed transactions
428
+ - Event sourcing for order history
429
+
430
+ **Month 9: Payment Service**
431
+ - PCI DSS compliance isolation
432
+ - Stripe/PayPal integration
433
+ - Fraud detection
434
+
435
+ **Month 10: Inventory Service**
436
+ - Stock management
437
+ - Reservation system
438
+ - Warehouse integration
439
+
440
+ **Month 11: Shipping Service**
441
+ - Carrier integration
442
+ - Tracking updates
443
+ - Delivery notifications
444
+
445
+ **Month 12: Cart & Notification Services**
446
+ - Shopping cart (Redis-based)
447
+ - Email/SMS notifications
448
+
449
+ ---
450
+
451
+ ## Challenges and Solutions
452
+
453
+ ### Challenge 1: Data Consistency
454
+
455
+ **Problem**: Distributed transactions across services
456
+
457
+ **Solution**: Saga Pattern
458
+
459
+ ```typescript
460
+ // order-service/src/sagas/order-saga.ts
461
+ export class OrderSaga {
462
+ async createOrder(orderData: CreateOrderDto): Promise<Order> {
463
+ const sagaId = uuidv4();
464
+
465
+ try {
466
+ // Step 1: Reserve inventory
467
+ await this.inventoryService.reserve(sagaId, orderData.items);
468
+
469
+ // Step 2: Process payment
470
+ await this.paymentService.charge(sagaId, orderData.payment);
471
+
472
+ // Step 3: Create shipment
473
+ await this.shippingService.createShipment(sagaId, orderData.address);
474
+
475
+ // Step 4: Create order
476
+ return await this.orderRepo.create(orderData);
477
+ } catch (error) {
478
+ // Compensating transactions
479
+ await this.compensate(sagaId);
480
+ throw error;
481
+ }
482
+ }
483
+
484
+ private async compensate(sagaId: string): Promise<void> {
485
+ await this.shippingService.cancelShipment(sagaId);
486
+ await this.paymentService.refund(sagaId);
487
+ await this.inventoryService.release(sagaId);
488
+ }
489
+ }
490
+ ```
491
+
492
+ ### Challenge 2: Service Communication
493
+
494
+ **Problem**: Synchronous HTTP calls create tight coupling
495
+
496
+ **Solution**: Event-Driven Architecture
497
+
498
+ ```typescript
499
+ // Event publisher
500
+ export class ProductService {
501
+ async updateProduct(productId: string, updates: Partial<Product>): Promise<Product> {
502
+ const product = await this.productRepo.update(productId, updates);
503
+
504
+ // Publish event instead of calling services directly
505
+ await this.eventBus.publish('product.updated', {
506
+ productId,
507
+ updates,
508
+ timestamp: new Date()
509
+ });
510
+
511
+ return product;
512
+ }
513
+ }
514
+
515
+ // Event consumer (Inventory Service)
516
+ export class InventoryEventHandler {
517
+ @EventHandler('product.updated')
518
+ async onProductUpdated(event: ProductUpdatedEvent): Promise<void> {
519
+ // Update inventory cache
520
+ await this.cache.invalidate(`inventory:${event.productId}`);
521
+ }
522
+ }
523
+ ```
524
+
525
+ ### Challenge 3: Testing
526
+
527
+ **Problem**: Integration testing across services
528
+
529
+ **Solution**: Contract Testing
530
+
531
+ ```typescript
532
+ // product-service/tests/contracts/product.contract.test.ts
533
+ import { Pact } from '@pact-foundation/pact';
534
+
535
+ describe('Product Service Contract', () => {
536
+ const provider = new Pact({
537
+ consumer: 'order-service',
538
+ provider: 'product-service'
539
+ });
540
+
541
+ it('should get product by ID', async () => {
542
+ await provider
543
+ .given('product exists')
544
+ .uponReceiving('a request for product')
545
+ .withRequest({
546
+ method: 'GET',
547
+ path: '/api/products/123'
548
+ })
549
+ .willRespondWith({
550
+ status: 200,
551
+ body: {
552
+ id: '123',
553
+ name: 'Test Product',
554
+ price: 99.99
555
+ }
556
+ });
557
+
558
+ const client = new ProductServiceClient(provider.mockService.baseUrl);
559
+ const product = await client.getProduct('123');
560
+
561
+ expect(product.id).toBe('123');
562
+ });
563
+ });
564
+ ```
565
+
566
+ ---
567
+
568
+ ## Results and Metrics
569
+
570
+ ### Before Migration (Monolith)
571
+
572
+ - **Deployment Frequency**: Weekly
573
+ - **Deployment Time**: 2 hours
574
+ - **Lead Time**: 2-4 weeks
575
+ - **MTTR**: 4 hours
576
+ - **Team Velocity**: 50 story points/sprint
577
+ - **Scalability**: Vertical only
578
+ - **Technology**: Java only
579
+
580
+ ### After Migration (Microservices)
581
+
582
+ - **Deployment Frequency**: Multiple times per day
583
+ - **Deployment Time**: 10 minutes per service
584
+ - **Lead Time**: 2-5 days
585
+ - **MTTR**: 30 minutes
586
+ - **Team Velocity**: 80 story points/sprint
587
+ - **Scalability**: Horizontal, per-service
588
+ - **Technology**: Java, Node.js, Python, Go
589
+
590
+ ### Performance Improvements
591
+
592
+ - **API Response Time**: 40% faster (caching, optimized services)
593
+ - **Database Load**: 60% reduction (service-specific databases)
594
+ - **Availability**: 99.9% → 99.95%
595
+ - **Cost**: 30% reduction (right-sized services)
596
+
597
+ ---
598
+
599
+ ## Key Takeaways
600
+
601
+ ### Success Factors
602
+
603
+ 1. **Incremental Migration**: Strangler Fig Pattern allowed gradual, low-risk migration
604
+ 2. **Feature Flags**: Enabled safe rollout and quick rollback
605
+ 3. **Dual-Write**: Ensured data consistency during migration
606
+ 4. **Monitoring**: Comprehensive observability caught issues early
607
+ 5. **Team Ownership**: Clear service ownership improved velocity
608
+ 6. **Event-Driven**: Reduced coupling between services
609
+
610
+ ### Lessons Learned
611
+
612
+ 1. **Start Small**: Begin with low-risk, high-value service (Product Catalog)
613
+ 2. **Data is Hard**: Spend time on data migration strategy
614
+ 3. **Observability First**: Set up monitoring before migration
615
+ 4. **Team Training**: Invest in microservices training
616
+ 5. **Don't Rush**: Take time to do it right
617
+ 6. **Keep Monolith Running**: Maintain monolith until fully migrated
618
+
619
+ ### Common Pitfalls to Avoid
620
+
621
+ - ❌ **Big Bang Migration**: Migrate incrementally instead
622
+ - ❌ **Distributed Monolith**: Ensure proper service boundaries
623
+ - ❌ **Ignoring Data**: Plan data migration carefully
624
+ - ❌ **No Rollback Plan**: Always have a way to roll back
625
+ - ❌ **Premature Optimization**: Don't over-engineer early services
626
+ - ❌ **Skipping Tests**: Maintain test coverage throughout
627
+
628
+ ---
629
+
630
+ ## Timeline Summary
631
+
632
+ | Phase | Duration | Activities | Outcome |
633
+ |-------|----------|------------|---------|
634
+ | Assessment | Month 1-2 | Dependency analysis, team planning | Migration roadmap |
635
+ | Infrastructure | Month 3 | API Gateway, service mesh, monitoring | Foundation ready |
636
+ | Product Service | Month 4-5 | Extract, migrate data, rollout | First service live |
637
+ | User Service | Month 6 | Authentication, OAuth | Auth decoupled |
638
+ | Order Service | Month 7-8 | Saga pattern, event sourcing | Core business logic extracted |
639
+ | Payment Service | Month 9 | PCI compliance, isolation | Security improved |
640
+ | Remaining Services | Month 10-12 | Inventory, Shipping, Cart, Notifications | Migration complete |
641
+
642
+ ---
643
+
644
+ ## References
645
+
646
+ - [Microservices Architecture](../rules/microservices-architecture.md)
647
+ - [Event-Driven Architecture](../rules/event-driven-architecture.md)
648
+ - [Challenges and Solutions](../rules/challenges-solutions.md)
649
+ - [Strangler Fig Pattern](https://martinfowler.com/bliki/StranglerFigApplication.html)
650
+ - [Saga Pattern](https://microservices.io/patterns/data/saga.html)
651
+ - [Building Microservices by Sam Newman](https://www.oreilly.com/library/view/building-microservices/9781491950340/)
652
+ - /api/products
653
+ strip_path: false
654
+ plugins:
655
+ - name: rate-limiting
656
+ config:
657
+ minute: 100
658
+ ```
659
+
660
+ **2. Service Mesh (Istio)**
661
+
662
+ ```yaml
663
+ # istio-config.yml
664
+ apiVersion: networking.istio.io/v1alpha3
665
+ kind: VirtualService
666
+ metadata:
667
+ name: product-service
668
+ spec:
669
+ hosts:
670
+ - product-service
671
+ http:
672
+ - match:
673
+ - headers:
674
+ x-use-new-service:
675
+ exact: "true"
676
+ route:
677
+ - destination:
678
+ host: product-service-v2
679
+ weight: 100
680
+ - route:
681
+ - destination:
682
+ host: product-service-v1
683
+ weight: 100
684
+ ```
685
+
686
+ **3. Observability Stack**
687
+
688
+ ```yaml
689
+ # prometheus-config.yml
690
+ global:
691
+ scrape_interval: 15s
692
+
693
+ scrape_configs:
694
+ - job_name: 'monolith'
695
+ static_configs:
696
+ - targets: ['monolith:8080']
697
+
698
+ - job_name: 'product-service'
699
+ static_configs:
700
+ - targets: ['product-service:3000']
701
+ ```
702
+
703
+