Squire is an app for iPad that provides suggestions of movies and TV shows, based on the user’s preferences. There are also some social features, for instance a user can suggest a movie or TV show to one of his/her contacts.
We have developed the backend and web services that support the Squire iPad app. The recommendations system was written in Scala and everything else was developed in Ruby. This architecture tries to combine the best features of the different languages. The Ruby API is easy to maintain, while the recommendations engine written in Scala and Neo4j is powerful, fast and able to handle heavy computations in a reasonable time.
11. Features
★ Extensive movies & TV-shows data
★ Info & price on streaming & rent services:
iTunes, Amazon, Hulu, Netflix...
12. Features
★ Extensive movies & TV-shows data
★ Info & price on streaming & rent services:
iTunes, Amazon, Hulu, Netflix...
★ Social features (contacts, comments)
13. Features
★ Extensive movies & TV-shows data
★ Info & price on streaming & rent services:
iTunes, Amazon, Hulu, Netflix...
★ Social features (contacts, comments)
★ Ratings
14. Features
★ Extensive movies & TV-shows data
★ Info & price on streaming & rent services:
iTunes, Amazon, Hulu, Netflix...
★ Social features (contacts, comments)
★ Ratings
★ Suggestions by users
15. Features
★ Extensive movies & TV-shows data
★ Info & price on streaming & rent services:
iTunes, Amazon, Hulu, Netflix...
★ Social features (contacts, comments)
★ Ratings
★ Suggestions by users
★ System recommendations
34. Communication (RabbitMQ)
iPad
GET /suggestions Client
JSON array of data
Query params in JSON Recommend.
Main API
Engine
(Ruby)
JSON array of IDs (Scala)
Retrieve data
RabbitMQ + JSON
Collect IDs of suggestions
for response
Graph reset* Users
All data MongoDB Neo4j Ratings
Movies and TV shows
37. Issues
☠ API server waiting for query in Neo4j
☠ Query MongoDB for add. data
38. Issues
☠ API server waiting for query in Neo4j
☠ Query MongoDB for add. data
☠ Transform data
39. Issues
☠ API server waiting for query in Neo4j
☠ Query MongoDB for add. data
☠ Transform data
☠ Ruby server is blocking
40. Communication (DB)
iPad
GET /suggestions Client JSON array of
suggested results
Redirect to Recomm. Follow redirect link
Eng. w/ hashed params
Recommend.
Main API
Engine
(Ruby)
Retrieve data for (Scala)
response
Retrieve data
Collect IDs of suggestions
for query params
Graph reset*
Users
All data MongoDB Neo4j Ratings
Movies and TV shows
53. Delta Updates
* API: New ratings in queue collection
(MongoDB)
* Recommendations:
Backend checks for updates in queue
and applies them in graph
54. Delta Updates
iPad
Client GET /suggestions
POST /rating
Recommend.
Main API
Engine
(Ruby)
Retrieve data for (Scala)
response
Store rating + Apply updates
Collect IDs of suggestions
Put rating in queue if pending
Check if updates
in queue
Users
MongoDB Neo4j Ratings
Movies and TV shows
57. (Re)loading data in graph
1. Create new Neo4j instance
2. Import data from MongoDB
58. (Re)loading data in graph
1. Create new Neo4j instance
2. Import data from MongoDB
3. Hot swap
59. (Re)loading data in graph
1. Create new Neo4j instance
2. Import data from MongoDB
3. Hot swap
★ Allows for massive updates in the primary
database
60. (Re)loading data in graph
1. Create new Neo4j instance
2. Import data from MongoDB
3. Hot swap
★ Allows for massive updates in the primary
database
★ Used only for content-related data and user