Open In App

Food Delivery Application Project in Software Development

Last Updated : 08 Apr, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Food Delivery Application is one of the most common software development projects to date. In this article, we are going to make the Food Delivery Application software development project, from scratch, for final-year students. We will be covering all the steps you have to do while developing this project.

Food-Delivery-Application-banner-copy

Project Development is a multiphase process in which every process is equally important. Here in this post, we are also going to develop our Food Delivery Application Project in multiple phases, such as:

  1. Team Formation
  2. Topic Selection
  3. Creating Project Synopsys
  4. Requirement Gathering
  5. Coding or Implementation
  6. Testing
  7. Project Presentation
  8. Writing a Research Paper

Let us look into the steps one by one.

Step 1- Team Formation Phase: Creating a Dynamic Team

Team formation for a final-year project is a crucial aspect that can significantly impact the success and efficiency of the project. In the final year, students often have diverse academic backgrounds, skills, and interests. Therefore, forming a well-balanced team becomes essential to leverage the strengths of each member and address any potential weaknesses.

In Our project, we will be exploring web applications for Food Delivery Application so we will be required below skill sets.

  1. Front end Developer
  2. Back end Developer
  3. Tester
  4. DevOps Developer
    food-delivery-w

Step 2- Topic Selection

While making our project of Food Delivery Application this will be our second step in which we will find an interesting problem statement and try to generate an idea to solve that problem using our knowledge.

Choose a topic related to your field of study that is of great interest to you. It is advised that you pick a topic that has a powerful motive. For instance, a project that helps humankind will truly be unmatched. Another factor to keep in mind is to choose topics that aren’t very common. 

food-2

  • Topic Planning: In this phase team will gather and try to search a topic or problem statement by brainstorming , reverse thinking or any other strategy and select a problem which is challenging in nature and solvable by using their combined knowledge of tech.
  • Defining & Set Objective: After planning the problem statement we will define clear problem statement and its objectives.

Result : In the end of this phase we will be having a problem statement for our project.

In our example we are selecting the topic ” Food Delivery Application ” .

After the selection of the topic we are going to start our project work in the following steps:

Step 3- Project Synopsys for Food Delivery Application

A project synopsis serves as a concise overview or summary of a proposed project, offering a brief but comprehensive insight into its objectives, scope, methodology, and expected outcomes. It typically acts as a preliminary document, providing supervisors, or evaluators with a quick understanding of the project before they delve into more detailed documentation.

Food-delivery-application-23

The project synopsis usually includes key elements such as the project titleproblem statement or contextobjectivesscope and limitationsmethodology or approachexpected outcomes, and the significance of the project in the broader context. It serves as a roadmap, guiding readers through the fundamental aspects of the project and helping them grasp its purpose and potential impact.

Below are some of the points we have to cover in the synopsis report :

  • Project Title
  • Introduction of Project
    • Problem Statement
    • Proposed Solution
    • Objective of the Project
    • Scope of the Project
  • Methodologies used
    • ER Model
    • Use case Diagram
    • Dataflow Diagram
  • Features of the project
    • For Users
    • For Admin
  • Impact of the project
  • Limitations of the project
  • Future scope of the project

Let’s create a Synopsys Report for Food Delivery Application:

3.1 Introduction | Project Synopsys for Food Delivery Application:

Our project is about making a Food Delivery Application. This app helps people order food from their favorite restaurants and get it delivered to their doorstep. With just a few taps on their phone, users can explore a variety of dishes, place orders, and track their delivery in real-time. Through this project, we’ll showcase our skills in app development, user interface design, and customer satisfaction. Join us on this journey as we bring delicious meals closer to people’s homes with our Food Delivery Application.

3.1.1 Problem Statement for Food Delivery Application:

In today’s fast-paced world, accessing favorite meals is often inconvenient due to outdated ordering methods and limited menu options. Customers face challenges in tracking orders and ensuring timely delivery, while restaurants struggle with managing orders and maintaining customer satisfaction. There is a need for a modern Food Delivery Application to streamline the ordering process, offer diverse cuisines, and provide real-time delivery tracking. Our project aims to develop a user-friendly solution that bridges the gap between customers and restaurants, enhancing the overall dining experience for both parties.

3.1.2 Proposed Solution for Food Delivery Application:

Our solution is a user-friendly Food Delivery Application offering a diverse restaurant selection, effortless ordering, and real-time delivery tracking. With intuitive interfaces, secure payments, and optimized logistics, we ensure a seamless dining experience. Users can provide feedback for continuous improvement, empowering both customers and restaurants.

3.1.3 Objective of the Project:

The objective of our project is to develop a Food Delivery Application that simplifies the process of ordering food, enhances customer satisfaction, and improves the operational efficiency of participating restaurants. We aim to create a user-friendly platform that offers a wide variety of cuisines, facilitates seamless order placement and delivery tracking, and fosters positive interactions between customers and restaurants.

Our project seeks to achieve several key objectives:

  1. Simplify Ordering Process: Develop a user-friendly interface that simplifies the process of ordering food, allowing customers to browse menus, customize orders, and complete transactions effortlessly.
  2. Enhance Customer Satisfaction: Focus on improving the overall dining experience for customers by providing a diverse selection of restaurants, ensuring timely deliveries, and offering features such as order tracking and customer feedback.
  3. Optimize Restaurant Operations: Assist restaurants in managing orders more efficiently by providing tools for order management, delivery logistics optimization, and performance analytics.
  4. Promote Accessibility: Make food delivery more accessible to a wider audience by offering a variety of cuisines and catering to different dietary preferences and requirements.
  5. Foster Growth and Innovation: Encourage innovation within the food delivery industry by introducing new features, technologies, and strategies that improve convenience, quality, and sustainability.

By achieving these objectives, our project aims to revolutionize the food delivery landscape, creating a more seamless and enjoyable experience for both customers and restaurants alike.

3.1.4 Scope of the Project:

The scope of our project encompasses the following key aspects:

Functional Scope:

  1. User Registration and Authentication: Allow users to register accounts securely and log in to access the application’s features.
  2. Restaurant and Menu Management: Enable restaurants to manage their menus, update dish availability, and set prices.
  3. Order Placement and Management: Facilitate users to browse menus, place orders, and make payments securely. Provide order management features for restaurants to accept, process, and fulfill orders.
  4. Delivery Tracking: Implement real-time order tracking for users to monitor the status of their deliveries, including estimated arrival times and delivery driver information.
  5. Feedback and Rating System: Incorporate a system for users to provide feedback and ratings on their dining experience, allowing restaurants to improve their services.

Non-functional Scope:

  1. Performance: Ensure the application performs efficiently, with fast loading times and responsive user interfaces.
  2. Security: Implement robust security measures to protect user data, including encryption of sensitive information and secure payment processing.
  3. Scalability: Design the application to handle a large number of users and orders, with the ability to scale resources as needed to accommodate growth.
  4. Reliability: Ensure the application is reliable and available at all times, minimizing downtime and disruptions to service.
  5. Usability: Design the user interface to be intuitive and easy to navigate, with clear instructions and helpful prompts for users.

By considering both the functional and non-functional aspects of the project scope, we aim to deliver a high-quality Food Delivery Application that meets the needs of users and restaurants while adhering to industry best practices and standards.

3.2 Methodologies | Project Synopsys for Food Delivery Application

In this application we are using various technologies and new methodologies to solve our problems. Below are the detailed description about the technology used and methods we are applying in our project.

Technology Used:

Here we are developing a Food Delivery Application using HTMLCSS React.js for the frontend, and Node.js, and JavaScript for the backend involves a structured methodology.

ER Model of Food Delivery Application:

An Entity-Relationship Diagram (ERD) for a Food Delivery Application models the entities and their relationships within the system. Below is a simplified ERD for a Food Delivery Application. In Synopsys we make a rough ER Diagram to give a idea about the working of the project.

