# Command-Side Replica

> Keep a local read-only copy of another service's data — query it without cross-service calls.

- **Category**: Microservices
- **Subcategory**: Data Management
- **Canonical URL**: https://designpattern.fyi/patterns/command_side_replica/

---

## Description
Clean, reusable architecture pattern.


## Use Cases
Order Service keeps a local MenuReplica DB. When Restaurant Service publishes MenuUpdated events, Order Service syncs it. createOrder() validates against local replica — fast, decoupled, no synchronous call.





## Trade-offs


### Advantages

- Command handlers are fully decoupled from provider service at runtime

- No synchronous inter-service call = lower latency, better availability

- Commands can use DB-level queries on replica data (joins, filters)

- Provider service can go down without blocking commands




### Considerations & Drawbacks

- Replica is eventually consistent — commands may act on stale data

- Event schema changes require replica migration

- Adds storage overhead per consuming service

- Data duplication across the system increases







---
**Reference**: [Original Source](https://microservices.io/patterns/data/command-side-replica.html)

