E-commerce search platform
CQRS split: the catalog writes to Postgres, CDC feeds the inverted index, and queries fan out to shards with hedging and an ML re-rank stage.
What this design does
Search is the read model taken to its logical extreme: the write side stays a boring relational catalog, CDC streams every change into a sharded inverted index, and the query side fans out, gathers, and re-ranks with a model. Hedged shard requests keep p99 flat when one shard has a bad day.
The patterns it composes
- CQRS — writes hit Postgres; reads hit an index shaped purely for queries
- Log-based CDC — the index is a derived view, rebuilt by replaying the change stream
- Scatter-gather with hedging — query all shards; hedge stragglers; gather top-K
- Re-rank stage — cheap recall from the index, expensive precision from the model on 200 candidates
- Hot-shard mitigation — shard by term-hash; replicate the hot ones
Import it, attach your own numbers, and verify the design against failures — or read the engineering notes.