Let’s Draw an ER Model of Food Delivery Application:

Food-Delivery-Application

ER diagram of Food delivery application


Entities:

  1. User: Represents individuals who use the food delivery application. Attributes may include UserID (Primary Key), Name, Email, Password, Phone Number, and Address.
  2. Restaurant: Represents the restaurants available on the platform. Attributes may include RestaurantID (Primary Key), Name, Cuisine Type, Address, Contact Number, and Rating.
  3. Menu Item: Represents the individual food items offered by restaurants. Attributes may include MenuItemID (Primary Key), Name, Description, Price, and RestaurantID (Foreign Key).
  4. Order: Represents the orders placed by users. Attributes may include OrderID (Primary Key), UserID (Foreign Key), OrderDate, DeliveryAddress, TotalAmount, and OrderStatus.
  5. Delivery Driver: Represents the individuals responsible for delivering orders. Attributes may include DriverID (Primary Key), Name, Contact Number, and Availability.

Relationships:

  1. User-Order Relationship: One-to-Many relationship between User and Order. One user can place multiple orders, but each order belongs to one user.
  2. Restaurant-Menu Item Relationship: One-to-Many relationship between Restaurant and Menu Item. One restaurant can offer multiple menu items, but each menu item belongs to one restaurant.
  3. User-Review Relationship: One-to-Many relationship between User and Review. One user can provide multiple reviews, but each review is provided by one user.
  4. Order-Menu Item Relationship: Many-to-Many relationship between Order and Menu Item. An order can contain multiple menu items, and a menu item can be part of multiple orders. This relationship is represented by an associative entity or junction table.
  5. Order-Delivery Driver Relationship: Many-to-One relationship between Order and Delivery Driver. Multiple orders can be assigned to the same delivery driver, but each order is assigned to one delivery driver.

This entity-relationship model captures the essential entities and their relationships within the food delivery application, facilitating the understanding of data requirements and interactions in the system.

Data Flow Diagram of Food Delivery Application:

Data Flow Diagram (DFD) serves as a visual representation of the flow of information within the system. The DFD provides a concise yet comprehensive overview of the project’s data flow and interactions, aiding in the analysis, design, and communication of the system’s functional aspects.

  • Processes:
    • Order Management
    • User Management
    • Restaurant Management
    • Delivery Management
    • Review Management
  • External Entities:
    • User
    • Restaurant
    • Delivery Driver
  • Data Stores:
    • User Data
    • Restaurant Data
    • Order Data
    • Review Data
  • Data Flows:
    • Order Request
    • Order Details
    • Delivery Assignment
    • Review Submission

This DFD illustrates how users interact with the system to place orders, how restaurants and delivery drivers fulfill these orders, and how feedback is managed.

DFD-level-0-01


DFD-level-1-01


DFD-level-2-01

Use Case Diagram of Food Delivery Application:

A Use Case Diagram visually represents the interactions between actors (users) and the system, focusing on the functionalities offered by the system. In the context of a food delivery application, here’s a simplified Use Case Diagram:

Here is a Use Case Diagram for Food Delivery Application:

Use-Case-Diagram-01

3.3 Features | Project Synopsys for Food Delivery Application

Here are the features of the Food Delivery Application:

  1. User Registration and Authentication:
    • Allow users to register accounts securely.
    • Implement authentication mechanisms to ensure data security.
  2. Browse Restaurants and Menus:
    • Provide users with a comprehensive list of restaurants.
    • Allow users to browse restaurant menus and view dish details.
  3. Order Placement and Customization:
    • Enable users to place orders easily with a few clicks.
    • Allow customization of orders, such as adding special instructions or modifying ingredients.
  4. Real-Time Order Tracking:
    • Implement a feature for users to track their orders in real-time.
    • Provide updates on order status, estimated delivery time, and delivery driver information.
  5. Secure Payment Options:
    • Integrate secure payment gateways for seamless transactions.
    • Support various payment methods such as credit/debit cards, digital wallets, and cash on delivery.
  6. Delivery Management:
    • Assign delivery drivers to orders efficiently.
    • Optimize delivery routes to ensure timely and efficient deliveries.
  7. Rating and Feedback System:
    • Allow users to rate restaurants and delivery drivers.
    • Provide a feedback mechanism for users to share their dining experience and suggest improvements.
  8. Order History and Favorites:
    • Maintain a record of users’ order history for easy reordering.
    • Allow users to save favorite restaurants and dishes for quick access.
  9. Push Notifications:
    • Send notifications to users regarding order status updates, promotions, and new restaurants.
  10. Customer Support:
    • Offer customer support channels such as chat support or helpline for assistance with orders or technical issues.
  11. Restaurant Management Portal:
    • Provide a portal for restaurants to manage their menus, view orders, and track performance metrics.
  12. Delivery Driver App:
    • Develop a separate app for delivery drivers to receive delivery assignments, navigate to delivery locations, and update order statuses.

These features aim to provide a comprehensive and user-friendly experience for both customers and restaurants, making the food delivery process convenient, efficient, and enjoyable.

3.4 Impact | Project Synopsys for Food Delivery Application

Here are the impact of the Food Delivery Application:

  1. Convenience for Users:
    • Users can order food from their favorite restaurants conveniently, saving time and effort.
  2. Increased Accessibility:
    • The application makes food delivery accessible to a wider audience, including those with mobility constraints or busy schedules.
  3. Support for Restaurants:
    • Restaurants can reach a broader customer base and increase their sales through the platform, especially during off-peak hours.
  4. Job Opportunities:
    • The application creates job opportunities for delivery drivers, contributing to employment generation in the community.
  5. Enhanced Efficiency:
    • Restaurants can optimize their operations by managing orders more efficiently and reducing wastage through better inventory management.
  6. Customer Engagement:
    • The feedback and rating system allows for continuous improvement based on customer preferences and suggestions, leading to better customer satisfaction.
  7. Technological Advancement:
    • The application leverages technology to streamline the food delivery process, showcasing the potential of digital innovation in the food industry.
  8. Economic Growth:
    • The increased efficiency and revenue generation for restaurants contribute to the economic growth of the local food industry.
  9. Environmental Impact:
    • Efficient delivery routing and reduced reliance on personal vehicles for food pickup can lead to a decrease in carbon emissions and environmental impact.
  10. Cultural Exchange:
    • Users can explore a variety of cuisines from different cultures, promoting diversity and cultural exchange within the community.

Overall, the Food Delivery Application has a positive impact on various stakeholders, including users, restaurants, delivery drivers, and the community at large, by providing convenience, economic opportunities, and technological advancement.

3.5 Limitations | Project Synopsys for Food Delivery Application

Here are the limitations of the Food Delivery Application:

  1. Dependency on Internet Connectivity:
    • Users require a stable internet connection to access the application, which may pose challenges in areas with poor network coverage.
  2. Geographical Limitations:
    • The availability of restaurants and delivery services may be limited to certain geographic locations, restricting access for users in remote areas.
  3. Delivery Time Constraints:
    • Factors such as traffic congestion, weather conditions, and peak hours may affect delivery times, leading to longer wait times for users.
  4. Quality Control Challenges:
    • Maintaining food quality during delivery can be challenging, especially for delicate or temperature-sensitive dishes.
  5. Dependency on Third-party Services:
    • The application relies on third-party services for payment processing, delivery logistics, and restaurant partnerships, which may introduce potential vulnerabilities or limitations.
  6. User Interface Complexity:
    • The user interface may be complex for some users, especially those who are not familiar with technology or have limited digital literacy.
  7. Data Privacy Concerns:
    • Collecting and storing user data for order processing and analytics may raise privacy concerns, requiring robust security measures to protect sensitive information.
  8. Competition and Market Saturation:
    • The food delivery market is highly competitive, with numerous players vying for market share, which may lead to challenges in attracting and retaining customers.
  9. Environmental Impact:
    • Increased reliance on food delivery services may contribute to environmental issues such as packaging waste and carbon emissions from delivery vehicles.
  10. Customer Service Limitations:
    • Providing timely customer support and resolving issues effectively may be challenging, especially during peak demand periods.

