8000 GitHub - chapaedb/chefDomain
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

chapaedb/chefDomain

Repository files navigation

Chef Domain an E-Commerce Food Delivery Platform

Table of Contents

Introduction

This project is an E-Commerce Food Delivery Platform built using the MERN stack (MongoDB, Express, React, Node.js) (well for now we opted to use EJS in place of REACT to meet our deadline!). The platform allows users to browse, select, and order various food items. It includes features like user authentication, product management, order placement, and an admin dashboard for managing products.

Features

  • User Authentication: Secure sign-up, sign-in, and role-based access control.
  • Product Management: Add, update, delete, and view products with image upload functionality.
  • Cart and Checkout: Users can add items to their cart and proceed to checkout.
  • Order Management: Users can place orders, and admin users can manage these orders.
  • Admin Dashboard: A visually appealing and functional dashboard for admins to manage the platform.

Technologies Used

  • Backend: Node.js, Express.js, MongoDB, Mongoose
  • Frontend: EJS (Embedded JavaScript), Css for styling
  • Authentication: JWT (JSON Web Token)
  • File Upload: Multer
  • Database: MongoDB
  • Other: REST API, Postman for API testing

Project Structure

.
├── controllers
│   ├── authController.js
│   ├── cartController.js
│   ├── productController.js
│   ├── orderController.js
├── models
│   ├── user.js
│   ├── product.js
│   ├── order.js
│   ├── cart.js
├── routes
│   ├── authRoutes.js
│   ├── productRoutes.js
│   ├── cartRoutes.js
│   ├── orderRoutes.js
├── views
│   ├── admin
│   │   ├── dashboard.ejs
│   │   ├── products.ejs
│   │   ├── orders.ejs
│   ├── auth
│   │   ├── signin.ejs
│   │   ├── signup.ejs
│   ├── cart.ejs
│   ├── checkout.ejs
├── public
│   ├── css
│   ├── js
│   ├── images
├── server.js
├── README.md
└── .env

Setup and Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/chefDomain.git
    cd chefDomain
  2. Install dependencies:

    npm install
  3. Set up environment variables: Create a .env file in the root directory and add your environment variables:

    PORT=5000
    MONGO_URI=your_mongo_db_connection_string
    JWT_SECRET=your_jwt_secret
    
  4. Run the server:

    npm start
  5. Access the application: Open your browser and go to http://localhost:5000.

Endpoints

Authentication

  • POST /auth/signup - Register a new user
  • POST /auth/signin - Sign in a user

Products

  • POST /api/products - Create a new product (Admin only)
  • GET /api/products - Get all products
  • GET /api/products/:id - Get product by ID
  • PUT /api/products/:id - Update a product by ID (Admin only)
  • DELETE /api/products/:id - Delete a product by ID (Admin only)
  • POST /api/products/:id/upload - Upload product images (Admin only)

Orders

  • POST /api/orders - Place a new order (User)
  • GET /api/orders/:id - Get order by ID (Admin)
  • GET /api/orders - Get all orders (Admin)

Cart

  • GET /cart - View cart items
  • POST /cart - Add item to cart
  • DELETE /cart/:id - Remove item from cart

Checkout

  • GET /checkout - View the checkout page

Admin Dashboard

The admin dashboard provides a clean interface for managing products and orders.

Views:

  • Dashboard: Overview of the platform.
  • Products: List of all products with options to add, edit, or delete.
  • Orders: List of all orders placed by users.

Example EJS Files:

  • dashboard.ejs
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Admin Dashboard</title>
    <link rel="stylesheet" href="/static/css/admin.css">
</head>
<body>
    <div class="dashboard">
        <h1>Welcome, Admin</h1>
        <div class="stats">
            <div>Total Products: <%= totalProducts %></div>
            <div>Total Orders: <%= totalOrders %></div>
        </div>
    </div>
</body>
</html>
  • products.ejs
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Product Management</title>
    <link rel="stylesheet" href="/static/css/admin.css">
</head>
<body>
    <div class="products">
        <h1>Manage Products</h1>
        <a href="/admin/products/new">Add New Product</a>
        <ul>
            <% products.forEach(product => { %>
                <li><%= product.name %> - <%= product.price %></li>
            <% }) %>
        </ul>
    </div>
</body>
</html>

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  
0