To implement functionalities like recent search history, recently viewed items, firebase would be the best option. This is possible since firebase is just a bucket of data that can be easily allocated for each user. Queries with limited sorting and filtering functionality can be performed with the firebase database .
Read moreCan we use SQL queries in Firebase?
FireSQL is a library built on top of the official Firebase SDK that allows you to query Cloud Firestore using SQL syntax. It’s smart enough to issue the minimum amount of queries necessary to the Firestore servers in order to get the data that you request.
Read more