Order food with the app and get it delivered in 90 seconds
The passion for food when combines with zeal for entrepreneurship can bring us to innovation previous unthought of. Seemingly, on what looks like an extraordinary journey of discovering good food brought us to first-of-its-kind automated retail marketplace, a collaborative platform of food providers.
Frshly is an automated retail marketplace in the form of food vending machines controlled with attached tablet devices. Each tablet is a food order app with online menu with which a person can order food items from various vendors in the marketplace. A group of screens above vending machine displays available food items.
A user can select one or more food items in multiple quantities, subject to availability. The user receives a token number on the SMS. Another tablet displays token numbers ready to serve. The aim is to provide fresh and hygienic food all under 90 seconds!
A Flawed Architecture
At core of the entire solution architect is a Raspberry Pi. The single-board computer, which connects the vending machine to TV screens, order-tablet, token-tablet, and the internet.
The TV screens read the vending machine via the Raspberry Pi and displays food items available inside it and in what quantity. Likewise, via Raspberry Pi, the order-tablet, on a customer’s command, triggers the set of actions that obligates the vending machine to prepare the ordered food and prompt token-tablet to display the current order.
The architecture required the orders to be stored on Firebase Realtime Database and, ultimately, on Frshly servers before being marked ‘confirmed’. This is where the biggest limitation of this setup stood—a challenge we must solve.
The Big limitation
What if the internet connection that connects the Raspberry Pi and thus the whole setup to the system to web services is interrupted while a customer ordering. The Firebase Realtime Database would also go offline and, as a result, the order will fail.
If the internet goes down for some time, Firebase will become unavailable and the app will stop working and won’t take any new orders, which means business loss for Frshly and loss of brand. Also, the food items stored in the vending machines have a shelf life.
Coming up with a work around
Evidently, the team’s first priority became to make the tablet app accessible in offline mode for the time internet is down or got interrupted in midst of an order. For that, we needed to setup local database. Once the internet is up and running, to send order data to Firebase and sync it with Frshly server.
This meant complete restructuring of app rules and writing and editing many lines of code.
The ingenious solution
To implement offline feature in order-app & token-app, we set up a local database in Mongo DB with the help of Node.js. We also used Reddis to store & process the order and sync it with the server once the setup is online.
We used an RTC clock to resolve the issue of difference in internet and actual time when the internet is down, which cause unexpected errors since Raspberry Pi doesn’t have inbuilt CMOS. When the internet goes down, the order can still be placed with a default dummy date, which will be taken over by the internet clock when the system is back online.
The tablets we terribly slow which was frustrating the users. The UI was also out of date and lacked essential features.
We fully revamped the design of Outlet App (Tablet App) as per the new material design style & converted the cross-platform app to a native android experience.
Realtime Data Update
Crash reporting system
By cutting Frshly’s dependence on the internet, the tablet app could accept more orders than before. The vending machines’ idle time decreased by more than 25%. Native Android app led to a better customers satisfaction ratio.