Sub-10ms intelligent cross-sell recommendation engine. Reads cart items, queries Upstash Redis TLS cache, and generates complementary items within the same shop ordered by price tier and category affinity.
Query Parameters (Optional if JWT provided)
| Parameter | Type | Description |
shopId | String | Restricts suggestions to products stocked in this shop |
productIds | Comma-separated Strings | List of product IDs currently in cart to exclude |
limit | Number | Default 6 (max 12) |
Response (200 OK)
{
"success": true,
"source": "redis_cache", // "redis_cache" | "mongo_pipeline"
"recommendations": [
{
"_id": "6741b8...",
"name": "Britannia Marie Gold 300g",
"price": 40,
"category": "Snacks",
"stock": 80,
"images": ["https://..."],
"relevanceScore": 0.94
},
{
"_id": "6741c1...",
"name": "Sugar 1kg",
"price": 48,
"category": "Groceries",
"stock": 120,
"images": ["https://..."],
"relevanceScore": 0.89
}
]
}