Despite these limitations, the Food Delivery Application aims to address user needs and provide a convenient dining experience, while also striving to mitigate potential drawbacks through continuous improvement and innovation.

3.6 Future Scope | Project Synopsys for Food Delivery Application

Here are the future Scope of the Food Delivery Application:

  1. Integration of AI and Machine Learning:
    • Implement AI-driven recommendation systems to suggest personalized menus and promotions based on user preferences and past orders.
    • Utilize machine learning algorithms to optimize delivery routes, predict demand patterns, and improve order accuracy.
  2. Enhanced User Experience:
    • Develop augmented reality (AR) features to allow users to visualize dishes before ordering.
    • Introduce voice-enabled ordering capabilities for hands-free interaction with the application.
  3. Expansion of Services:
    • Explore opportunities to offer additional services such as grocery delivery, meal subscriptions, or event catering.
    • Partner with local businesses to provide exclusive deals and promotions for users.
  4. Sustainability Initiatives:
    • Implement eco-friendly packaging options and incentivize users to choose sustainable delivery methods.
    • Collaborate with environmentally conscious restaurants and suppliers to promote sustainability practices.
  5. Global Expansion:
    • Expand the reach of the application to new geographic regions and international markets, catering to diverse culinary preferences and cultures.
    • Localize the application interface and menus to accommodate language and cultural preferences of users in different regions.
  6. Integration with Smart Devices:
    • Enable integration with smart home devices such as smart refrigerators or voice assistants for seamless ordering and meal planning.
    • Introduce IoT-enabled tracking devices for real-time monitoring of food delivery temperatures and quality.
  7. Partnerships and Collaborations:
    • Forge partnerships with food bloggers, influencers, and celebrity chefs to promote the application and enhance brand visibility.
    • Collaborate with transportation companies to explore innovative delivery methods such as drones or autonomous vehicles.
  8. Community Engagement Initiatives:
    • Launch community-driven initiatives such as charity meal programs, food donation drives, or local culinary events to foster community engagement and social impact.
    • Implement loyalty programs and referral incentives to reward loyal users and encourage word-of-mouth marketing.
  9. Continuous Improvement:
    • Gather feedback from users, restaurants, and delivery drivers to identify areas for improvement and implement iterative updates to enhance the application’s functionality and user experience.
    • Stay updated with emerging technologies and industry trends to remain competitive and innovative in the evolving food delivery market.
  10. Data Analytics and Insights:
    • Leverage data analytics tools to gain actionable insights into user behavior, market trends, and operational performance.
    • Use predictive analytics to anticipate customer preferences and optimize business strategies for growth and profitability.

By exploring these future avenues, the Food Delivery Application can continue to evolve, innovate, and meet the changing needs and preferences of users and stakeholders in the dynamic food delivery industry.

After Creating Synopsys of our project we will start building Software Requirement Specification for our project , which will be out next phase .

Step 4- Requirement Gathering (Creating SRS for Food Delivery Application)

This is the next phase after the submission of the synopsis report. We can do this process before the Synopsys report creation as well , It is all depends upon the project and their requirements. Here after getting an overview about the project now we can easily do the requirement gathering for our project.

Requirement analysis, also known as requirements engineering or elicitation, is a critical phase in the software development process. It involves gathering, documenting, and analysing the needs and constraints of a project to define its scope and guide subsequent development.

stage-4

We develop a detailed Software Requirement Specification for Food Delivery Application, in this process which will have all the details about the project from Technical to Non Technical Requirements.

Software Requirement Specification (SRS) Document | Food Delivery Application

Below are some of the key points in a Software Requirement Specification Document:

  • Introduction
    • Purpose
    • Scope
    • References
  • Overall Description
    • Product Perspective
    • Product Function
    • User Classes and characteristics
    • Operating Environment
    • Assumptions and Dependencies
  • Functional Requirements
    • Software Requirements
    • Hardware Requirements
    • Database Requirements
  • Non-Functional Requirement
    • Usability Requirements
    • Security Requirements
    • Availability Requirements
    • Scalability Requirements
    • Performance Requirements
  • Design
    • Control Flow Diagram
    • ER Model of LMS
    • Use Case Diagram
  • System Features

Note: To know more about What is a SRS Document or How to write a good SRS for your Project follow these articles.

Let’s Start building a Software Requirement Specification for Food Delivery Application Document for our project:

4.1 SRS (Food Delivery Application) | Introduction:

4.1.1 Purpose:

The purpose of a food delivery application is to provide a convenient and efficient platform for users to order food from a variety of restaurants and have it delivered to their doorstep. The application aims to streamline the process of ordering food by offering a user-friendly interface, diverse restaurant options, customizable menus, and real-time delivery tracking.

4.1.2 Scope of the Project:

The scope of our project encompasses the development and implementation of a comprehensive food delivery application. This application will serve as a platform for users to browse through a variety of restaurants, select their desired dishes, place orders, and have them delivered to their location. Key aspects of the project scope include the design and development of user interfaces for both customers and restaurant owners, as well as backend systems to manage orders, payments, and delivery logistics.

Additionally, the project will involve establishing partnerships with local restaurants to onboard them onto the platform, ensuring a diverse selection of cuisines and dining options for users. The scope also extends to the implementation of features such as real-time order tracking, secure payment processing, and a feedback mechanism for users to provide reviews and ratings. Overall, the project aims to create a seamless and user-friendly food delivery experience for both customers and restaurant partners, leveraging technology to enhance convenience, accessibility, and satisfaction.

4.1.3 References:

  • Software Requirements (Microsoft) Second Edition By Karl E. Wiegers
  • Fundamentals of Database System By Elmasri
  • Software Requirements and Specifications: A Lexicon of Practice, Principles and Prejudices (ACM Press) by Michael Jackson
  • Fundamentals of Software Engineering By Rajib Mall
  • Software Engineering: A Practitioner’s Approach Fifth Edition By Roger S. Pressman

4.2 SRS (Food Delivery Application) | Overall Description:

4.2.1 Product Perspective:

The food delivery application operates as an independent platform, connecting users with restaurants for efficient food ordering and delivery. It functions as a user-friendly interface, facilitating direct communication between customers and eateries. The application manages orders, payments, and delivery logistics, ensuring a streamlined experience for both parties involved. It does not rely on external systems, offering a self-contained solution for food delivery needs.

4.2.2 Product Functions:

The food delivery application offers functions for users to browse restaurant menus, place orders, track deliveries, and provide feedback. For restaurants, it provides tools for menu management, order processing, and performance tracking. Additionally, it includes features for secure payment processing, real-time order tracking, and customer support.

The food delivery application offers a range of features to enhance the user experience:

  1. User Functions:
    • Menu Browsing: Users can browse menus of nearby restaurants, filter by cuisine, and view detailed dish descriptions.
    • Order Placement: Users can select items, customize orders, and add them to the cart for checkout.
    • Real-Time Tracking: Users can track the status of their orders in real-time, from preparation to delivery.
    • Feedback Submission: Users can provide feedback and ratings for restaurants and delivery experiences.
  2. Restaurant Functions:
    • Menu Management: Restaurants can add, edit, and remove menu items, update prices, and set availability.
    • Order Processing: Restaurants receive and manage incoming orders, confirming and preparing them for delivery.
    • Performance Tracking: Restaurants can view order history, track sales metrics, and analyze customer feedback.
  3. Payment Processing:
    • Secure Transactions: The application facilitates secure payment processing, supporting various payment methods such as credit/debit cards, digital wallets, and cash on delivery.
    • Integration with Payment Gateways: Integration with third-party payment gateways ensures smooth and reliable transactions.
  4. Customer Support:
    • Chat Support: Users can access customer support through in-app chat for assistance with orders or inquiries.
    • Helpline: A dedicated helpline is available for users to contact customer support for urgent issues or concerns.

