Reviews and browsing history for ordered-system, extracted from the ordered-backend monolith. The one service in the system backed by MongoDB instead of PostgreSQL — a deliberate choice to practice running a relational and a document store side by side in the same system, since both review documents and history entries are naturally schema-loose, high-write, low-relational data.
- Verified-purchase reviews: a review can only be left on a product the buyer actually received.
OrderDeliveredListenerconsumes theorder-deliveredKafka event published byorder-service's outbox (InternalBrowsingHistoryController's sibling flow) and records aVerifiedPurchase;ReviewServicechecks against that before accepting a review, rejecting both un-purchased products (ProductNotPurchasedException) and duplicate reviews (DuplicateReviewException). - Browsing history, recorded per user as they view products —
RecordViewRequestfrom the public API, plus anInternalBrowsingHistoryControllerused service-to-service. - Idempotent Kafka consumption: like
product-service, tracksProcessedEventIDs so a redeliveredorder-deliveredmessage can't create a duplicateVerifiedPurchase.
Base path /api/v1/reviews and /api/v1/browsing-history, reached through ordered-gateway. Reading a product's reviews (GET /api/v1/reviews/product/**) is public; recording history and posting reviews requires auth. OpenAPI docs at /v3/api-docs.
Java 21 · Spring Boot 4.1.0 · MongoDB (Spring Data MongoDB) · Kafka · Eureka Client · Spring Cloud Config Client · Micrometer / Prometheus / OpenTelemetry tracing · ordered-commons
git clone https://github.com/ordered-system/ordered-commons.git
(cd ordered-commons && make install)
git clone https://github.com/ordered-system/ordered-engagement-service.git
cd ordered-engagement-service
make up # this service's own MongoDB
make runRuns on port 9094. Needs ordered-eureka, ordered-config-server, and Kafka reachable. Full stack: ordered-infra.
The Dockerfile needs ordered-commons supplied as an additional build context — build via ordered-infra's compose files rather than a bare docker build ..
make test-unit
make test-integration # Testcontainers MongoDBOrderDeliveredFlowIntegrationTest and ReviewFlowIntegrationTest cover the "can't review what you didn't buy" rule end-to-end.
| Service | Database | Role |
|---|---|---|
| ordered-order-service | PostgreSQL | Orders, cart checkout, payments (Stripe) |
| ordered-product-service | PostgreSQL + Redis | Product catalog, stock reservation |
| ordered-user-service | PostgreSQL | Users, auth, JWT issuance |
| ordered-engagement-service | MongoDB | Reviews, browsing history |
Part of the ordered-system organization.
MIT — see LICENSE.