Storefront has been decoupled into micro-frontends with a dedicated commerce app and shared shell.

Read the architecture guide →

Feedback and Rating Projection

Propagating review changes to catalog ratings and compensating invalid references.

Runtime Scenario

Rating API owns individual feedback records, while Catalog API owns the derived average rating and review count. Feedback changes are published asynchronously so catalog reads remain independent of the review store.

Purpose & Trigger

The flow creates or deletes a review and updates the corresponding catalog summary. It starts when a customer or administrator submits a feedback write.

Visual References

Feedback and Rating Projection

Loading graph...

Step-by-Step Walkthrough

  1. The caller submits feedback through API Gateway; Rating API validates and commits the change synchronously.
  2. Rating API publishes a feedback-created or feedback-deleted fact asynchronously to Kafka.
  3. Catalog API receives the event through its durable inbox and checks idempotency before processing it.
  4. For an existing book, Catalog API recalculates the derived summary and updates the catalog record.
  5. For a missing or deleted book, Catalog API publishes a failed-projection fact.
  6. Rating API consumes the failure and deletes the invalid feedback record as compensation.
  7. A feedback deletion follows the same event path and removes the review’s contribution from the catalog summary.

Error Handling & Edge Cases

  • Duplicate events are ignored through durable inbox and idempotency guards.
  • Temporary database or broker failures retry before exhausted events move to a dead-letter queue.
  • Invalid book references trigger explicit compensation instead of a distributed transaction.
  • Projection retries must be safe to repeat, especially when recalculating aggregate values.

Quality & Consistency Notes

  • Individual feedback is immediately available in Rating API; the catalog summary is eventually consistent.
  • Catalog API can serve rating summaries without synchronously querying Rating API.
  • Compensation preserves strict ownership when a review is no longer valid.