These functions collectively provide a comprehensive and seamless food delivery experience for users and restaurants, leveraging IoT technology to ensure efficiency, reliability, and convenience throughout the process

4.2.3 Class Diagram and Characteristics:

A class diagram illustrates the structure of classes and their relationships within the system. In the context of a food delivery application, the class diagram would include classes representing various entities and their attributes, as well as their associations and interactions.

Classes and Characteristics:

  1. User:
    • Attributes: UserID, Name, Email, Password, Phone Number, Address.
    • Characteristics: Represents individuals using the application to place orders and track deliveries.
  2. Restaurant:
    • Attributes: RestaurantID, Name, Cuisine Type, Address, Contact Number.
    • Characteristics: Represents eateries registered on the platform, providing menus and fulfilling orders.
  3. Order:
    • Attributes: OrderID, UserID, RestaurantID, OrderDate, DeliveryAddress, TotalAmount, OrderStatus.
    • Characteristics: Represents orders placed by users, including details such as delivery address and order status.
  4. MenuItem:
    • Attributes: MenuItemID, Name, Description, Price, RestaurantID.
    • Characteristics: Represents individual food items offered by restaurants, including their names, descriptions, and prices.
  5. DeliveryDriver:
    • Attributes: DriverID, Name, Contact Number, Availability.
    • Characteristics: Represents individuals responsible for delivering orders to users.
  6. Review:
    • Attributes: ReviewID, UserID, RestaurantID, Rating, Comment.
    • Characteristics: Represents reviews and ratings provided by users for restaurants.

Associations:

  • User-Order: One-to-Many association, as a user can place multiple orders.
  • Restaurant-MenuItem: One-to-Many association, as a restaurant can offer multiple menu items.
  • Order-MenuItem: Many-to-Many association, as an order can contain multiple menu items.
  • Order-DeliveryDriver: Many-to-One association, as multiple orders can be assigned to the same delivery driver.
  • User-Review: One-to-Many association, as a user can provide multiple reviews for different restaurants.

Characteristics:

  • Encapsulation: Classes encapsulate data and behavior related to their respective entities, ensuring data integrity and modularity.
  • Inheritance: Classes may inherit attributes and methods from parent classes, promoting code reuse and maintaining consistency.
  • Association: Classes are associated with each other through relationships such as composition, aggregation, or inheritance, facilitating communication and collaboration within the system.
  • Polymorphism: Classes may exhibit polymorphic behavior, allowing them to respond differently to the same message based on their specific implementations.

Class-Diagram-01

This class diagram and its characteristics provide a structured representation of the entities, relationships, and behaviors within the food delivery application, aiding in the design, implementation, and maintenance of the system

4.2.4 General Constraints:

  1. Technological Constraints:
    • Compatibility: The application must be compatible with various devices and operating systems (iOS, Android).
    • Technology Stack: Development must adhere to chosen technologies and frameworks for consistency and scalability.
  2. Regulatory Constraints:
    • Data Protection: Compliance with data protection regulations (e.g., GDPR) regarding user privacy and data security.
    • Food Safety: Adherence to food safety regulations and standards for handling and delivering food items.
  3. Operational Constraints:
    • Availability: The application should maintain high availability to accommodate user demand, with minimal downtime.
    • Scalability: Infrastructure and systems should be scalable to handle increasing user traffic and transaction volumes.
  4. Financial Constraints:
    • Budget: Development and maintenance costs should be managed within allocated budgets and resources.
    • Revenue Model: Revenue generation strategies, such as commission fees or subscription plans, should be balanced with user affordability.

4.2.5 Assumptions and Dependencies:

Here are the Assumptions and Dependencies

Assumptions:

  • User Connectivity: Users have access to stable internet connectivity to use the application.
  • Restaurant Participation: Restaurants are willing to partner with the application and provide accurate menu information and timely order fulfillment.
  • Delivery Infrastructure: Adequate delivery infrastructure and logistics partners are available to facilitate timely and efficient order deliveries.
  • User Adoption: There will be sufficient user adoption and demand for the application’s services in targeted markets.
  • Regulatory Compliance: Assumption that the application will comply with relevant regulations and standards related to food delivery, data protection, and payment processing.
  1. Dependencies:
    • Payment Gateways: Dependency on third-party payment gateways for secure and reliable payment processing.
    • Mapping Services: Dependency on mapping services (e.g., Google Maps) for accurate location tracking and delivery route optimization.
    • Cloud Infrastructure: Dependency on cloud infrastructure providers for hosting and scaling application resources.
    • Restaurant Partnerships: Dependency on partnerships with restaurants for menu data, order fulfillment, and delivery coordination.
    • User Feedback: Dependency on user feedback and ratings for maintaining service quality and improving user experience.
    • Technology Providers: Dependency on technology providers for software development tools, frameworks, and libraries used in application development.

These assumptions and dependencies influence the planning, development, and operation of the food delivery application, requiring proactive management and collaboration with stakeholders to ensure project success and sustainability.

4.3 SRS (Food Delivery Application) | Designing Food Delivery Application :

Use case Diagram for Food Delivery Application:

Creating a Use Case Diagram for a Food Delivery Application:

  1. Actors:
    • User
    • Restaurant
    • Delivery Driver
  2. Use Cases:
  • User:
    1. Browse Restaurants and Menus
    2. Place Order
    3. Track Order
    4. Provide Feedback
  • Restaurant:
    1. Manage Menu
    2. Receive Order
    3. Update Order Status
  • Delivery Driver:
    1. Accept Delivery Assignment
    2. Deliver Order
    3. Update Delivery Status

Use-Case-Diagram-01

Relationships:

  • User can Browse Restaurants and Menus, Place Order, Track Order, and Provide Feedback.
  • Restaurant can Manage Menu, Receive Order, and Update Order Status.
  • Delivery Driver can Accept Delivery Assignment, Deliver Order, and Update Delivery Status.

System Boundary:

  • Use Case Diagram is enclosed within the system boundary, representing the interactions between actors and the system.

This Use Case Diagram visually represents the interactions between users (customers), restaurants, and delivery drivers within the food delivery application system, illustrating the various functions and processes supported by the application.

ER Model of Food Delivery Application:

ER Diagram is known as Entity-Relationship Diagram, it is used to analyze  the structure of the Database. It shows relationships between entities and their attributes. An ER Model provides a means of communication. 

Creating an Entity-Relationship (ER) diagram for a Food Delivery Application:

Entities:

  1. User:
    • Attributes: UserID (Primary Key), Name, Email, Password, Phone, Address.
  2. Restaurant:
    • Attributes: RestaurantID (Primary Key), Name, Cuisine Type, Address, Contact Number.
  3. MenuItem:
    • Attributes: MenuItemID (Primary Key), Name, Description, Price, RestaurantID (Foreign Key).
  4. Order:
    • Attributes: OrderID (Primary Key), UserID (Foreign Key), RestaurantID (Foreign Key), OrderDate, DeliveryAddress, TotalAmount, OrderStatus.
  5. DeliveryDriver:
    • Attributes: DriverID (Primary Key), Name, Contact Number, Availability.
  6. Review:
    • Attributes: ReviewID (Primary Key), UserID (Foreign Key), RestaurantID (Foreign Key), Rating, Comment.

Relationships:

  1. User-Order:
    • One-to-Many relationship: Each user can place multiple orders, but each order is placed by only one user.
  2. Restaurant-MenuItem:
    • One-to-Many relationship: Each restaurant can offer multiple menu items, but each menu item belongs to only one restaurant.
  3. Order-DeliveryDriver:
    • Many-to-One relationship: Each order is assigned to one delivery driver, but a delivery driver can be assigned to multiple orders.
  4. User-Review:
    • One-to-Many relationship: Each user can provide multiple reviews, but each review is provided by only one user.


