Skip to content

Recommendations ​

Activity detail pages return a recommendations array powered by Recombee. This is a read-only integration today: the sync path is disabled, so the catalogue in Recombee is not updated automatically by this codebase.

Request path ​

GET /api/v1/activity/:activityId
        │
        ├── load activity + visibility check
        ├── increment views (fire-and-forget)
        ├── getSimilarTrips(activity.id) ──> Recombee
        ├── filter returned ids by published = true AND status = APPROVED
        └── respond { data, recommendations: [] }

The API never fails the page because Recombee is unavailable. Errors are logged and recommendations is [].

Code ​

FileResponsibility
src/lib/recombee.tsClient, constructed from RECOMBEE_DB and RECOMBEE_API_TOKEN
src/lib/recombee-recommend.tsgetSimilarTrips(itemId, count = 6) → RecommendItemsToItem
src/lib/recombee-sync.tsItem upsert/delete helpers (not called by current flows)
src/controllers/activity.controller/getById.tsCalls recommendations, filters to public activities

Sync status ​

syncActivity() is referenced only from a commented-out block in the admin approval flow (approveListing.ts). Creating, updating, deleting, or approving an activity does not write to Recombee. The sync helper also still reads legacy relations (tripCategory, tripType, city, region) that no longer exist on the current Activity model, so it needs updating before it is re-enabled.

As a result, Recombee reflects whatever catalogue was last imported out of band. New activities will simply have no recommendations until that import is run again.

Visibility rule ​

Recommendation ids are re-queried in PostgreSQL with published: true and status: "APPROVED". A stale or malicious Recombee entry cannot surface an unpublished or suspended activity.

Configuration ​

VariablePurpose
RECOMBEE_DBRecombee database ID
RECOMBEE_API_TOKENRecombee API token

If either is missing, the client is still constructed and calls fail at request time; the failure is caught and the page renders without recommendations.

Built with VitePress