@chelseaapps/recommender documentation

This module is a wrapper service around the Recombeearrow-up-right NodeJS libraryarrow-up-right. It aims to adapt the Recombee library to suit the needs of Chelsea Apps projects.

Installation

The project is hosted on npm, so to install simply run

npm

npm i @chelseaapps/recommender

yarn

yarn add @chelseaapps/recommender

Configuration

The module can be imported either globally or restricted to a single module scope. The default option is global, as this allows the module to be used across multiple modules without having to configure it multiple times.

Config options

Option

Description

Example

isGlobal

Register the module globally across all modules in the app

true

databaseID

Recombee database ID

uplevyl-dev

privateToken

Recombee private token (generated in the dashboard)

****

scenarios > main

Main items to user Recombee scenario

homepage

scenarios > search

Search Recombee scenario

search

scenarios > users

Users to user Recombee scenario

connections

scenarios > items

Items to items Recombee scenario

items

cache > enabled

Should the recommendation results from the Recombee API be cached in Redis?

true

cache > ttl

How long should recommendation responses be held in the cache (milliseconds)

30000

cache > redis > host

Redis host for caching

localhost

cache > redis > port

Redis port for caching

6379

The module can be configured in two ways:

  • Regular

  • Asynchronous

Regular config

Import the module into the module in which you wish to register, and call the static register function.

Asynchronous config

The module can also be registered asynchronously to create the module dynamically, fetching configuration details from an external source (such as an environment variable).

Usage

Import the RecommenderService into a module using the Nest depedency injection mechanism.

Was this helpful?