Index: backend/models/categoryModel.js
===================================================================
--- backend/models/categoryModel.js	(revision a2e57352512ead87a9738f42509448ff26fdd514)
+++ backend/models/categoryModel.js	(revision a2e57352512ead87a9738f42509448ff26fdd514)
@@ -0,0 +1,19 @@
+import mongoose from "mongoose";
+
+const categorySchema = new mongoose.Schema(
+  {
+    categoryName: { type: String, required: true, unique: true },
+    categorySlug: { type: String, required: true, unique: true },
+    subCategories: [
+      {
+        type: String,
+      },
+    ],
+  },
+  {
+    timestamps: true,
+  }
+);
+
+const Category = mongoose.model("Category", categorySchema);
+export default Category;
Index: backend/models/productModel.js
===================================================================
--- backend/models/productModel.js	(revision 113029bbf1a9831d3ae8fae3e6e1d250ae725493)
+++ backend/models/productModel.js	(revision a2e57352512ead87a9738f42509448ff26fdd514)
@@ -5,4 +5,7 @@
     name: { type: String, required: true, unique: true },
     slug: { type: String, required: true, unique: true },
+    height: { type: Number, required: true },
+    width: { type: Number, required: true },
+    length: { type: Number, required: true },
     image: { type: String, required: true },
     sideImage: { type: String, required: true },
Index: backend/models/subCategoryModel.js
===================================================================
--- backend/models/subCategoryModel.js	(revision a2e57352512ead87a9738f42509448ff26fdd514)
+++ backend/models/subCategoryModel.js	(revision a2e57352512ead87a9738f42509448ff26fdd514)
@@ -0,0 +1,14 @@
+import mongoose from "mongoose";
+
+const subCategorySchema = new mongoose.Schema(
+  {
+    subCategoryName: { type: String, required: true, unique: true },
+    subCategorySlug: { type: String, required: true, unique: true },
+  },
+  {
+    timestamps: true,
+  }
+);
+
+const SubCategory = mongoose.model("SubCategory", subCategorySchema);
+export default SubCategory;
Index: backend/routes/categoryRoutes.js
===================================================================
--- backend/routes/categoryRoutes.js	(revision a2e57352512ead87a9738f42509448ff26fdd514)
+++ backend/routes/categoryRoutes.js	(revision a2e57352512ead87a9738f42509448ff26fdd514)
@@ -0,0 +1,83 @@
+import express from "express";
+import expressAsyncHandler from "express-async-handler";
+import Category from "../models/categoryModel.js";
+import SubCategory from "../models/subCategoryModel.js";
+
+const categoryRouter = express.Router();
+
+categoryRouter.post(
+  "/addCategory",
+  expressAsyncHandler(async (req, res) => {
+    const newCategory = new Category({
+      categoryName: req.body.category,
+      categorySlug: req.body.categorySlug,
+      subCategories: req.body.categories,
+    });
+    const category = await newCategory.save();
+    if (category)
+      res.status(201).send({ message: "New Category Created", category });
+    else res.status(404).send({ message: "Error creating category" });
+  })
+);
+
+categoryRouter.put(
+  "/updateCategory",
+  expressAsyncHandler(async (req, res) => {
+    const category = await Category.findOne({
+      categorySlug: req.body.category,
+    });
+
+    if (category) {
+      category.categoryName = category.categoryName;
+      category.categorySlug = category.categorySlug;
+      category.subCategories = req.body.categories;
+
+      const updatedCategory = await category.save();
+      res.send(updatedCategory);
+    } else {
+      res.status(404).send({ message: "Category Not Found" });
+    }
+  })
+);
+
+categoryRouter.get(
+  "/getCategories",
+  expressAsyncHandler(async (req, res) => {
+    const categories = await Category.find();
+    res.send(categories);
+  })
+);
+
+categoryRouter.get(
+  "/getCategory",
+  expressAsyncHandler(async (req, res) => {
+    const category = await Category.find({ categorySlug: req.query.category });
+    res.send(category);
+  })
+);
+
+categoryRouter.post(
+  "/addSubCategory",
+  expressAsyncHandler(async (req, res) => {
+    const newSubCategory = new SubCategory({
+      subCategoryName: req.body.subCategory,
+      subCategorySlug: req.body.subCategorySlug,
+    });
+    const subCategory = await newSubCategory.save();
+    if (subCategory)
+      res.status(201).send({ message: "New Category Created", subCategory });
+    else res.status(404).send({ message: "Error creating category" });
+  })
+);
+
+categoryRouter.get(
+  "/getSubCategory",
+  expressAsyncHandler(async (req, res) => {
+    const subCategory = await SubCategory.find({
+      subCategorySlug: req.query.subCategory,
+    });
+    res.send(subCategory);
+  })
+);
+
+export default categoryRouter;
Index: backend/routes/productRoutes.js
===================================================================
--- backend/routes/productRoutes.js	(revision 113029bbf1a9831d3ae8fae3e6e1d250ae725493)
+++ backend/routes/productRoutes.js	(revision a2e57352512ead87a9738f42509448ff26fdd514)
@@ -42,4 +42,7 @@
       priceMontaza: req.body.priceMontaza,
       countInStock: req.body.countInStock,