Food-Delivery-Application

This ER model represents the entities (User, Restaurant, MenuItem, Order, DeliveryDriver, Review) and their relationships in a Food Delivery Application, providing a foundation for database design and implementation.

Data Flow Diagram of Food Delivery Application:

Data Flow Diagram (DFD) serves as a visual representation of the flow of information within the system. This diagram illustrates how data, between various components of the Food delivery application.
Sure, here are the explanations for each level of the Data Flow Diagram (DFD) for a Food Delivery Application:

Level 0 DFD:

  • Food Delivery App: This represents the main system, which acts as a central hub for all processes and interactions within the application.
  • User: Users interact with the application to browse restaurants, place orders, track deliveries, and provide feedback.
  • Restaurant: Restaurants interact with the application to manage menus, receive orders, update order statuses, and manage inventory.
  • Delivery: Delivery drivers interact with the application to accept delivery assignments, deliver orders, and update delivery statuses.
  • Inventory: This process manages inventory levels and the availability of menu items, ensuring that restaurants can fulfill orders accurately.

DFD-level-0-01

Level 1 DFD (User Process):

  • Browse Restaurants: Users can browse through available restaurants and their menus to make informed choices about where to order from.
  • Order Placement: Users select dishes, customize their orders, and place them through the application.
  • Track Order: Users can track the status of their placed orders, including preparation, delivery, and estimated arrival time.
  • Provide Feedback: Users can provide feedback and ratings for restaurants and delivery drivers based on their experience with the service.

DFD-level-1-01

Level 2 DFD (Restaurant Process):

  • Manage Menu: Restaurants manage their menus, including adding, updating, or removing menu items as needed.
  • Receive Order: Restaurants receive incoming orders from users, acknowledge them, and prepare them for delivery.
  • Update Order Status: Restaurants update the status of received orders as they progress through the preparation and delivery process.
  • Update Inventory: Restaurants update their inventory levels based on the fulfillment of orders to ensure accurate tracking of available menu items.

DFD-level-2-01

These explanations provide a clear understanding of the processes and interactions depicted in the Data Flow Diagram for a Food Delivery Application, illustrating how users, restaurants, and delivery drivers interact with the system to facilitate the ordering and delivery process.

4.4 Functional Requirements | SRS (Food Delivery Application)

The project must have the following functional requirements:

  1. User Registration and Login:
    • Users should be able to register an account with the application using their email or phone number.
    • Users should be able to log in securely to access their account and use the application’s features.
  2. Browse and Search Restaurants:
    • Users should be able to browse through a list of restaurants based on location, cuisine type, or popularity.
    • Users should be able to search for specific restaurants by name or cuisine.
  3. View Restaurant Menus:
    • Users should be able to view detailed menus for each restaurant, including item names, descriptions, prices, and images.
  4. Place Orders:
    • Users should be able to add items to their cart, customize orders (e.g., select toppings, specify cooking preferences), and proceed to checkout.
    • Users should be able to schedule orders for future delivery or pickup.
  5. Track Order Status:
    • Users should be able to track the status of their orders in real-time, from preparation to delivery.
    • Users should receive notifications regarding order confirmation, preparation, dispatch, and delivery.
  6. Payment Processing:
    • Users should be able to make secure payments using various methods, including credit/debit cards, mobile wallets, or cash on delivery.
    • Users should receive digital receipts for their orders via email or within the application.
  7. Review and Rating System:
    • Users should be able to rate and leave reviews for restaurants and delivery drivers based on their experience.
    • Users should be able to view average ratings and read reviews to make informed decisions.
  8. Account Management:
    • Users should be able to edit their profile information, including name, contact details, and delivery address.
    • Users should be able to view order history, reorder previous orders, and manage payment methods.
  9. Restaurant Management:
    • Restaurants should be able to manage their menu items, including adding, editing, and removing items.
    • Restaurants should be able to view and process incoming orders, update order statuses, and communicate with users if needed.
  10. Delivery Driver Management:
    • Delivery drivers should be able to view assigned orders, including order details, delivery addresses, and delivery instructions.
    • Delivery drivers should be able to update order statuses (e.g., order picked up, en route, delivered) and communicate with users if needed.

These functional requirements outline the core features and capabilities of a Food Delivery Application, ensuring a seamless and user-friendly experience for both customers and stakeholders involved in the food delivery process

4.4.1 Software Requirements:

This software package is developed using html , bootstrap for front end . node.js and mongo.db as the back end to store the database for backend we are using Xampp server.

  • Operating System: Windows 7, 8, 9, 10 .
  • Language: Html , Css , Javascript , React.js, node.js
  • Database: Mongo.db

4.4.2 Hardware Requirements:

  • Processor: Intel core i3 or above for a stable experience and fast retrieval of data.
  • Hard Disk: 40GB and above
  • RAM: 256 MB or more, recommended 2 GB for fast reading and writing capabilities which will result in better performance time.

4.5 Non Functional Requirements | SRS (Food Delivery Application)

4.5.1 Usability Requirements:

  • Our user interface should be interactive simple and easy to understand . The system should prompt for the user and administrator to login to the application for proper input criteria.
  • Food Delivery Application shall handle expected and non – expected errors in ways that prevent loss in information and long downtime period.

4.5.2 Security Requirements:

  • System should use secured Database.
  • Normal users can just read information but they cannot edit or modify anything except their personal and some other information.
  • System will have different types of users and every user has access constraints.
  • Proper user authentication should be provided.
  • No one should be able to hack users password .
  • There should be separate accounts for admin and members such that no member can access the database and only admin has the rights to update the database.

4.5.4 Error Requirements:

Food Delivery Application shall handle expected and non-expected errors in ways that prevent loss in information and long downtime period.

4.6 SRS (Food Delivery Application) | Appendices:

Glossary:

The following are the list of conventions and acronyms used in this document and the project as well:

  • Administrator: A login id representing a user with user administration privileges to the software.
  • User: A general login id assigned to most users.
  • Client: Intended users for the software.
  • User Interface Layer: The section of the assignment referring to what the user interacts with directly.
  • Interface: Something used to communicate across different mediums.

5. Coding or Implementation of Food Delivery Application

At this stage, the fundamental development of the product starts. For this, developers use a specific programming code as per the design. Hence, it is important for the coders to follow the protocols set by the association. Conventional programming tools like compilers, interpreters, debuggers, etc. are also put into use at this stage.

stage-5-(1)-copy

Prerequisites:

Approach to create Restaurant App using MERN:

1. Import Statements:

  • Import necessary dependencies and components.
  • React is imported for defining React components.
  • RestaurantList, RestaurantCard, DishesMenu, DishCard and Cart are custom components, assumed to be present in the ./components directory.
  • RestaurantContext is imported, presumably a custom context provider.

2.Functional Component:

  • Define a functional component named App.

3.Context Provider:

  • Wrap the App component inside the RestaurantContext provider. This suggests that the components within this provider have access to the context provided by RestaurantContext.

4.Component Rendering:

  • Render the following components:
  • RestaurantContext: Presumably, this is a context provider that wraps its child components (App). The purpose of this context is not clear from the provided code snippet.
  • All other components such as RestaurantList and DishesMenu is wrapped inside App component so it also has the access of RestaurantContext.
  • RestaurantList wraps RestaurantCard

Steps to create Application:

Step 1: creating the folder for the project

mkdir food-delivery-app
cd food-delivery-app

Step 2: Create a backend using the following commands

mkdir backend
cd backend
npm init -y

Step 3: Install the required dependencies.

npm i cors express mongoose nodemon

Project Structure(Backend):

sdfghtjyuio

Backend Folder

Backend Dependencies:

