-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonolith_to_Microservices.html
More file actions
1592 lines (1575 loc) · 59.3 KB
/
Copy pathMonolith_to_Microservices.html
File metadata and controls
1592 lines (1575 loc) · 59.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Monolith to Microservices – End-to-End Journey</title>
<style>
:root {
--bg: #020617;
--bg-card: #0b1120;
--border: #1e293b;
--accent: #38bdf8;
--accent-soft: #0f172a;
--text: #e5e7eb;
--muted: #9ca3af;
--danger: #f97373;
--success: #22c55e;
--radius: 16px;
--shadow: 0 18px 45px rgba(15,23,42,0.85);
--shadow-lg: 0 25px 60px rgba(0,0,0,0.5);
--shadow-card: 0 8px 24px rgba(0,0,0,0.3);
--gradient-primary: linear-gradient(135deg, #38bdf8 0%, #22c55e 100%);
--gradient-card: linear-gradient(135deg, rgba(56,189,248,0.1) 0%, rgba(34,197,94,0.05) 100%);
}
*{box-sizing:border-box;margin:0;padding:0;}
body{
font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
background: radial-gradient(circle at top, #1e293b 0, #020617 55%);
color: var(--text);
min-height:100vh;
display:flex;
flex-direction:column;
align-items:center;
justify-content:flex-start;
padding:32px 16px 40px;
}
.deck{
width: min(1600px, 100%);
}
.frame{
background: linear-gradient(135deg,rgba(2,6,23,0.95) 0%,rgba(11,17,32,0.95) 100%);
border-radius: 24px;
padding: 20px 28px;
border:1px solid rgba(56,189,248,0.2);
box-shadow: var(--shadow-lg);
display:flex;
justify-content:space-between;
align-items:center;
margin-bottom: 24px;
position:sticky;
top:16px;
z-index:10;
backdrop-filter: blur(20px) saturate(180%);
}
.title-block h1{
font-size: 22px;
font-weight: 700;
letter-spacing: 0.02em;
display:flex;
align-items:center;
gap:12px;
background:var(--gradient-primary);
-webkit-background-clip:text;
-webkit-text-fill-color:transparent;
background-clip:text;
}
.title-pill{
font-size:18px;
text-transform:uppercase;
letter-spacing:0.16em;
color:var(--muted);
margin-top:4px;
}
.chapter-select{
display:flex;
align-items:center;
gap:10px;
font-size:18px;
color:var(--muted);
}
select{
background:#020617;
border-radius:999px;
border:1px solid rgba(56,189,248,0.3);
color:var(--text);
padding:8px 16px;
font-size:16px;
outline:none;
cursor:pointer;
transition:all 0.3s ease;
}
select:hover{
border-color:rgba(56,189,248,0.5);
background:rgba(56,189,248,0.05);
}
select:focus{
border-color:var(--accent);
box-shadow:0 0 0 3px rgba(56,189,248,0.1);
}
.nav-buttons{
display:flex;
align-items:center;
gap:8px;
}
.btn{
border-radius:999px;
border:1px solid rgba(148,163,184,0.4);
background:#020617;
color:var(--text);
padding:8px 16px;
font-size:16px;
text-transform:uppercase;
letter-spacing:0.14em;
cursor:pointer;
display:flex;
align-items:center;
gap:6px;
transition: all 0.3s ease;
font-weight:500;
}
.btn:hover{
background:rgba(56,189,248,0.1);
border-color:rgba(56,189,248,0.5);
transform:translateY(-1px);
}
.btn.primary{
background: var(--gradient-primary);
border-color: transparent;
color:#0b1120;
font-weight:600;
box-shadow: 0 4px 12px rgba(56,189,248,0.3);
}
.btn.primary:hover{
box-shadow: 0 6px 20px rgba(56,189,248,0.4);
transform:translateY(-2px);
}
.btn span.icon{
font-size:20px;
}
.counter{
font-size:18px;
color:var(--muted);
}
.slide{
background:radial-gradient(circle at top left,#020617 0,#0b1120 50%,#020617 100%);
border-radius: var(--radius);
border:1px solid rgba(56,189,248,0.15);
box-shadow: var(--shadow-lg);
padding:64px 72px 72px;
margin-bottom:24px;
display:none;
position:relative;
overflow:hidden;
}
.slide::before{
content:'';
position:absolute;
top:0;
left:0;
right:0;
height:4px;
background:var(--gradient-primary);
opacity:0.6;
}
.slide.active{
display:block;
animation:fadeIn 0.4s ease;
}
@keyframes fadeIn{
from{opacity:0;transform:translateY(10px);}
to{opacity:1;transform:translateY(0);}
}
.slide.part{
text-align:center;
padding:80px 40px 80px;
border-style:dashed;
border-color:rgba(56,189,248,0.3);
border-width:2px;
background:linear-gradient(135deg, rgba(56,189,248,0.05) 0%, rgba(34,197,94,0.03) 100%);
position:relative;
}
.slide.part::before{
content:'';
position:absolute;
top:20px;
left:20px;
right:20px;
bottom:20px;
border:1px solid rgba(56,189,248,0.2);
border-radius:12px;
pointer-events:none;
}
.slide.part h2{
font-size:16px;
text-transform:uppercase;
letter-spacing:0.3em;
color:var(--accent);
margin-bottom:16px;
font-weight:600;
}
.slide.part h1{
font-size:42px;
margin-bottom:20px;
font-weight:700;
background:var(--gradient-primary);
-webkit-background-clip:text;
-webkit-text-fill-color:transparent;
background-clip:text;
letter-spacing:-0.02em;
}
.slide.part p{
font-size:20px;
color:var(--muted);
max-width:600px;
margin:16px auto 0;
line-height:1.7;
}
.headline{
font-size:28px;
margin-bottom:8px;
display:flex;
align-items:center;
gap:12px;
font-weight:700;
color:var(--text);
letter-spacing:-0.02em;
}
.headline-tag{
font-size:12px;
padding:4px 12px;
border-radius:999px;
border:1px solid rgba(56,189,248,0.3);
background:rgba(56,189,248,0.1);
color:var(--accent);
text-transform:uppercase;
letter-spacing:0.16em;
font-weight:600;
}
.subtitle{
font-size:18px;
color:var(--muted);
margin-bottom:24px;
line-height:1.6;
font-weight:400;
}
.two-col{
display:grid;
grid-template-columns: minmax(0,1.15fr) minmax(0,0.95fr);
gap:18px;
margin-top:6px;
}
.card{
background: var(--gradient-card);
border-radius: 16px;
border:1px solid rgba(56,189,248,0.15);
padding:28px 36px 36px;
transition:all 0.3s ease;
position:relative;
box-shadow:var(--shadow-card);
}
.card::before{
content:'';
position:absolute;
top:0;
left:0;
right:0;
height:2px;
background:var(--gradient-primary);
border-radius:16px 16px 0 0;
opacity:0.5;
}
.card:hover{
transform:translateY(-2px);
box-shadow:0 12px 32px rgba(0,0,0,0.4);
border-color:rgba(56,189,248,0.25);
}
.card h3{
font-size:22px;
margin-bottom:12px;
font-weight:600;
color:var(--text);
letter-spacing:-0.01em;
}
.card p{
font-size:17px;
color:var(--muted);
line-height:1.7;
margin-bottom:12px;
}
ul{
padding-left:24px;
margin:8px 0;
list-style:none;
}
li{
font-size:18px;
line-height:1.7;
margin:6px 0;
color:#e2e8f0;
position:relative;
padding-left:24px;
}
li::before{
content:'→';
position:absolute;
left:0;
color:var(--accent);
font-weight:bold;
opacity:0.7;
}
li strong{
color:var(--accent);
font-weight:600;
}
li span.dim{
color:var(--muted);
font-size:18px;
}
.diagram{
border-radius:12px;
border:1px solid rgba(56,189,248,0.2);
background: linear-gradient(135deg, rgba(56,189,248,0.05) 0%, rgba(34,197,94,0.03) 100%);
padding:16px 20px 20px;
margin-top:12px;
box-shadow:inset 0 2px 8px rgba(0,0,0,0.2);
}
.diagram-label{
font-size:14px;
text-transform:uppercase;
letter-spacing:0.16em;
color:var(--accent);
margin-bottom:12px;
font-weight:600;
}
.diagram-grid{
display:grid;
grid-template-columns: repeat(3,minmax(0,1fr));
gap:8px;
font-size:16px;
}
.chip{
border-radius:8px;
border:1px solid rgba(56,189,248,0.3);
padding:8px 12px;
text-align:center;
background:rgba(56,189,248,0.1);
color:#e5e7eb;
font-weight:500;
transition:all 0.2s ease;
}
.chip:hover{
background:rgba(56,189,248,0.2);
border-color:rgba(56,189,248,0.5);
transform:scale(1.05);
}
.note{
font-size:16px;
color:#94a3b8;
margin-top:12px;
line-height:1.6;
font-style:italic;
padding-left:16px;
border-left:2px solid rgba(56,189,248,0.3);
}
pre{
background:linear-gradient(135deg, #0b1120 0%, #020617 100%);
border-radius:12px;
border:1px solid rgba(56,189,248,0.2);
padding:16px 20px;
font-size:16px;
color:#e5e7eb;
overflow-x:auto;
margin-top:12px;
box-shadow:inset 0 2px 8px rgba(0,0,0,0.3);
position:relative;
}
pre::before{
content:'';
position:absolute;
top:0;
left:0;
width:4px;
height:100%;
background:var(--gradient-primary);
border-radius:12px 0 0 12px;
}
code{
font-family:ui-monospace,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
font-size:15px;
line-height:1.6;
}
@media (max-width: 840px){
.frame{flex-direction:column;align-items:flex-start;gap:10px;}
.two-col{grid-template-columns: minmax(0,1fr);}
}
/* Center deck */
body {
display: flex;
flex-direction: column;
align-items: center;
}
/* Center every slide */
.slide {
margin-left: auto !important;
margin-right: auto !important;
aspect-ratio: 1 / 1;
height: 1300px; /* increased for larger canvas */
width: 1300px;
overflow-y: auto;
scrollbar-width: thin;
scrollbar-color: rgba(56,189,248,0.3) transparent;
}
.slide::-webkit-scrollbar {
width: 8px;
}
.slide::-webkit-scrollbar-track {
background: transparent;
}
.slide::-webkit-scrollbar-thumb {
background: rgba(56,189,248,0.3);
border-radius: 4px;
}
.slide::-webkit-scrollbar-thumb:hover {
background: rgba(56,189,248,0.5);
}
</style>
</head>
<body>
<div class="deck">
<div class="frame">
<div class="title-block">
<h1>Monolith → Microservices Journey</h1>
<div class="title-pill">Architecture & Patterns</div>
</div>
<div style="display:flex;align-items:center;gap:14px;">
<div class="chapter-select">
Part
<select id="chapter-select">
<option value="1">1 · Monoliths</option>
<option value="2">2 · Microservices</option>
<option value="3">3 · Migration Strategy</option>
<option value="4">4 · Migration Patterns</option>
<option value="5">5 · Comms & Reliability</option>
<option value="6">6 · Data & Transactions</option>
<option value="7">7 · Observability & Ops</option>
<option value="8">8 · Org & Anti-Patterns</option>
</select>
</div>
<div class="nav-buttons">
<button class="btn" id="prev-btn"><span class="icon">←</span>Prev</button>
<button class="btn primary" id="next-btn">Next<span class="icon">→</span></button>
<div class="counter"><span id="current-slide">1</span>/<span id="total-slides">1</span></div>
</div>
</div>
</div>
<!-- PART 1 -->
<section class="slide part" data-part="1">
<h2>Part 1</h2>
<h1>Understanding Monolithic Architectures</h1>
<p>
We start by clarifying what a monolith really is, why it’s often the most pragmatic starting point,
and what happens as it grows. This gives the baseline to understand whether microservices
are genuinely needed.
</p>
</section>
<section class="slide" data-part="1">
<div class="headline">
1. What is a Monolith?
<span class="headline-tag">Concept</span>
</div>
<div class="subtitle">
A monolithic application is deployed as a single unit: one codebase, one build artifact, one runtime, one database.
</div>
<div class="two-col">
<div class="card">
<h3>Definition</h3>
<p>
A monolith is a software system where all features are packaged, deployed, and scaled together. Internal modules
call each other via in-process calls and share a single database schema.
</p>
<ul>
<li>Single deployable (e.g., one JAR/WAR, container image, or app service).</li>
<li>Shared database used by all modules.</li>
<li>Layers (UI, business, persistence) in one codebase.</li>
<li>Often the first architecture used for a new product.</li>
<li>Three types: single-process (traditional), modular (well-structured), and distributed monolith (microservices in name only).</li><li>Common examples: Rails apps, Spring Boot monoliths, Django applications.</li><li>Deployment typically involves a single artifact (WAR, JAR, container image).</li></ul>
</div>
<div class="card">
<h3>Monolith “Diagram” – Mental Model</h3>
<div class="diagram">
<div class="diagram-label">High-Level View</div>
<div class="diagram-grid">
<div class="chip">Client</div>
<div class="chip">Monolithic App</div>
<div class="chip">Single DB</div>
</div>
</div>
<p class="note">
At this stage, the important idea is the <strong>deployment unit</strong>, not the programming language or framework.
</p>
</div>
</div>
</section>
<section class="slide" data-part="1">
<div class="headline">
2. Strengths of Monolithic Architecture
<span class="headline-tag">Architecture</span>
</div>
<div class="subtitle">
Monoliths are usually chosen first because they maximize speed and simplicity when a product is young.
</div>
<div class="two-col">
<div class="card">
<h3>Why Monoliths Are a Great Start</h3>
<ul>
<li><strong>Simple mental model</strong> – one place to look for code and behavior.</li>
<li><strong>Fast local dev</strong> – run everything on a laptop, no complex infra.</li>
<li><strong>Easy testing</strong> – end-to-end tests don’t cross network boundaries.</li>
<li><strong>Refactoring friendly</strong> – cross-cutting changes are easier in one codebase.</li>
<li><strong>Infrastructure light</strong> – no service discovery, message brokers, or gateways required early on.</li>
<li><strong>Performance</strong> – no network latency between modules; in-process calls are fast.</li><li><strong>Transaction management</strong> – ACID transactions across all modules are straightforward.</li><li><strong>Debugging</strong> – single process makes stack traces and debugging tools more effective.</li><li><strong>Cost-effective</strong> – fewer infrastructure components to manage and pay for.</li></ul>
</div>
<div class="card">
<h3>Where Monoliths Shine</h3>
<ul>
<li>Early-stage products with uncertain requirements.</li>
<li>Small teams (1–10 engineers) working closely together.</li>
<li>Systems without extreme scalability or availability needs.</li>
<li>Organizations without deep operational/distributed systems experience.</li>
<li>Studies show monoliths can handle millions of requests per day with proper architecture.</li><li>Many successful companies (GitHub, Shopify early days) started and scaled with monoliths.</li><li>The "monolith first" approach is recommended by Martin Fowler and other experts.</li></ul>
<p class="note">
A well-structured monolith can serve you for a long time. Microservices are not an upgrade by default;
they are a different set of trade-offs.
</p>
</div>
</div>
</section>
<section class="slide" data-part="1">
<div class="headline">
3. Weaknesses of Large Monoliths
<span class="headline-tag">Architecture</span>
</div>
<div class="subtitle">
As a monolith grows and more teams contribute, tight coupling and shared state can turn it into “big ball of mud”.
</div>
<div class="two-col">
<div class="card">
<h3>Technical Pain</h3>
<ul>
<li><strong>Slow deployments</strong> – deploying any feature means redeploying everything.</li>
<li><strong>High blast radius</strong> – a small bug can bring down the entire app.</li>
<li><strong>Tight coupling</strong> – modules rely on each other’s internals and shared DB tables.</li>
<li><strong>Scaling limits</strong> – must scale the whole app, even for a single hot feature.</li>
<li><strong>Tech lock-in</strong> – difficult to adopt new stacks for specific areas.</li>
<li><strong>Memory footprint</strong> – entire application loaded even if only one feature is used.</li><li><strong>Long startup times</strong> – large codebases can take minutes to start.</li><li><strong>Testing bottlenecks</strong> – full test suite runs for every change, even small ones.</li><li><strong>Resource waste</strong> – cannot optimize resource allocation per feature.</li></ul>
</div>
<div class="card">
<h3>Organizational Pain</h3>
<ul>
<li>Multiple teams touching the same modules and tables.</li>
<li>Merge conflicts and coordination overhead increase sharply.</li>
<li>Releases become rarer, riskier, and require code freezes.</li>
<li>New hires take weeks just to navigate the codebase.</li>
<li>Conway's Law: architecture reflects organizational structure. Monoliths often lead to monolithic teams.</li><li>Knowledge silos develop as codebase grows, making onboarding difficult.</li><li>Release coordination becomes a bottleneck as more teams contribute.</li></ul>
<p class="note">
These are <em>symptoms</em> that you may have outgrown the monolith, not proof that monoliths are bad.
</p>
</div>
</div>
</section>
<section class="slide" data-part="1">
<div class="headline">
4. When to Keep a Monolith
<span class="headline-tag">Guidance</span>
</div>
<div class="subtitle">
The goal is not microservices. The goal is sustainable delivery and reliability. Sometimes that means staying monolithic for longer.
</div>
<div class="two-col">
<div class="card">
<h3>Good Reasons to Stay Monolithic</h3>
<ul>
<li>Your product and domain are still evolving rapidly.</li>
<li>The team is small and can coordinate effectively.</li>
<li>Current performance, reliability, and release cadence are acceptable.</li>
<li>Operational maturity (monitoring, automation) is limited.</li>
</ul>
<h3 style="margin-top:8px;">Signals You Can Wait</h3>
<ul>
<li>Releases are frequent and not too stressful.</li>
<li>Most features can be implemented in a single place without major cross-module changes.</li>
</ul>
</div>
<div class="card">
<h3>Preparing for Future Splits</h3>
<ul>
<li>Enforce modular structure and clear internal APIs.</li>
<li>Reduce “reach into everything” patterns (e.g., shared util god-classes).</li>
<li>Avoid cross-module DB access – treat some modules as “owners” of tables.</li>
<li>Extract domain concepts (Orders, Billing, Inventory) behind interfaces.</li>
</ul>
<p class="note">
Think of this as “monolith with microservices-ready internals”.
</p>
</div>
</div>
</section>
<!-- PART 2 -->
<section class="slide part" data-part="2">
<h2>Part 2</h2>
<h1>Microservices Fundamentals</h1>
<p>
Having seen where monoliths work and where they hurt, we now examine microservices:
what they are, what they promise, and what new kinds of complexity they introduce.
</p>
</section>
<section class="slide" data-part="2">
<div class="headline">
5. Microservices Architecture Overview
<span class="headline-tag">Architecture</span>
</div>
<div class="subtitle">
A microservices architecture decomposes a system into a suite of small, autonomous services, each owning its data and behavior.
</div>
<div class="two-col">
<div class="card">
<h3>Concept</h3>
<ul>
<li>Each service focuses on a specific business capability.</li>
<li>Services are independently deployable and scalable.</li>
<li>Services communicate via network protocols (HTTP/gRPC/messaging).</li>
<li>Each service owns its database (no shared schemas).</li>
<li>Services typically range from 100-1000 lines of code to several thousand, but size is less important than autonomy.</li><li>Communication can be synchronous (REST, gRPC) or asynchronous (messaging, events).</li><li>Each service should be deployable independently without coordinating with other services.</li><li>Services are organized around business capabilities, not technical layers.</li></ul>
<p class="note">
This is as much an <strong>organizational</strong> model (teams owning services) as it is a technical model.
</p>
</div>
<div class="card">
<h3>High-Level Structure</h3>
<div class="diagram">
<div class="diagram-label">Typical Layout</div>
<div class="diagram-grid">
<div class="chip">Client</div>
<div class="chip">API Gateway</div>
<div class="chip">Auth / Edge</div>
<div class="chip">Order Service</div>
<div class="chip">Billing Service</div>
<div class="chip">Inventory Service</div>
<div class="chip">Order DB</div>
<div class="chip">Billing DB</div>
<div class="chip">Inventory DB</div>
</div>
</div>
</div>
</div>
</section>
<section class="slide" data-part="2">
<div class="headline">
6. Benefits of Microservices
<span class="headline-tag">Architecture</span>
</div>
<div class="subtitle">
Microservices trade intra-process simplicity for flexibility in deployment, scaling, and team autonomy.
</div>
<div class="two-col">
<div class="card">
<h3>Technical Benefits</h3>
<ul>
<li>Independent deployment and rollback of services.</li>
<li>Independent scaling: scale Checkout without scaling Catalog.</li>
<li>Technology diversity: use the right DB/stack per service.</li>
<li>Better fault isolation when resilience patterns are applied.</li>
<li><strong>Technology diversity</strong> – use Node.js for real-time features, Python for ML, Java for enterprise logic.</li><li><strong>Fault isolation</strong> – one service failure doesn't bring down the entire system.</li><li><strong>Performance optimization</strong> – optimize each service for its specific workload.</li><li><strong>Independent scaling</strong> – scale high-traffic services independently (e.g., 10x for checkout, 1x for reports).</li></ul>
</div>
<div class="card">
<h3>Business & Org Benefits</h3>
<ul>
<li>Teams own services end-to-end (you build it, you run it).</li>
<li>Parallel delivery: multiple teams can ship without blocking each other.</li>
<li>Faster time-to-market for localized changes.</li>
<li>Enables "you build it, you run it" culture, increasing ownership and accountability.</li><li>Allows parallel development: multiple teams can work simultaneously without blocking.</li><li>Faster feature delivery for isolated changes (days vs weeks in large monoliths).</li><li>Better alignment with business structure: teams organized by business domain.</li></ul>
<p class="note">
These benefits materialize only if service boundaries and ownership are thoughtfully designed.
</p>
</div>
</div>
</section>
<section class="slide" data-part="2">
<div class="headline">
7. Challenges & Costs of Microservices
<span class="headline-tag">Architecture</span>
</div>
<div class="subtitle">
Microservices solve some problems but introduce others, especially around operations and data consistency.
</div>
<div class="two-col">
<div class="card">
<h3>Technical Complexity</h3>
<ul>
<li>Network failures, latency, retries, timeouts, and backpressure.</li>
<li>No ACID transactions across services – need Sagas and eventual consistency.</li>
<li>Distributed debugging: one request touches many services.</li>
<li>Testing challenges: integration and end-to-end suites are heavier.</li>
<li><strong>Network latency</strong> – every service call adds network overhead (typically 1-10ms per hop).</li><li><strong>Data consistency</strong> – eventual consistency requires careful design and user experience considerations.</li><li><strong>Distributed transactions</strong> – no ACID across services; must use Sagas or compensate manually.</li><li><strong>Testing complexity</strong> – need contract testing, integration testing, and distributed tracing.</li></ul>
</div>
<div class="card">
<h3>Operational & Org Costs</h3>
<ul>
<li>More services to deploy, monitor, secure, and upgrade.</li>
<li>Need for mature CI/CD, observability, and incident management.</li>
<li>Risk of a “distributed monolith” if boundaries are poor.</li>
<li>Operational overhead: need to monitor, deploy, and maintain many more services.</li><li>Cost: more infrastructure, more tooling, more operational staff.</li><li>Security: more attack surface, need service-to-service authentication.</li><li>Complexity: debugging distributed systems requires sophisticated tooling and skills.</li></ul>
<p class="note">
Microservices require investing in a platform and operations culture, not just code changes.
</p>
</div>
</div>
</section>
<section class="slide" data-part="2">
<div class="headline">
8. When Microservices Make Sense
<span class="headline-tag">Guidance</span>
</div>
<div class="subtitle">
You should adopt microservices to solve concrete business and delivery problems, not to follow a trend.
</div>
<div class="two-col">
<div class="card">
<h3>Good Triggers</h3>
<ul>
<li>Many teams are blocked by a shared monolith.</li>
<li>Different subdomains evolve at very different speeds.</li>
<li>Individual capabilities have distinct scaling / availability needs.</li>
<li>Regulatory/security constraints require isolation of certain domains.</li>
</ul>
</div>
<div class="card">
<h3>Prerequisites</h3>
<ul>
<li>Basic observability: logs, metrics, alerting, and tracing.</li>
<li>Automated testing and CI/CD are in place for the monolith.</li>
<li>Rough domain understanding (bounded contexts, key capabilities).</li>
<li>Leadership aligned on trade-offs and willing to invest in platform work.</li>
</ul>
</div>
</div>
</section>
<!-- PART 3 -->
<section class="slide part" data-part="3">
<h2>Part 3</h2>
<h1>Migration Strategy & Roadmap</h1>
<p>
How do we move from a large, successful monolith to a microservices architecture without a dangerous big-bang rewrite?
This part focuses on strategy and sequencing.
</p>
</section>
<section class="slide" data-part="3">
<div class="headline">
9. Why Migrate from a Monolith?
<span class="headline-tag">Strategy</span>
</div>
<div class="subtitle">
Migration is justified only when it supports business goals: faster delivery, better reliability, or cost-effective scaling.
</div>
<div class="two-col">
<div class="card">
<h3>Good Reasons</h3>
<ul>
<li>Releases are too slow and risky; features miss market windows.</li>
<li>Teams constantly block each other on shared modules and DB tables.</li>
<li>Scaling the monolith is expensive or hitting hard limits.</li>
<li>Some domains need different availability or compliance properties.</li>
</ul>
</div>
<div class="card">
<h3>Bad Reasons</h3>
<ul>
<li>“Everyone cool is doing microservices”.</li>
<li>Desire to rewrite everything in a new language.</li>
<li>Trying to fix bad code or poor testing purely with a new architecture.</li>
</ul>
<p class="note">
Be explicit: <strong>what pain</strong> will microservices reduce, and how will you measure it (lead time, MTTR, scalability)?
</p>
</div>
</div>
</section>
<section class="slide" data-part="3">
<div class="headline">
10. Phased Migration Roadmap
<span class="headline-tag">Strategy</span>
</div>
<div class="subtitle">
Large rewrites fail. Successful migrations are incremental, with value delivered at each step.
</div>
<div class="card">
<h3>Typical Phases</h3>
<ul>
<li><strong>Assess</strong> – inventory domains, modules, dependencies, and pain points.</li>
<li><strong>Design</strong> – define domain boundaries and target service architecture.</li>
<li><strong>Pilot</strong> – extract one or two non-critical capabilities as services.</li>
<li><strong>Iterate</strong> – repeat extraction, gradually shrinking the monolith.</li>
<li><strong>Consolidate</strong> – simplify legacy code, retire dead paths and tables.</li>
</ul>
<p class="note">
Each step should maintain a working system in production. There is no “flag day”.
</p>
</div>
</section>
<section class="slide" data-part="3">
<div class="headline">
11. Choosing Your First Service
<span class="headline-tag">Strategy</span>
</div>
<div class="subtitle">
The first extraction is as much about learning how to migrate as it is about the specific service itself.
</div>
<div class="two-col">
<div class="card">
<h3>Selection Criteria</h3>
<ul>
<li>Meaningful business value, but not safety-critical.</li>
<li>Reasonable domain clarity & limited coupling.</li>
<li>Good candidate for independent scaling or evolution.</li>
<li>Allows exercising infra: monitoring, deployment, rollback.</li>
</ul>
</div>
<div class="card">
<h3>Good Examples</h3>
<ul>
<li>Notification service (email/SMS/push).</li>
<li>Reporting or read-only catalog capabilities.</li>
<li>Promo/pricing engine that has clear inputs/outputs.</li>
</ul>
<p class="note">
Avoid starting with the most critical or complex domain (e.g., Payments) as your first service.
</p>
</div>
</div>
</section>
<!-- PART 4: Migration Patterns -->
<section class="slide part" data-part="4">
<h2>Part 4</h2>
<h1>Migration Patterns</h1>
<p>
Patterns that let you peel features away from a monolith while keeping the system running:
Strangler Fig, domain-based decomposition, Anti-Corruption Layers, and more.
</p>
</section>
<section class="slide" data-part="4">
<div class="headline">
12. Strangler Fig Pattern
<span class="headline-tag">Migration</span>
</div>
<div class="subtitle">
Incrementally replace pieces of the monolith by routing selected flows to new services through a façade.
</div>
<div class="two-col">
<div class="card">
<h3>Idea</h3>
<ul>
<li>Put a routing layer (API gateway, reverse proxy) in front of the monolith.</li>
<li>For new or migrated endpoints, route to microservices instead.</li>
<li>Over time, fewer requests hit the monolith until it can be retired or greatly slimmed down.</li>
<li>Named after the strangler fig tree that grows around and eventually replaces its host.</li><li>Can take months or years to complete; patience is key.</li><li>Allows gradual migration without disrupting existing functionality.</li></ul>
<h3 style="margin-top:8px;">Benefits</h3>
<ul>
<li>Safe, incremental migration without big-bang rewrites.</li>
<li>Easy rollback: revert routing rules if needed.</li>
<li>Allows continuous delivery while modernizing.</li>
</ul>
</div>
<div class="card">
<h3>Example Routing</h3>
<pre><code># NGINX-style pseudo config
location /api/orders/ {
proxy_pass http://order-service;
}
location /api/ {
proxy_pass http://legacy-monolith;
}</code></pre><p class="note">Tools: NGINX, Envoy, AWS API Gateway, Kong. Start with new features, migrate read operations first, use feature flags for gradual traffic shift.</p>
<p class="note">
Start with read-only features or new functionality, then migrate write flows carefully.
</p>
</div>
</div>
</section>
<section class="slide" data-part="4">
<div class="headline">
13. Decompose by Business Capability
<span class="headline-tag">Decomposition</span>
</div>
<div class="subtitle">
Use stable business capabilities (Orders, Billing, Inventory, Customers) as the main axis of decomposition.
</div>
<div class="two-col">
<div class="card">
<h3>Why Capabilities?</h3>
<ul>
<li>Capabilities map to how the business thinks and measures value.</li>
<li>Boundaries tend to be more stable than technical layers.</li>
<li>Ownership is clear: one team = one or a few capabilities.</li>
</ul>
</div>
<div class="card">
<h3>Example Capability Map</h3>
<ul>
<li>Ordering – place orders, manage lifecycle.</li>
<li>Billing – invoices, payments, refunds.</li>
<li>Inventory – stock levels, reservations.</li>
<li>Customer – profiles, preferences.</li>
</ul>
</div>
</div>
</section>
<section class="slide" data-part="4">
<div class="headline">
14. Decompose by Subdomain (DDD)
<span class="headline-tag">DDD</span>
</div>
<div class="subtitle">
Domain-Driven Design (DDD) encourages modeling subdomains and bounded contexts, then mapping them to services.
</div>
<div class="two-col">
<div class="card">
<h3>Bounded Contexts</h3>
<ul>
<li>Each context has its own model and ubiquitous language.</li>
<li>Different contexts can use different data models and rules.</li>
<li>Context boundaries often align with microservice boundaries.</li>
</ul>
</div>
<div class="card">
<h3>Example Context Map</h3>
<ul>
<li>Ordering ↔ Billing (conformist relationship).</li>
<li>Ordering ↔ Inventory (published language – shared events).</li>
</ul>
<p class="note">
Bounded contexts give you a vocabulary to decide where service boundaries should exist.
</p>
</div>
</div>
</section>
<section class="slide" data-part="4">
<div class="headline">
15. Branch by Abstraction
<span class="headline-tag">Refactoring</span>
</div>
<div class="subtitle">
Create an abstraction in the monolith, build a new implementation behind it, and switch over without long-lived branches.
</div>
<div class="two-col">
<div class="card">
<h3>Steps</h3>
<ul>
<li>Introduce an interface/facade (e.g., <code>OrderService</code>).</li>
<li>Refactor existing code to depend on the interface, not the concrete implementation.</li>
<li>Implement the new behavior (maybe a microservice) behind the same interface.</li>
<li>Switch the binding from old to new implementation, then remove the old one.</li>
</ul>
</div>
<div class="card">
<h3>Benefits & Risks</h3>
<ul>
<li>System stays deployable throughout the migration.</li>
<li>Enables side-by-side testing of old vs new behavior.</li>
<li>Requires discipline to clean up abstractions once migration finishes.</li>
</ul>
</div>
</div>
</section>
<section class="slide" data-part="4">
<div class="headline">
16. Anti-Corruption Layer (ACL)
<span class="headline-tag">Migration</span>
</div>
<div class="subtitle">
Protect new services from inheriting the legacy domain model and quirks of the monolith.
</div>
<div class="two-col">
<div class="card">
<h3>Problem</h3>
<p>
The monolith’s model is messy: overloaded concepts, leaky abstractions, weird data encodings.
You don’t want to drag this into new services.
</p>
<h3 style="margin-top:6px;">Solution</h3>
<ul>