This repository contains a Kotlin + Spring Boot starter backend for marketplace search and recommendations. It is intentionally designed as a clean first slice that your marketplace team can extend into production search pipelines, offline ranking, and personalized recommendations.
- Search API with:
- free-text token matching
- light typo tolerance
- filtering by category, price, stock, and tags
- ranking boosted by title match, ratings, reviews, popularity, and inventory
- Recommendation API with:
- user affinity signals from preferred categories and tags
- context-item similarity for "similar products" style recommendations
- popularity and price-fit blending
- Seed marketplace catalog and demo user profiles for fast iteration
- Spring Boot test coverage for the main relevance flows
src/main/kotlin/com/marketplace/search/api: REST endpointssrc/main/kotlin/com/marketplace/search/catalog: domain models and in-memory seed repositorysrc/main/kotlin/com/marketplace/search/search: search ranking logicsrc/main/kotlin/com/marketplace/search/recommendation: recommendation logic
GET /api/items
GET /api/search?query=wireless+headphones&category=electronics&limit=5
Additional query parameters:
minPricemaxPricetagsinStockOnly
GET /api/users/user-1/recommendations?contextItemId=itm-1004&limit=6
Use contextItemId for "related items" ranking around a product detail page.
- Ensure Java 17 is installed.
- Generate or add a Gradle wrapper if your environment does not already provide one.
- Run
./gradlew bootRun
- Replace the in-memory repository with PostgreSQL or Elasticsearch/OpenSearch indexing pipelines.
- Add event ingestion for clicks, views, carts, and purchases.
- Learn search ranking weights from interaction data instead of hardcoding them.
- Add collaborative filtering or vector similarity for richer personalization.
- Introduce seller quality, margin, and fulfillment signals into ranking.