Guys,
I am preparing a playlist to showcase full stake Production-ready application, Uber eats is a food ordering platform for restaurants and end-user who are ordering food
Let's think about what all we can build in this app using our own stack and technology
Let's think about architecture we can follow to build services
Technologies
- FE for UI we can use simple React
- BE for API and service development we can use Node JS with different SQL and no SQL Databases
- The interface between UI and APIs can be REST or graphql based
As we are doing this in a Microservice way, we can build different services that can be consumed by the UI layer.
UI layer will talk to the centralized gateway for any kind of request and API gateway will forward this request to the right set of services, a simple gateway based microservice architecture
In our case, we can decide if we want REST-based services or graphql based services
Our Flow will be simple
UI layer to the gateway and from that to microservice, for authentication and authorization we will be using a simple auth service built in Node JS, and API gateway will also be a simple gateway in node js
Our Simple Requirements — based on a simple food ordering system
- Restaurants can register themselves.
- Users can create, update, delete, get their profiles.
- Users can search for the restaurant using a restaurant name, city name.
- Restaurants can add, update the food menu.
- Users can add remove food items from the cart
- Users can order food and can get the right communication and can also cancel the order in a pre-defined time.
- Users can track the delivery.
- Users should be able to make payments.
- Delivery boy can get all the deliveries made by him using his Id.
- Users can get the status of food anytime with all tracks.
Let's think in terms of services and Model Designing
Restaurant Service
- This service will deal with restaurant data only and will expose data for user search from UI, it like we can expose this data from elastic search
- We need basic APIs from this service like adding a new menu item for restaurant Users or updating menu items.
- Customers can search for menu items based on different search filters like item name or item name in a city
- The restaurant owner can add new menu items to decide the price.
User Service
- User service to provide base authentication feature based on mobile no and OTP token
- Post Login for new users we will allow to update Profile
- For Users Mob No will be unique and the main profile identifier for authentication
- Post Login user can update the profile and can populate User Profile data like location and set of addresses
- Users can have multiple addresses where order delivery can happen with GPS location Coordinates.
Food Menu Service
- This looks like the same service as Restaurant but this has totally different business, it will land the information on UI when the user selects a particular restaurant and wants to see all menu items from that restaurant
- Users can see all menu items provided by the restaurant
- This service will be used by Admin and Customers as Admin can manage menu items and customer can search the menu items
- admin can add more menu items or update existing menu items
Cart Service
- This service will manage the adding and removing items from the cart by the user
- This service will talk to the food Menu service to fetch the details about the items ordered by the user.
- Users can add and remove items before placing the order.
Order Service
- This service will manage orders and will expose to the customers and Admin of the system.
- Customers can place or cancel orders
- Admin can search for the order
- Customers can see their order history for a restaurant
- Customers can see their all order history
Similarly, we are building a Payment and delivery service
The most important aspect of this whole system is domain level isolation so we don’t mix things in different services and there should be no too much decoupling of services
- Managing authorization in services
- Managing User sessions across different services
- Providing Async Communication between services using messaging queues so we don’t lose any order due to some failure and provide retry mechanism
- This will be an event-driven design as I can see lots of events as we can across different services and based on those events subscriber service can react like assigning a delivery partner, sending updates to customers, provide tracking real-time to the user.
Next Part of this is design ERD and define Models for all these different services
I will keep adding all these videos in my YouTube playlist as I can’t explain and we can’t write whole complex things here in this Blog
The most challenging part of this whole design is —
- Data synchronization and communication between services
- Decoupled services where service A should know as less as possible about service B
- Async communication to avoid any real-time failure using messaging bus platform (SQS, SNS, KAFKA, RABBIT MQ)
- Build delivery guy assignment tooling based on GPS real-time.
- Provider real-time tracking for customers (good to have).
References
- https://www.connecting-software.com/blog/what-is-an-api-gateway-how-it-can-actually-deliver-practical-results/
- https://docs.microsoft.com/en-us/dotnet/architecture/microservices/architect-microservice-container-applications/direct-client-to-microservice-communication-versus-the-api-gateway-pattern
- tkssharma.com my own blogging platform