Skip to main content

Reactions domain model

Reactions includes five types of entities: reaction, user, target, view and source. This guide outlines each one of these entities and their relation to each other.

Domain Model

Reaction

At the core is the entity defined as a reaction. A reaction can be a like, a comment, a review or anything you are creating anew. All reactions are generated by a user and have a connection to a target. Reactions can also be associated with other reactions.

Example: A user writes a review (the reaction) on a movie (the target). Another user gives a like (the reaction) to a review (another reaction).

A reaction is always associated with rules and actions. A rule or a whole rule set defines the rules for creating a reaction.

Example: A user can only write one review per movie.

Once you generate a reaction, you can define actions to be performed.

Example: When a user gives a like to a review, an email is sent to the author of the review.

User

The entity that reacts is defined as a user. Users are those persons who sign up to your organization's community. We strive not to store any user data in our API. We generally only store a user identifier so we can link a reaction to a user in your organization. Users authentication is provided via OpenID, OAuth or any other secure industry standard. We can also handle anonymous users.

Target

The entity a user reacts to is defined as a target. This can be a page on a website, a product, a movie or a recipe. The Reactions API stores as little information on a target as possible. In a micro-service architecture such as this one, data for targets is usually available via APIs (i.e. a product API). We only store an identifier for these targets in our database to avoid syncing data.

Source

A source is the channel adopted by a user to generate a reaction. Say you have a mobile app and two different websites. The user can write reviews on all of these channels. In this case, you have 3 sources.

View

A view is defined as the entity which stores the views on a reaction. This allows you to know if and when a user viewed a reaction. You need views if you wish to create a forum or a private message through our API.