How to make a movie recommender: making a application using Svelte, FastAPI, MongoDB & TensorFlow Serving

Juan Domingo Ortuzar
Analytics Vidhya
Published in
3 min readDec 13, 2020

--

Hello, we are going to make a web application to make recommend movies. In this application a user will be able to write the title of a movie or more and the application will return a list of movies as a recommendation. Making this project you will learn how to make a movie recommendation engine, a REST API and a front-end reactive application. This tutorial will be divided into several parts so you can learn what you want. The code for the project is here.

This article is made to give you an idea of what are we going to make and the tools we are going to use. Lets start with a diagram of the different parts and the interaction with out application.

So we need to make a front-end application that the user will interact, then we have a back-end API that will process and coordinate the database and the AI model. Then we have a Database to save the movies and the AI model

So simple, now we know that we will be using movie names to show the user. Now lets think about the technology stack we are going to use:

Could you choose another technology stack, of course, you can choose whatever you want. Lets see what each of these tools we will be using for:

  • Svelte: a JavaScript framework for creating reactive application. Think of a smaller more reactive version of React, VueJS or Angular. This is going to be our front end, the place where the user is going to interact with our application.
  • TensorFlow: a Machine Learning/Artificial Intelligence framework created by Google for creating and training ML/AI models, we will be using the python version of TensorFlow. Also we will be using TensorFlow Serving to be able to make HTTP request to our trained Model.
  • MongoDB: its a NonSQL database engine, it means you can save anything you want in any way you want as long as it can be made into a dictionary. Since we are not going to use relationship tables it will be better. You can use a SQL database engine if you want, like SQLite or MySQL.
  • FastAPI: a REST API framework written in python, think of Django but great for prototyping and making faster API. I love this framework because it is very easy to create new endpoints and it abstract a lot of the harder things.
  • Docker: its a environment container framework. This means that you can make your code a package called containers, that can communicate with other containers without having to worry about dependencies or “cross contamination” between services.

How we will do it

I have divided each part of the recommender into a different section, so you can start whenever you want, just click on the links. But the recommended order is the following:

  1. Recommender Model.
  2. Backend.
  3. Frontend.
  4. Making things work together using Docker.

A couple of final words

This is by no way a production ready application nor is the only way to create movie recommender. This is a simple tutorial to create a demo application that uses Machine Learning and to show all the different parts and concepts that goes into creating a full stack application. I just want to share what I’ve learned.

--

--