/E-commerce_app

E-commerce app following Ryan D

Primary LanguageJavaScriptMIT LicenseMIT

E-commerce_app

GitHub top language GitHub repo size

GitHub issues

This Readme is for the backend of the project.

Following are main dependencies:

Express is used as the server; it is the main part of the app.

Mongoose is used to communicate with the database.


MongoDB is a NoSql Database. Most preferred Db.


Always check for spelling errors, it may be a pain in the ass that because of some silly mistakes, one whole function or middleware might not work!

Always run the front-end, React app with the following command, after entering into the client directory.

npm start

Always run the server with the follwoing command, after entering into the server directory:

npm start


Database

Along with the server, mongoDB connection also needs to be made and started, with the following command:

mongod --config /usr/local/etc/mongod.conf

To view the database, run the following command in another terminal

mongo

The database for this project is called ecommerce. on initialising the database, use the following command,

use ecommerce

ecommerce database has the following collections;

  1. users
  2. category
  3. products

APP

The app consists of the main app.js file, it also includes other files,

  1. controller file

    • auth.js
    • category.js
    • product.js
    • user.js
  2. models

    • category.js
    • product.js
    • user.js
  3. routes

    • auth.js
    • category.js
    • product.js
    • user.js

app.js is like the main face of the entire app; that takes care of all the routing in the website.

models is a file that is used for creating different models for category, product, user, to be put into the database [mongodb].

controller is a file that takes care of creating all the middlewares for the app. Consists of middlewares for auth, category, product and user.

  • the middlewares created in the controller file needs to be exported first, inorder to use it in another file. In the following way:
exports.(middleware_name)=(req,res)=>{
    //body of code.(middleware)
}

router is a file that consists of the routing to be done in the app. Consists of routes for auth, category, product, user.

  • the middlewares from the controller files need to imported first, inorder to place the middleware in the routes. In the following way:
import {middleware_name} = require("name_of_file_to_import_from")
  • after creating a router app, the router object needs to be exported. in the following way:
module.exports = router;

Few notes

  • For admin and auth routing, correct id and token is required to be filled in postman.

  • [signout] may/may not be working rn along with [requireSignin] function, because admin and auth priviledges can still be attained, after signing out user.

  • And [requireSignin] function doesn't seem to be working, because it directly prints {"hello"} message even after signing out user. in short, [signout] may not be working, or some complex confusion exists.


E-commerce app following Ryan D

ROAD MAP

[✅] 1] API (Building the API with Node.JS)

[✅] 2] Project setup (Setting up the project)

[✅] 3] Database Setup (Connecting with the database[MongoDB])

[✅] 4] User Signup

[✅] 5] Validation

[✅] 6] User signin using JWT (Signing in user after validation is completed; based on [JSON_Web_Token])

[✅] 7] Auth/Admin middleware (Creating middleware, to check whether the user is authenticated or whether the user is an Admin)

[✅] 8] Categories - create (creating a category for the products)

[✅] 9] products - CRUD

[✅] 10] Products - by arrival, sold, search (All these types will be coming from front end client as a [route_parameter])


REACT CLIENT

[✅] 1] setup

[✅] 2] Routing/ menu

[❌] 3] signin/signup

[ ] 4] admin route/ private route (two separate routes-> [admin]and [private])

[ ] 5] user / admin dashboard (two separate dashboards, [user] and [admin])

[ ] 6] create category

[ ] 7] create product

[ ] 8] products by sell

[ ] 9] products by arrivals

[ ] 10] shop page with filter products by [categories/price]

[ ] 11] filter products based on categories using checkbox

[ ] 11] filter products based on price using radio buttons

[ ] 12] search products with option of category

[ ] 13] single product view (single product to be shown)

[ ] 14] single product view with related products sidebar (single product view, with related products on the side bar like [Amazon])

[ ] 15] cart page

[ ] 16] add product to cart

[ ] 17] product increment and decrement (to increase or decrease the number of products in the cart)

[ ] 18] remove product from cart

[ ] 19] show total

[ ] 20] payment integration using brintree (brintree is a PayPal company, which makes it easy to integrate payment method)

[ ] 21] checkout (checkout after successful completion of payment)


Backend/ Frontend

alternating between backend and frontend

[ ] 1] API - processing payment

[ ] 2] REACT - processing payment with brintree dropin UI

[ ] 3] delivery address

[ ] 4] finalise payment

[ ] 5] send order details to backend

[ ] 6] saving orders

[ ] 7] sold products count/ update after selling

[ ] 8] view all orders

[ ] 9] order status update (status update such as processing/delivered)

[ ] 10] profile update

[ ] 11] product update (any updates to be done by admin)

[ ] 12] deployment

DONE []