Design: Rating and Review System
Design covers backend services, database schema, and API flow for rating and review management. Frontend UI and payment integration are out of scope.
Functional Requirements
Non-Functional Requirements
Jump into concepts and practice - no test required
+---------------------+
| API Gateway / LB |
+----------+----------+
|
+----------v----------+
| Authentication Svc |
+----------+----------+
|
+----------v----------+ +------------------+
| Review Management |<-------->| Moderation Svc |
| Service | +------------------+
+----------+----------+
|
+----------v----------+ +------------------+
| Database (SQL) | | Message Queue |
+----------+----------+ +------------------+
|
+----------v----------+
| Cache (Redis/Memcached) |
+---------------------+
|
+----------v----------+
| Search / Indexing |
+---------------------+current_avg = 4.0
num_reviews = 5
new_rating = 5
new_avg = (current_avg * num_reviews + new_rating) / (num_reviews + 1)
new_avg?