+      height: req.body.H,
+      width: req.body.W,
+      length: req.body.L,
     });
 
@@ -52,4 +55,50 @@
 
 const PAGE_SIZE = 7;
+
+productRouter.get(
+  "/search",
+  expressAsyncHandler(async (req, res) => {
+    const { query } = req;
+    const pageSize = query.pageSize || PAGE_SIZE;
+    const page = query.page || 1;
+    const searchQuery = query.text;
+    console.log("HEEEY: " + searchQuery);
+    const queryFilter =
+      searchQuery && searchQuery !== "all"
+        ? { name: { $regex: searchQuery, $options: "i" } }
+        : {};
+    const descriptionFilter =
+      searchQuery && searchQuery !== "all"
+        ? { description: { $regex: searchQuery, $options: "i" } }
+        : {};
+    const slug =
+      searchQuery && searchQuery !== "all"
+        ? { slug: { $regex: searchQuery, $options: "i" } }
+        : {};
+    const products = await Product.find({
+      $or: [
+        { name: { $regex: searchQuery, $options: "i" } },
+        { slug: { $regex: searchQuery, $options: "i" } },
+        { description: { $regex: searchQuery, $options: "i" } },
+      ],
+    })
+      .skip(pageSize * (page - 1))
+      .limit(pageSize);
+    const countProducts = await Product.countDocuments({
+      $or: [
+        { name: { $regex: searchQuery, $options: "i" } },
+        { slug: { $regex: searchQuery, $options: "i" } },
+        { description: { $regex: searchQuery, $options: "i" } },
+      ],
+    });
+    res.send({
+      products,
+      countProducts,
+      page,
+      pages: Math.ceil(countProducts / pageSize),
+    });
+  })
+);
+
 productRouter.get(
   "/",
@@ -62,4 +111,10 @@
     const order = query.order || "";
     const searchQuery = query.query || "";
+    const HF = query.HF || 0;
+    const HT = query.HT || 1000;
+    const WF = query.WF || 0;
+    const WT = query.WT || 1000;
+    const LF = query.LF || 0;
+    const LT = query.LT || 1000;
 
     const queryFilter =
@@ -80,4 +135,12 @@
       ...categoryFilter,
       ...subCategoryFilter,
+      $and: [
+        { height: { $gte: HF } },
+        { height: { $lte: HT } },
+        { width: { $gte: WF } },
+        { width: { $lte: WT } },
+        { length: { $gte: LF } },
+        { length: { $lte: LT } },
+      ],
     })
       .sort(sortOrder)
Index: backend/server.js
===================================================================
--- backend/server.js	(revision 113029bbf1a9831d3ae8fae3e6e1d250ae725493)
+++ backend/server.js	(revision a2e57352512ead87a9738f42509448ff26fdd514)
@@ -7,4 +7,5 @@
 import userRouter from "./routes/userRoutes.js";
 import orderRouter from "./routes/orderRoutes.js";
+import categoryRouter from "./routes/categoryRoutes.js";
 
 dotenv.config();
@@ -28,4 +29,5 @@
 app.use("/api/users", userRouter);
 app.use("/api/orders", orderRouter);
+app.use("/api/category", categoryRouter);
 
 app.use((err, req, res, next) => {
