Skip to content

Recommendations ​

MyEasyGuide uses Recombee — a machine learning recommendation-as-a-service platform — to power the "You may also like" suggestions on activity detail pages.

Architecture ​

Activity Created/Updated
       │
       ▼
Recombee Item Sync
  (lib/recombee-sync.ts)
       │
       ▼
Recombee DB (cloud)
       │
       ▼
Frontend requests /activity/:id
       │
       ▼
API fetches recommendations
  (lib/recombee-recommend.ts)
       │
       ▼
Activity detail page shows
"You may also like"

Integration Points ​

Item Sync ​

Activities are synced to Recombee as "items" with properties:

typescript
{
  title: string,
  images: string[],       // First image URL
  description: string,    // Short description
  price: number,
  duration: string,
  difficultyLevel: string,
  tripCategoryId: string,
  tripTypeId: string,
  cityId: string,
  regionId: string,
  isFeatured: boolean,
}

When items are synced:

  • Activity created → synced immediately
  • Activity updated → synced immediately
  • Activity deleted → removed from Recombee
  • Booking confirmed → activity re-synced (via webhook handler)

Recommendations ​

When an activity detail page is requested, the API calls:

typescript
getSimilarTrips(tripId: string, count: number): Promise<string[]>

Returns an array of activity IDs that are similar. The API then fetches the full activity data for these IDs and returns them alongside the main activity.

Client Setup ​

typescript
// lib/recombee.ts
import recombee from "recombee-api-client";

const client = new recombee.ApiClient(
  process.env.RECOMBEE_DB,
  process.env.RECOMBEE_API_TOKEN,
  { region: "us-west" }
);

Configuration ​

Environment VariableDescription
RECOMBEE_DBRecombee database ID
RECOMBEE_API_TOKENRecombee API token

Also See ​

Built with VitePress