Project Structure(Backend)

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

Food Delivery Application Project in Software Development

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.

Table of Content

  • Step 1- Team Formation Phase: Creating a Dynamic Team
  • Step 2- Topic Selection
  • Step 3- Project Synopsys for Food Delivery Application
  • Step 4- Requirement Gathering (Creating SRS for Food Delivery Application)
  • Software Requirement Specification (SRS) Document | Food Delivery Application
  • 4.1 SRS (Food Delivery Application) | Introduction:
  • 4.2 SRS (Food Delivery Application) | Overall Description:
  • 4.3 SRS (Food Delivery Application) | Designing Food Delivery Application :
  • Use case Diagram for Food Delivery Application:
  • ER Model of Food Delivery Application:
  • Data Flow Diagram of Food Delivery Application:
  • 4.4 Functional Requirements | SRS (Food Delivery Application)
  • 4.5 Non Functional Requirements | SRS (Food Delivery Application)
  • 4.6 SRS (Food Delivery Application) | Appendices:
  • 5. Coding or Implementation of Food Delivery Application
  • Prerequisites:
  • Approach to create Restaurant App using MERN:
  • Steps to create Application:
  • Project Structure(Backend):
  • Project Structure(Frontend):
  • Step 6- Testing Food Delivery Application
  • Step 7- Creating Project Presentation on Food Delivery Application:
  • Step 8- Writing a Research Paper on Food Delivery Application:

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.

Similar Reads

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....

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....

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....

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....

Software Requirement Specification (SRS) Document | Food Delivery Application

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

4.1 SRS (Food Delivery Application) | Introduction:

4.1.1 Purpose:...

4.2 SRS (Food Delivery Application) | Overall Description:

4.2.1 Product Perspective:...

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

Use case Diagram for Food Delivery Application:...

Use case Diagram for Food Delivery Application:

Creating a Use Case Diagram for a Food Delivery 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....

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:...

4.4 Functional Requirements | SRS (Food Delivery Application)

The project must have the following functional requirements:...

4.5 Non Functional Requirements | SRS (Food Delivery Application)

4.5.1 Usability Requirements:...

4.6 SRS (Food Delivery Application) | Appendices:

Glossary:...

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....

Prerequisites:

ReactJSExpressJS and NodeJsContext API, Prop drilling and Functional componentsJavaScriptMERN Stack...

Approach to create Restaurant App using MERN:

1. Import Statements:...

Steps to create Application:

Step 1: creating the folder for the project...

Project Structure(Backend):

Backend Folder...

Project Structure(Frontend):

Frontend Folder Structure....

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:...

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....

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....

Contact Us