"dependencies": {
"cors": "^2.8.5",
"express": "^4.18.2",
"mongoose": "^8.0.3",
"nodemon": "^3.0.2"
}

Example: Create server.js file and add the following code.

server.js
//server.js

const express = require("express");
const mongoose = require("mongoose");
const cors = require("cors");

const app = express();
const PORT = process.env.PORT || 5000;

app.use(cors());
app.use(express.json());

mongoose
    .connect("mongodb://localhost:27017/food-delivery-app", {
        useNewUrlParser: true,
        useUnifiedTopology: true,
    })
    .then(() => console.log("Connected to db"))
    .catch((err) => console.log("Error connecting to db", err));

const restaurantSchema = new mongoose.Schema({
    name: String,
    image: String,
    menu: [
        {
            name: String,
            price: Number,
            image: String,
        },
    ],
    rating: Number,
});

const Restaurant = mongoose.model("Restaurant", restaurantSchema);

// Define the PreviousOrder schema
const previousOrderSchema = new mongoose.Schema({
    orderId: { type: String, required: true },
    dateOfOrder: { type: Date, required: true },
    amount: { type: Number, required: true },
});

const PreviousOrder = mongoose.model("PreviousOrder", previousOrderSchema);

// Seed initial data
const seedData = [
    {
        name: "Italian Delight",
        image: "https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
        menu: [
            {
                name: "Pasta Alfredo",
                price: 10,
                image: 
"https://media.geeksforgeeks.org/wp-content/uploads/20240110004646/file.jpg",
            },
            {
                name: "Margherita Pizza",
                price: 15,
                image: 
"https://media.geeksforgeeks.org/wp-content/uploads/20240110004646/file.jpg",
            },
            {
                name: "Chicken Parmesan",
                price: 20,
                image: 
"https://media.geeksforgeeks.org/wp-content/uploads/20240110004646/file.jpg",
            },
        ],
        rating: 4.5,
    },
    {
        name: "Seafood Paradise",
        image: 
"https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
        menu: [
            {
                name: "Grilled Salmon",
                price: 12,
                image: 
"https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
            },
            {
                name: "Lobster Bisque",
                price: 18,
                image: 
"https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
            },
            {
                name: "Shrimp Scampi",
                price: 25,
                image: 
"https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
            },
        ],
        rating: 3.8,
    },
    {
        name: "Vegetarian Haven",
        image: "https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
        menu: [
            {
                name: "Quinoa Salad",
                price: 8,
                image: 
"https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
            },
            {
                name: "Eggplant Parmesan",
                price: 12,
                image: 
"https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
            },
            {
                name: "Mushroom Risotto",
                price: 16,
                image: 
"https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
            },
        ],
        rating: 4.2,
    },
    {
        name: "Sizzling Steakhouse",
        image: "https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
        menu: [
            {
                name: "Filet Mignon",
                price: 22,
                image: "https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
            },
            {
                name: "New York Strip",
                price: 18,
                image: "https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
            },
            {
                name: "Ribeye Steak",
                price: 25,
                image: "https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
            },
        ],
        rating: 4.7,
    },
    {
        name: "Asian Fusion",
        image: "https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
        menu: [
            {
                name: "Sushi Platter",
                price: 20,
                image: "https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
            },
            {
                name: "Pad Thai",
                price: 15,
                image: "https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
            },
            {
                name: "Mongolian Beef",
                price: 18,
                image: "https://media.geeksforgeeks.org/wp-content/uploads/20240110004602/pexels-chan-walrus-958545-(1).jpg",
            },
        ],
        rating: 4.0,
    },
];

const seedDatabase = async () => {
    try {
        await Restaurant.deleteMany(); // Clear existing data
        await Restaurant.insertMany(seedData);
        console.log("Database seeded successfully.");
    } catch (error) {
        console.error("Error seeding the database:", error.message);
    }
};

// Seed data when the server starts
seedDatabase();

// Insert dummy data when the server starts
const insertDummyData = async () => {
    try {
        const existingOrders = await PreviousOrder.find();

        // Insert dummy data only if the database is empty
        if (existingOrders.length === 0) {
            const dummyOrders = [
                { orderId: "001", dateOfOrder: new Date(), amount: 30 },
                { orderId: "002", dateOfOrder: new Date(), amount: 45 },
                // Add more dummy orders as needed
            ];

            await PreviousOrder.insertMany(dummyOrders);
            console.log("Dummy data inserted successfully!");
        }
    } catch (error) {
        console.error("Error inserting dummy data:", error);
    }
};
insertDummyData();

app.get("/restaurants", async (req, res) => {
    try {
        // Use the 'find' method of the 'Restaurant' model to retrieve all restaurants
        const restaurants = await Restaurant.find({});

        // Send the retrieved restaurants as a JSON response
        res.json(restaurants);
    } catch (error) {
        // Handle any errors that may occur during the process and send a 500 Internal Server Error response
        res.status(500).json({ error: error.message });
    }
});

// Endpoint to retrieve previous orders
app.get("/previousOrders", async (req, res) => {
    try {
        const orders = await PreviousOrder.find();
        res.status(200).json(orders);
    } catch (error) {
        res.status(500).json({ error: "Internal server error" });
    }
});
// Endpoint to save order data
app.post("/previousOrders", async (req, res) => {
    try {
        const { orderId, dateOfOrder, amount } = req.body;

        console.log(orderId, dateOfOrder, amount);

        const newOrder = new PreviousOrder({
            orderId,
            dateOfOrder: new Date(dateOfOrder),
            amount,
        });

        await newOrder.save();
        res.status(201).json({ message: "Dummy order saved successfully!" });
    } catch (error) {
        res.status(500).json({ error: "Internal server error" });
    }
});

app.listen(PORT, () => {
    console.log(`Server is running on port ${PORT}`);
});

Step 4: To start the backend run the following command.

nodemon server.js

Step 5: Go to the root directory of the application and create the frontend application.

npx create-react-app client
cd client

Step 6: Install important dependencies: axios

npm i axios

Project Structure(Frontend):

dsfghj

Frontend Folder Structure.

Frontend dependencies:

 "dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"axios": "^1.6.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.21.1",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
}

Example: Create the required files and add the following code.

app.css
/* App.css */

.container {
    font-family: 'Arial, sans-serif';
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header {
    font-size: 24px;
    margin-bottom: 10px;

    border-radius: 15px;
}

/* Styles to Resturant List */


/* RestaurantList.css */

.container {
    font-family: 'Arial, sans-serif';
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header {
    font-size: 32px;
    margin-bottom: 20px;
    background-color: #fc0671;
    color: white;
    padding: 10px;
}

.filter-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.filter-container label {
    font-size: 18px;
    color: #555;
}

.filter-input {
    padding: 8px;
    font-size: 16px;
}

.restaurant-card-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}


/* RestaurantCard.css */

.card {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 12px;
    margin: 10px;
    width: 200px;
    cursor: pointer;
    transition: transform 0.3s ease-in-out;
}

.card:hover {
    transform: scale(1.05);
}

.image-container {
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 10px;
    height: 150px;
    /* Set a fixed height for the image container */
}

.restaurant-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Maintain the aspect ratio and cover the container */
    border-radius: 8px;
}

/* Responsive Styles */
@media screen and (max-width: 600px) {
    .card {
        width: 100%;
    }
}



/* Dish Card */
.dish-card {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 12px;
    margin: 10px;
    width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.3s ease-in-out;
}

.dish-card:hover {
    transform: scale(1.05);
}

img {
    width: 100%;
    /* Set the width to fill the container */
    height: 100px;
    /* Set the fixed height for the image */
    object-fit: cover;
    /* Maintain the aspect ratio and cover the container */
    border-radius: 8px;
    margin-bottom: 10px;
}

h3 {
    margin-bottom: 8px;
}

p {
    margin-bottom: 8px;
}

button {
    margin-top: 8px;
    padding: 8px;
    cursor: pointer;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 4px;
}

