Code Monkey home page Code Monkey logo

cafe-coffee-webiste's Introduction

Coffe Shop

This project aims to implement a Coffee Shop E-commerce portal. A user can buy a particular coffee product and can place an order. The coffee includes the espresso, mocha, Americano, Caffe Latte, etc. The data is taken online from websites about coffee and may or may not be true.

Project Video Link

Coffee Shop

Languages used for implementation:

  • Frontend: React, Redux
  • Backend: Node, Express
  • Database: MongoDB Atlas Cluster

For Authorization, JWT tokens were used.

By default all users are Non-admin. Admin user can be set in database.

Test Admin user:

Email : [email protected]
Password : Admin@123

Test Normal users:

Email : [email protected] 
Password : Password@123

Email : [email protected] 
Password : Password@123

Some Screenshots:

  1. Add new Item to MongoDB collection Add new Item

  2. Admin user features - Add / Delete / Update Admin user features

  3. Login Dropdown Login Dropdown

  4. Register Dropdown Register Dropdown

  5. Search within category and name (interleaved and seperate) Search within category and name

  6. Shopping Cart - Add / Subtract the items Shopping Cart

  7. Update item with soft delete Update Item with soft delete

  • Soft delete here means not showing the product in the listing
  • Hard delete here means deleting the product from the database

Database Design: I have used 3 collections in MongoDB. The database is hosted on MongoDB cluster so that it can be accessed anywhere.

  1. Items: This collection has all the items listed on the coffee shop. It has the following document structure:

Item Collection

Schema key Schema description
id ID of the item auto created by MongoDB
name Name of the item
description Description of the item
category Category of the item
price Price of the item in integers
units Units of the item in integers
softDelete If this is true, then the product is not shown to the non-admin user
img This property takes in the URL of the product
date This property store the time when the product was added in the document
  1. Users: This collection stores all the user who are registered and who can place a order.

Users Collection

Schema key Schema description
id ID of the user auto generated by User
name Name of the user
isAdmin If this property is true, the user can access other features of the shop like, Add / Delete / Update Product
email This stores the email used for signing in.
password Password is stored in the encrypted format.
register_date This date is the date when the user was created.
  1. Orders : This collection stores the order information of the user

Orders Collection

Schema key Schema description
id ID generated by MongoDB
order This is an array of objects which have the items and their quantities and the prices
user This is a object which stores the userId, email and isAdmin details.

Project Structure:

  • frontend/ - React/Redux code
  • server.js - NodeJS, Express

Project Setup

React : Port 3000

Express : Port 5000

Run npm install in main directory and frontend/ directory.

Run project by (Concurrent Execution of React and Node) : npm run dev

See the project at http://localhost:3000

React Commands:

    npm install -g create-react-app
    npx crete-react-app frontend
    npm install axios --save

Add "proxy": "http://localhost:5000", to package.json of frontend/

    npm install redux
    npm install react-redux
    npm install react-router-dom

Express Commands:

    npm install -g express-generator
    express coffee-shop
    npm install -D nodemon
    npm install mongoose --save
    npm install bcryptjs --save
    npm install jsonwebtoken --save
    npm install config --save
    npm install -D concurrently    
    nodemon server.js
* If cors Error  `npm install --save cors`

MongoDB commands:

md \data\db
cd “C:\Program Files\MongoDB\Server\3.0\bin” (or wherever you installed MongoDB)
mongod

Error resolve:

  • nodemon : File C:\Users<Username>\AppData\Roaming\npm\nodemon.ps1 cannot be loaded because running scripts is disabled on this system.

For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.

In this case for Windows, Run as Administrator and type:

Set-ExecutionPolicy -ExecutionPolicy Unrestricted and then select Y After that nodemon can run on the machine

cafe-coffee-webiste's People

Contributors

bhaveshgarg2000 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.