System Design ( Day - 47 )

Manoj KumarManoj Kumar
2 min read

Design of Food Delivery Application ( Tomato )

Functional Requirements
1. Users can search for restaurants based on locations.
2. Users can add items to cart.
3. Users can checkout by making Payment>
4. User should be notified once order is placed successfully.

Non-Functional Requirements.
Each Part of design should be Scalable and Modifiable.

Flow
User will come to our app and they see the list of restaurants along with the Food menu from this menu we can add it to the cart. and then he can place and Order it could be Delivery or DineIn or Pickup from Restaurant. and that payment would be a third party service like RazorPay or Stripe etc.. after placing the order the user has to be notified about that order is it successful or failed.

UML Design
We have Restaurant class and a Menu Class in which a restaurant has a menu. for doing CRUD operations on Restaurants we have Restaurant Manager to handle everything, that Restaurant manger class is a Singleton class so that the Data is consistent throughout the application, and we have a User class, and he has a Card which is one to one relationship. Cart has Restaurants and a list of items. There should be a payment service should also be there, for the Payment service we can use Strategy design pattern, we’ll create a abstract class and override according to the payment method that user has chosen like Upi payment, Card payment or NetBanking etc… we have Order class to maintain the order like Restaurant and menu items that are selected, user and payment strategy and also we have order type which is Delivery or Pickup by customer. We have to create a Factory Design for Orders, in that Order Factory we have Create order method which creates an order no or schedule it for later. in which these orders are managed by the Order manager. and that order manager is a singleton to maintain data consistency. and finally we have Notification service to notify the user about the order that he has placed (Status).
For improvement we can have a Orchestrator class to the backend so that only that class has to interact with the frontend or the user everything has to be handled in the Tomato class.

1
Subscribe to my newsletter

Read articles from Manoj Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Manoj Kumar
Manoj Kumar