/* Responsive Styles */
@media screen and (max-width: 600px) {
    .dish-card {
        width: 100%;
    }
}


/* CART */
.cart-container {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 200px;
    border: 2px solid #fc0671;
    border-radius: 10px;
    height: fit-content;
    padding: 5px 10px;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    z-index: 1000;
}

.cart-container button {
    background-color: #fc0671;
    color: white;
    border: none;
    border-radius: 10px;
}

h2 {
    margin-bottom: 10px;
    margin-left: 20px;
}

.cart-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}



#pre-orders {
    background-color: #fc0671;
    color: aliceblue;
    font-size: 20px;
    padding: 5px 10px;
    border-radius: 10px;
    cursor: pointer;
}



/* Previous orders */
/* PreviousOrders.css */

.previous-orders-container {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    position: absolute;
    background-color: #fc0671;
    color: white;
    border-radius: 10px;
}

.orders-list {
    list-style: none;
    padding: 0;
}

.order-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease-in-out;
}

.order-card:hover {
    transform: scale(1.02);
}

.order-card h3 {
    color: #333;
    margin-bottom: 10px;
}

.order-details {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #666;
}
index.js
//index.js (update previous index.js)
 
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import { RestaurantProvider } from './contexts/RestaurantContext';
 
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
    <RestaurantProvider>
        <App />
    </RestaurantProvider>
);
 
reportWebVitals();
app.js
// App.js

import React, { useContext } from "react";
import RestaurantList from "./components/RestaurantList";
import DishesMenu from "./components/DishesMenu";
import Cart from "./components/Cart";
import { RestaurantContext } from "./contexts/RestaurantContext";
import "./App.css"; // Import the CSS file

const App = () => {
    const { selectedRestaurant } = useContext(RestaurantContext);

    return (
        <>
            <div className="container">
                <h1 className="header">GFG Food Delivery App</h1>
                <Cart
                    style={{ position: "absolute", right: "20px", top: "20px" }}
                />
                <RestaurantList />
                {selectedRestaurant && <DishesMenu />}
            </div>
        </>
    );
};

export default App;
RestaurantContext.js
//RestaurantContext.js

import React, { createContext, useState, useEffect } from "react";
import axios from "axios";

const RestaurantContext = createContext();

const RestaurantProvider = ({ children }) => {
    const [restaurants, setRestaurants] = useState([]);
    const [selectedRestaurant, setSelectedRestaurant] = useState(null);
    const [cartItems, setCartItems] = useState([]);
    const [totalPrice, setTotalPrice] = useState(0);

    useEffect(() => {
        const fetchRestaurants = async () => {
            try {
                const response = await axios.get(
                    "http://localhost:5000/restaurants"
                );
                setRestaurants(response.data);
            } catch (error) {
                console.error("Error fetching restaurants:", error.message);
            }
        };

        fetchRestaurants();
    }, []);

    const handleAddItems = (dish) => {
        console.log("Dish:", dish);

        // Check if the dish already exists in the cart
        const existingItemIndex = cartItems.findIndex(
            (item) => item._id === dish._id
        );

        if (existingItemIndex !== -1) {
            // If the dish already exists, update 
            // the quantity or any other logic
            console.log(
                "Dish already exists in the cart. 
                You may want to update the quantity."
            );
            // Example: Increment the quantity
            const updatedCartItems = [...cartItems];
            updatedCartItems[existingItemIndex] = {
                ...updatedCartItems[existingItemIndex],
                quantity: updatedCartItems[existingItemIndex].quantity + 1,
            };
            // console.log('cart',cartItems.length);
            // setTotalPrice(prev=>prev-dish.price)

            setCartItems(updatedCartItems);
        } else {
            // If the dish is not in the cart, add it
            console.log("Dish does not exist in the cart. Adding to the cart.");
            console.log("cart", cartItems.length);
            // setTotalPrice(prev=>prev-dish.price)

            setCartItems([...cartItems, { ...dish, quantity: 1 }]);
        }
        setTotalPrice((prev) => prev + dish.price);
    };

    const handleRemoveItems = (dish) => {
        console.log("Dish ID to remove:", dish);

        // Check if the dish exists in the cart
        const existingItemIndex = cartItems.findIndex(
            (item) => item._id === dish._id
        );

        if (existingItemIndex !== -1) {
            // If the dish exists, decrement the 
            // quantity or remove it from the cart
            console.log(
                "Dish exists in the cart. You may 
                want to decrease the quantity or remove it."
            );

            const updatedCartItems = [...cartItems];

            if (updatedCartItems[existingItemIndex].quantity > 1) {
                // If the quantity is greater than 1, decrement the quantity
                updatedCartItems[existingItemIndex] = {
                    ...updatedCartItems[existingItemIndex],
                    quantity: updatedCartItems[existingItemIndex].quantity - 1,
                };
                setTotalPrice(totalPrice - cartItems[existingItemIndex].price);
            } else {
                // If the quantity is 1, remove the dish from the cart
                updatedCartItems.splice(existingItemIndex, 1);
                setTotalPrice(totalPrice - cartItems[existingItemIndex].price);
            }

            setCartItems(updatedCartItems);
        } else {
            // If the dish is not in the cart, 
            // log a message or handle accordingly
            console.log("Dish does not exist in the cart.");
        }
    };

    const emptyCart = () => {
        setCartItems([]);
        setTotalPrice(0);
    };
    const value = {
        restaurants,
        selectedRestaurant,
        setSelectedRestaurant,
        handleAddItems,
        handleRemoveItems,
        totalPrice,
        emptyCart,
    };

    return (
        <RestaurantContext.Provider value={value}>
            {children}
        </RestaurantContext.Provider>
    );
};

export { RestaurantContext, RestaurantProvider };
cart.js
//Cart.js

import React, { useContext, useState } from "react";
import axios from "axios";
import { RestaurantContext } from "../contexts/RestaurantContext";

const Cart = () => {
    const { totalPrice, emptyCart } = useContext(RestaurantContext);
    const [isCheckingOut, setIsCheckingOut] = useState(false);

    const generateOrderId = () => {
        // Generate a unique order ID 
        // (you can use a library like uuid for a more robust solution)
        return `${Math.floor(Math.random() * 1000)}`;
    };

    const handleCheckout = async () => {
        try {
            setIsCheckingOut(true);

            const orderId = generateOrderId();

            // Assuming you have a backend endpoint to handle the checkout
            const response = await axios.post(
                "http://localhost:5000/previousOrders",
                {
                    orderId,
                    dateOfOrder: new Date(),
                    amount: totalPrice,
                }
            );

            console.log(response.data);
            emptyCart();
        } catch (error) {
            console.error("Error during checkout:", error.message);
        } finally {
            setIsCheckingOut(false);
        }
    };

    return (
        <div className="cart-container">
            <h2>Cart</h2>
            <div className="cart-content">
                <span style={{ color: "brown" }}>Total Price: </span> $
                {totalPrice}
                <button onClick={handleCheckout} disabled={isCheckingOut}>
                    {isCheckingOut ? "Checking out..." : "Checkout"}
                </button>
            </div>
        </div>
    );
};

export default Cart;
DishCard.js
//DishCard.js

import React, { useContext } from "react";
import { RestaurantContext } from "../contexts/RestaurantContext";

const DishCard = ({ dish }) => {
    const { handleAddItems, handleRemoveItems } = useContext(RestaurantContext);

    const handleAdd = () => {
        handleAddItems(dish);
    };

    const handleRemove = () => {
        handleRemoveItems(dish);
    };

    return (
        <div className="dish-card">
            <h3>{dish.name}</h3>
            <img src={dish.image} alt="" />
            <p>Price: ${dish.price}</p>

            <div
                style={{
                    width: "40%",
                    display: "flex",
                    justifyContent: "space-between",
                    alignItems: "center",
                }}
            >
                <button onClick={handleAdd}>+</button>
                <button onClick={handleRemove}>-</button>
            </div>
        </div>
    );
};

