Service-Level Architecture
NDP Microservices Interaction
This diagram shows how the Egypt NDP microservices interact with each other and the infrastructure components.
Prescription Service Flow
Dispense Service Flow
Service Communication Patterns
1. Synchronous REST APIs
Used for:
- Real-time queries
- CRUD operations
- Registry lookups
2. Asynchronous Events (Kafka)
Used for:
- Audit logging
- Notifications
- Data replication
- Analytics
3. Caching Strategy (Redis)
Used for:
- Registry data
- Session management
- Rate limiting
- Temporary storage
Service Dependencies Matrix
| Service | PostgreSQL | MySQL | MongoDB | Redis | Kafka | Consul | Vault |
|---|---|---|---|---|---|---|---|
| Prescription Service | ✅ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ |
| Dispense Service | ✅ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ |
| Patient Registry | ✅ | ❌ | ❌ | ✅ | ❌ | ✅ | ✅ |
| HPR Registry | ✅ | ❌ | ❌ | ✅ | ❌ | ✅ | ✅ |
| Pharmacy Registry | ❌ | ✅ | ❌ | ✅ | ❌ | ✅ | ✅ |
| Medicine Directory | ❌ | ✅ | ❌ | ✅ | ❌ | ✅ | ✅ |
| Audit Service | ❌ | ❌ | ✅ | ❌ | ✅ | ✅ | ✅ |
| Notification Service | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ |
API Gateway Routing
Data Flow Architecture
Service Health & Resilience
Circuit Breaker Pattern
Health Check Architecture
Next Steps
- Network Architecture - Detailed network topology
- Gateway Stack - Deploy the API gateway
- Application Stack - Deploy NDP services