Skip to content

Implement product recommendation endpoint#576

Open
Trishanthsai wants to merge 4 commits into
niharika-mente:mainfrom
Trishanthsai:feat/recommendation-endpoint
Open

Implement product recommendation endpoint#576
Trishanthsai wants to merge 4 commits into
niharika-mente:mainfrom
Trishanthsai:feat/recommendation-endpoint

Conversation

@Trishanthsai

Copy link
Copy Markdown
Contributor

Closes #449

Description

What changed

  • Implemented the getRelatedProducts endpoint.
  • Added a recommendation engine based on historical purchase data using MongoDB aggregation.
  • Added product ID validation.
  • Added product existence checks.
  • Excluded the requested product from recommendations.
  • Filtered out soft-deleted products.
  • Returned the top related products while preserving recommendation order.
  • Added appropriate error handling for invalid IDs, missing products, and empty recommendations.

Implementation

  • Used MongoDB aggregation ($match, $unwind, $group, $sort, $limit) to identify products frequently bought together from completed orders.
  • Retrieved the corresponding product details and returned them in ranked order.

@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

@Trishanthsai is attempting to deploy a commit to the niharika-mente's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Trishanthsai

Copy link
Copy Markdown
Contributor Author

Hi @Aamod007
I've completed the implementation for this issue and opened a PR.
Implemented

  • Recommendation endpoint based on historical completed orders.
  • Products frequently bought together using MongoDB aggregation.
  • Validation for invalid/non-existent product IDs.
  • Soft-deleted products are excluded.
  • Graceful handling when no recommendations are found.

The repository currently has unrelated frontend/backend CI issues that are outside the scope of this feature, but the recommendation endpoint implementation itself is complete.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: integrate a recommendation engine endpoint (e.g., 'Users who bought this also bought...')

1 participant