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
| File | Responsibility |
|---|---|
src/lib/recombee.ts | Client, constructed from RECOMBEE_DB and RECOMBEE_API_TOKEN |
src/lib/recombee-recommend.ts | getSimilarTrips(itemId, count = 6) → RecommendItemsToItem |
src/lib/recombee-sync.ts | Item upsert/delete helpers (not called by current flows) |
src/controllers/activity.controller/getById.ts | Calls 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
| Variable | Purpose |
|---|---|
RECOMBEE_DB | Recombee database ID |
RECOMBEE_API_TOKEN | Recombee 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.
Related
- Popularity Scoring — the other discovery signal, stored in Postgres.