Checkout to personalized recommendations
Follow a customer through address entry and checkout, then see recommendations that exclude the purchase. Back on HOME, suggestions combine purchase history and recent browsing.
How BlueShop chooses, filters and measures product recommendations.
Prepared with AI under human direction. Implementation details were checked against source code and test scenarios where noted. Read the earlier implementation plan or its Markdown version.
Source check: 12 September 2026. Eligibility, serving checks, product/variant response fields, strategy chains, order-fact identity and measurement were checked against backend commit d305706a. This is a source check, not a new deployment or runtime test. The films are July recordings and may describe older behavior. See the pinned source links below.
BlueShop has a dedicated recommendation-service bounded context. It serves explainable product recommendations at four storefront placements:
| Placement | Customer experience | Context sent to Recommendation |
|---|---|---|
HOME |
Popular or personalized discovery | Recently viewed products and, when authenticated, server-side purchase history |
CART |
Complementary products before checkout | Current cart product IDs |
ORDER_CONFIRMATION |
Relevant next products after purchase | Product IDs preserved from the completed cart |
PDP_SIMILAR |
Semantically similar products | The current product ID |
The system combines five strategies:
CO_PURCHASE: products observed together in non-cancelled orders.POPULARITY: time-decayed demand with category and featured-product signals.PERSONAL_HISTORY: purchase-history fallback through affinity, category popularity, then semantic similarity.CURATED_RELATION: catalog-manager cross-sell and upsell relations.SIMILAR_CONTENT: multilingual semantic similarity using local ONNX inference and PostgreSQL pgvector.Serving checks every candidate after cache lookup against Catalog, Stock and Recommendation's local eligibility projection. The local row must exist, be published, identify a default variant, have positive availableToSell, and report IN_STOCK or LOW_STOCK. Missing rows and UNKNOWN availability are rejected. Catalog must also return a published product, and Stock must return positive availability for the candidate variant with a status other than OUT_OF_STOCK. These checks do not reserve stock; checkout still owns reservation.
BlueShop does not use one universal recommendation score. It combines three decision layers with different scopes, inputs, and meanings:
| Layer | Question answered | Current inputs | Current strategies |
|---|---|---|---|
| Global | What is broadly relevant now? | Decayed order demand, category and featured-product facts | POPULARITY |
| Product-to-product | What belongs with or resembles this product set? | Co-purchase pairs, curated relations, multilingual embeddings | CO_PURCHASE, CURATED_RELATION, SIMILAR_CONTENT |
| Customer-to-product | What is relevant to this specific customer? | Purchase history and Catalog-persisted recently viewed products | Interleaved PERSONAL_HISTORY and view-seeded SIMILAR_CONTENT on authenticated HOME |
The global layer is customer-independent. It provides a baseline for anonymous traffic, cold starts, and fallback capacity. Popularity is derived from order facts with time decay rather than from page-view volume.
This layer starts from one or more seed products. It can express observed co-purchase behavior, explicit catalog-manager intent, or semantic similarity. It powers cart, order-confirmation, and PDP contexts and also contributes to HOME personalization.
This layer combines long-term and short-term customer context:
PERSONAL_HISTORY.PERSONAL_HISTORY and view-seeded SIMILAR_CONTENT, preserving long-term
preference and short-term intent without comparing their incompatible scores.Personalization does not put customer identity into measurement events. Recommendation uses the authenticated UUID only for serving, while served/clicked CloudEvents remain anonymous and no-PII.
| Boundary | Owns | Recommendation keeps only |
|---|---|---|
| Catalog | Products, lifecycle, categories, curated cross-sell/upsell relations | Publication/category snapshots, relation projections, embedding source facts |
| Stock | Authoritative availability and reservations | Asynchronous availability projection and source freshness |
| Order | Order lifecycle and commercial snapshots | Order-product facts and customer purchase profile |
| Recommendation | Candidate generation, ranking, serving policy, measurement | Affinity, popularity, eligibility, relations, embeddings, inbox/outbox |
| Analytics | Analytical facts and dashboards | Item-grain served/clicked projections and CTR views |
Catalog and Stock remain the authorities for publication and availability. Recommendation uses local projections to find candidates, then checks Catalog, Stock and the local eligibility policy before returning them. A missing or incomplete local row is rejected, even if another lookup succeeds.
The gateway exposes the service under /api/recommendation.
| Operation | Access | Purpose |
|---|---|---|
GET /v1/recommendations |
Public; optional JWT | Serve one placement using up to 20 seed product IDs and at most 12 product/variant results |
POST /v1/recommendations/clicks |
Public | Accept a client-reported click beacon; request shape is validated, but membership in the served set is not |
POST /internal/v1/recommendations/recompute |
admin role |
Refresh known catalog snapshots, embeddings, and derived projections |
A recommendation response carries:
recommendationSetId for measurement correlation.The API returns product and variant IDs rather than duplicating Catalog DTOs. The storefront preserves recommendation order and hydrates cards through Catalog's bulk endpoint.
| Model | Grain | Question it answers |
|---|---|---|
order_product_facts |
One order and one variant | What happened in this exact transaction? |
customer_product_purchases |
One customer and one product | What is this customer's accumulated purchase relationship with the product? |
The first eight Flyway migrations introduced:
vector(384) product embeddings and HNSW index.Later migrations add order/variant identity, variant stock eligibility and default-variant serving; remove the unused order-fact price; and maintain database roles, RLS and outbox trace context. The checked migration directory reaches V20, with V13 intentionally retired. Recommendation stores behavioral purchase facts; Order and Analytics retain commercial amounts.
The vector PostgreSQL extension is installed by GitOps with elevated platform privileges; application Flyway only owns service schema objects.
The historical plan contains several candidate chains considered during design. The implementation described here uses these chains:
| Context | Actual ordered strategy chain |
|---|---|
Anonymous HOME |
POPULARITY |
Authenticated HOME, no purchases |
SIMILAR_CONTENT -> CURATED_RELATION -> POPULARITY |
Authenticated HOME, with purchases |
Interleaved PERSONAL_HISTORY + SIMILAR_CONTENT -> CURATED_RELATION -> POPULARITY |
CART |
CO_PURCHASE -> CURATED_RELATION -> POPULARITY |
ORDER_CONFIRMATION |
CO_PURCHASE -> CURATED_RELATION -> POPULARITY |
PDP_SIMILAR |
SIMILAR_CONTENT |
UNKNOWN local eligibility rejects the candidate.If Catalog omits a product or reports it unpublished, the service invalidates the candidate cache and deletes that product from the local eligibility projection. If the result is short, it refreshes candidates and retries the serving checks once. A Catalog or Stock lookup error or timeout returns an empty recommendation set. Positive availability is a serving-time observation, not a checkout reservation.
PERSONAL_HISTORY is a fallback sequence, not a weighted blend:
Catalog owns curated relations. Recommendation preserves their order while applying the same serving checks as other strategies: published Catalog product, positive Stock availability for the candidate variant, and a complete, sellable local eligibility row. Curation does not bypass those checks.
sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2.2c4055b12046f11709e9df2c122e59ffbdc2f900.66fc00f5f29afcaff34092e1bdd20008ca3918265a82fb9695a551e510cc4ebc.semantic-embedding Reactor scheduler; inference does not run on the WebFlux event loop.0.55 by current configuration.1.Semantic text prioritizes structured product tags when present. Otherwise it combines localized name, description, short description, SKU, brand, and localized attribute values.
Semantic cold start does not require order history. A newly published product can receive an embedding from its Catalog event and immediately participate in PDP_SIMILAR once its snapshot and availability are current.
The Angular implementation follows BlueShop's frontend boundary rules:
RecommendationsStore owns serving requests, product hydration, loading, errors, and click tracking.keepalive request.RecommendationServed records the anonymous set ID, placement, anonymous/authenticated request context, seed product IDs, ranked product/variant items, environment, traffic class, and generation time.
RecommendationClicked records the set ID, placement, product, variant, one-based rank, strategy, environment, traffic class, and click time. The public request supplies the set ID, placement, product, variant, rank, and strategy; the public traffic-class header is also caller-controlled and defaults to LIVE when absent or malformed. The service owns only environment and receipt time.
Neither event includes customer identity, contact data, address data, cost, or margin. The click endpoint validates field shape and enum parsing, but does not look up the served set or verify that the product, variant, rank, placement, or strategy belonged to it. A conforming caller can therefore forge a tuple that ClickHouse later joins to a served tuple. These events are useful client instrumentation, not trustworthy proof of a human choice, causal impact, or customer identity.
recommendation.events.analytics-service.analytics.raw_recommendation_interactions.analytics.recommendation_product_performance at product grain.recommendation-performance-ctr, with a product-performance table rather than only aggregate CTR.LIVE, SYNTHETIC, and retained LEGACY events.A served-measurement persistence error is logged but does not fail the recommendation response. Click persistence is an explicit accepted request path, but its values remain client-reported.
permitAll.ROLE_admin.These five films include on-screen captions and can be watched without audio:
Follow a customer through address entry and checkout, then see recommendations that exclude the purchase. Back on HOME, suggestions combine purchase history and recent browsing.
The film shows a test order, a later product view and the resulting HOME recommendations. The linked browser test checks one PERSONAL_HISTORY result, one SIMILAR_CONTENT result, and exclusion of both starting products.
Compare impressions, client-reported clicks, CTR and average rank by product, placement and strategy, then inspect one recorded click. Click reports are not checked against the served recommendation set.
Shows a catalog manager curating two related products, a stock adjustment projecting known OUT_OF_STOCK state and removing that candidate, and a customer following the eligible recommendation to its product page. The film follows the change from the catalog manager to the storefront.
The film shows a newly eligible product receiving a "Similar products" strip. SIMILAR_CONTENT strategy, its explanation, and operation without purchase history are source- and BDD-backed behavior, not claims established by the film itself.
| Capability | State | Notes |
|---|---|---|
| Dedicated recommendation bounded context | Delivered | Reactive Spring Boot service with service-owned schema and policies |
| HOME, CART, order confirmation and PDP placements | Delivered | One reusable storefront component and Signal Store |
| Co-purchase, popularity and purchase-history strategies | Delivered | Deterministic, explainable derived projections |
| Customer-level purchase and recently-viewed blending | Delivered | Authenticated HOME alternates long-term purchase history with short-term semantic browsing intent |
| Catalog-manager curated relations | Delivered | Catalog-owned source, Recommendation-owned serving projection |
| Semantic recommendations | Delivered | Local multilingual ONNX inference plus pgvector |
| Publication And Variant Availability Checks | Delivered with limit | Every request checks Catalog, Stock and the local eligibility policy; missing or UNKNOWN local eligibility rejects the candidate |
| Missing Or Lagging Eligibility | Availability And Freshness Limit | Missing or incomplete local data removes candidates. Projection lag or lookup failures can reduce or empty results; serving does not reserve stock |
| Served/client-reported click measurement and product-level Recommendation BI | Delivered with trust limit | No-PII pipeline is useful for instrumentation; click tuples are not verified against served sets |
| Gorse learned engine and A/B routing | Deferred by design | Current client-reported click data is not a trustworthy learned-engine gate |
| Elasticsearch More-Like-This adapter | Not built | pgvector shipped directly |
| Semantic fallback in CART | Not implemented | Actual chain is co-purchase, curated, popularity |
| Non-semantic fallback on PDP | Not implemented | Actual PDP chain is semantic-only; thin results hide the strip |
| Weighted blending across all strategies | Not implemented | Current engine uses ordered priority fill; only the two customer-level HOME signals are deterministically alternated |
| Infinite event replay as disaster recovery | Not claimed | Full historical recovery requires PostgreSQL backup plus retained Kafka replay |
Recommendation combines these parts:
The learned engine remains deferred. The current click stream cannot gate a learned engine because callers control the click tuple and traffic class. Such a gate requires server-side served-set validation, abuse controls, and experiment-quality evidence first.