Now a days we are familiar about ordering food from outside by some touches using smartphones. Sometimes we don’t have time for cooking or on a weekend when guests comes to our house we order food online by from apps like Z… or S…
I though let’s have a discussion to get a basic idea how the delivery app architecture works.
Here's an explanation of the key components and their roles in the system from which we can get an idea about the componets:
1. Users (Mobile or Web Clients)
Users interact with the application through mobile apps or web interfaces.
They initiate requests, such as browsing restaurants, placing orders, or tracking deliveries.
2. Load Balancer
Distributes incoming requests evenly across multiple instances of the API Gateway or backend microservices to ensure scalability and reliability.
Helps manage traffic spikes and prevents overloading any single server.
3. API Gateway
- Api gateways acts as a single entry point for all client requests where it handles request routing, authentication, authorization, rate limiting, and API versioning. Api getaway directs requests to the appropriate microservices and also block unauthorised access.
4. Microservices
Each microservice is designed for a specific function and operates independently:
User Service: Manages user data, profiles, authentication, and preferences.
Order Service: Handles order creation, tracking, and updates.
Restaurant Service: Manages restaurant listings, menus, and availability.
Delivery Service: Manages delivery assignments, tracking, and notifications.
Payment Service: Handles payment processing, refunds, and payment gateway integrations.
Each microservice communicates with others when necessary via APIs, ensuring a modular design.
5. Database Layer (AWS RDS)
Microservices use a relational database hosted on AWS RDS to store structured data where each microservice can have its own database schema, ensuring data separation and avoiding tight coupling like the monolithic design we followed old days.
6. File Storage (AWS S3)
Used to store and retrieve files such as user profile pictures, restaurant menus, and order receipts. Microservices like the User Service or Restaurant Service interact with S3 for file-related operations.
7. Request-Response Flow
Now we can have some talk about our applications request and response flow,
A user's request flows through the Load Balancer, which forwards it to the API Gateway.
The API Gateway routes the request to the appropriate microservice based on the endpoint.
The microservice processes the request, interacts with the Database (RDS) or File Storage (S3) as needed, and sends the response back to the API Gateway.
The API Gateway consolidates the response and sends it back to the user.
8. Notifications
In food delivery app notification is a very crucial feature where user can get the live update of delivery as well as the payment info etc. Following services we can use for notifying customers,
Notifications (e.g., order updates, delivery status) are sent back to users via the Notification Service.
These can include push notifications, emails, or SMS.
9. Scalability and Resilience
The Load Balancer and API Gateway ensure the system remains available and performant under heavy traffic.
The microservices architecture allows individual services to scale independently based on demand.