export default DishCard;
DishesMenu.js
//DishesMenu.js

import React, { useContext } from 'react';
import DishCard from './DishCard';
import { RestaurantContext } from '../contexts/RestaurantContext';

const DishesMenu = () => {
    const { selectedRestaurant } = useContext(RestaurantContext);

    return (
        <div>
            <h2>Menu</h2>
            {selectedRestaurant && (
                <div style={{ display: 'flex', flexWrap: 'wrap' }}>
                    {selectedRestaurant.menu.map((dish) => (
                        <DishCard key={dish.name} dish={dish} />
                    ))}
                </div>
            )}
        </div>
    );
};

export default DishesMenu;
PreviousOrders.js
//PreviousOrders.js

import React, { useState, useEffect } from 'react';
import axios from 'axios';

const PreviousOrders = ({ handleShow }) => {
    const [orders, setOrders] = useState([]);

    useEffect(() => {
        const fetchOrders = async () => {
            try {
                const response = await axios.get('http://localhost:5000/previousOrders');
                setOrders(response.data);
            } catch (error) {
                console.error('Error fetching orders:', error.message);
            }
        };

        fetchOrders();
    }, []);

    return (
        <div className="previous-orders-container">
            <h2>Your Previous Orders</h2>
            <button style={{ backgroundColor: "white", color: "red" }} onClick={handleShow}>Close</button>
            <ul className="orders-list">
                {orders.map(order => (
                    <li key={order.orderId} className="order-card">
                        <h3>Order #{order.orderId}</h3>
                        <div className="order-details">
                            <div>Items: 1</div>
                            <div>Total Amount: ${order.amount.toFixed(2)}</div>
                        </div>
                        <div>Ordered on: {new Date(order.dateOfOrder).toLocaleDateString()}</div>
                    </li>
                ))}
            </ul>
        </div>
    );
};

export default PreviousOrders;
RestaurantCard.js
//RestaurantCard.js

import React from 'react';


const RestaurantCard = ({ restaurant, onClick }) => {
    return (
        <div className="card" onClick={onClick}>
            <h3>{restaurant.name}</h3>
            <div className="image-container">
                <img className="restaurant-image" src={restaurant.image} alt={restaurant.name} />
            </div>
            <p>Rating: {restaurant.rating}</p>
        </div>
    );
};

export default RestaurantCard;
RestaurantList.js
//RestaurantList.js

import React, { useContext, useState, useEffect } from 'react';
import RestaurantCard from './RestaurantCard';
import { RestaurantContext } from '../contexts/RestaurantContext';
import PreviousOrders from './PreviousOders';


const RestaurantList = () => {
    const { restaurants, setSelectedRestaurant } = useContext(RestaurantContext);
    const [filteredRestaurants, setFilteredRestaurants] = useState([...restaurants]);
    const [ratingFilter, setRatingFilter] = useState('');
    const [searchTerm, setSearchTerm] = useState('');
    const [showOrder, setShowOrder] = useState(false)

    useEffect(() => {
        filterRestaurants();
    }, [ratingFilter, searchTerm, restaurants]);

    const handleRestaurantClick = (restaurantId) => {
        setSelectedRestaurant(restaurants.find((restaurant) => restaurant._id === restaurantId));
    };

    const handleRatingChange = (e) => {
        setRatingFilter(e.target.value);
    };

    const handleSearchChange = (e) => {
        setSearchTerm(e.target.value);
    };

    const filterRestaurants = () => {
        let filtered = restaurants;

        if (ratingFilter) {
            filtered = filtered.filter((restaurant) => restaurant.rating >= parseFloat(ratingFilter));
        }

        if (searchTerm) {
            const searchLower = searchTerm.toLowerCase();
            filtered = filtered.filter((restaurant) =>
                restaurant.name.toLowerCase().includes(searchLower)
            );
        }

        setFilteredRestaurants(filtered);
    };
    const handleShow = () => {
        setShowOrder(!showOrder)
    }
    return (
        <div className="container">
            <h2 className="header">Restaurant List</h2>
            <div className="filter-container">
                <label htmlFor="rating" className="filter-label">
                    Filter by Rating:
                </label>
                <input
                    type="number"
                    id="rating"
                    value={ratingFilter}
                    onChange={handleRatingChange}
                    className="filter-input"
                />
                <label htmlFor="search" className="filter-label">
                    Search by Name:
                </label>
                <input
                    type="text"
                    id="search"
                    value={searchTerm}
                    onChange={handleSearchChange}
                    className="filter-input"
                />
                <p id='pre-orders' onClick={handleShow}>
                    Previous Orders
                </p>
            </div>
            <div className="restaurant-card-container">
                {filteredRestaurants.map((restaurant) => (
                    <RestaurantCard
                        key={restaurant._id}
                        restaurant={restaurant}
                        onClick={() => handleRestaurantClick(restaurant._id)}
                    />
                ))}
            </div>
            {showOrder && <PreviousOrders handleShow={handleShow} />}

        </div>
    );
};

export default RestaurantList;

Step 7: To start the frontend run the following command.

npm start

Output:

Untitled-design-(31)

Final Output

Step 6- Testing Food Delivery Application

Testing is a crucial phase in the development of a Food Delivery Application to ensure that it meets its intended requirements, functions correctly, and is free of bugs. Below are some key steps and considerations for the testing phase of a Food Delivery Application:

  1. Unit Testing:
    • Test individual modules or components of the system in isolation to ensure they function as intended.
    • Identify and fix any bugs or issues found at the module level.
  2. Integration Testing:
    • Verify that different modules and components of the project work together seamlessly.
    • Test data flow and interactions between various parts of the system.
  3. User Interface (UI) Testing:
    • Ensure that the user interface is user-friendly, intuitive, and visually appealing.
    • Check for consistency in design elements and responsiveness across different devices.
  4. Performance Testing:
    • Assess the system’s performance under normal and peak load conditions.
    • Check response times, scalability, and overall system stability.
  5. Security Testing:
    • Identify and rectify any security vulnerabilities in the system.
    • Ensure that user data is handled securely, and unauthorized access is prevented.
  6. Usability Testing:
    • Evaluate the project from an end-user perspective to ensure ease of use.
    • Gather feedback on user interfaces, navigation, and overall user experience.
  7. Compatibility Testing:
    • Test the project on various browsers, operating systems, and devices to ensure cross-platform compatibility.
  8. Regression Testing:
    • Conduct tests to ensure that new changes or fixes do not negatively impact existing functionalities.
    • Re-run previously executed test cases to verify the overall system stability.
  9. Deployment Testing:
    • Conduct tests in the production environment to ensure a smooth transition from the testing phase to live operation.

Step 7- Creating Project Presentation on Food Delivery Application:

In this phase of software development, Team will have to present their work in front of authorities and they will judge your work and give suggestions on the improvement areas.

The ideal length of the ppt should be min 10 slides and maximum 15 slides , you will not have too much time to explain your project so prepare your presentation carefully using important key points.

stage-7-copy

Some of the key points (slides) which your presentation should have are given below:

  1. Project Name and Team Details
  2. Introduction
  3. Purpose
  4. Project Scope
  5. Problem Statement
  6. Proposed Solution
  7. Product Functionalities
  8. Flow chart of the project
  9. Analysis of model
  10. Summary

Step 8- Writing a Research Paper on Food Delivery Application:

You can also write a research paper on the basis of your work . The Research paper will explore the significance of implementing an Integrated Food Delivery Application to enhance the efficiency, accessibility, and overall functionality of food delivery.

stage-8-copy

Key points for this paper includes:

  • Abstract
  • Introduction
  • Related Work
  • Methodologies Used
  • Features
  • Result and Discussion
  • Acknowledgement

Related Projects:




Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads