Monolith
┌─────────────────────────┐ │ Single Deployable App │ │ UI│Auth│Order│Pay │ │ Single DB │ └─────────────────────────┘
সুবিধা
- Simple, in-process call দ্রুত
- ACID transaction সহজ
- Small team-এ আদর্শ
অসুবিধা
- 1 line change → পুরো deploy
- Tech lock-in, scale বাধা
- 1 crash → পুরো down
Microservices
[Auth] [Order] [Pay] [Notif] DB1 DB2 DB3 DB4 ↑ HTTP / Message Queue ↑
সুবিধা
- Independent deploy/scale
- Tech freedom, team autonomy
- Fault isolation
অসুবিধা
- Distributed complexity
- Network latency
- Distributed transaction (Saga)
- Operational overhead
"Monolith First" — Martin Fowler ⭐
Modular monolith দিয়ে শুরু করুন। Pain হলে তবেই split।
কখন Microservice?
- Team 50+ ও deploy bottleneck
- একটি component-এ 10x scale
- Tech ভিন্নতা প্রয়োজন
- Different release cadence
DDD Basics ⭐
- Domain — business area
- Bounded Context — term-এর consistent meaning
- Ubiquitous Language — dev+business একই vocab
- Aggregate — consistency boundary
- Entity, Value Object
Bounded Context = Microservice often।
Strangler Fig Pattern
1. Monolith 2. API Gateway সামনে 3. New feature → microservice 4. ধীরে ধীরে old extract 5. Monolith delete
Modular Monolith (Sweet Spot)
MyApp/ ├── Modules/ │ ├── Catalog/ (own schema) │ ├── Orders/ │ └── Payments/ └── SharedKernel/
Anti-Pattern — Distributed Monolith
Microservices আছে কিন্তু সব tightly coupled — সবচেয়ে খারাপ।