Full stack e-commerce website

Create an e-commerce website using react, node, PostgreSQL. The wishlist doesn’t work right now.

Github: - GitHub - ah-naf/Fullstack-ecommerce-website
Live link :- http://ahnaf-ecommerce-website.herokuapp.com/

Any feedback is appreciated. :slight_smile:

1 Like


A few tips and thoughts about your project (mostly about backend):

  1. Allow adding items to the cart without authorization. Users sometimes only want to know the sum of a few items. Require authorization before placing an order.
  2. Extract database queries into a separate module so you can reuse and modify them in one place.
  3. Don’t use remote resources as database default value like avatar VARCHAR DEFAULT' https://cdn.pixabay.com/photo/2015/10/05/22/37/blank-profile-picture-973460_1280.png' . Remote resource can be changed or removed at any time. And the image used is very large for an avatar.
  4. Why do your foreign key fields like orders.user_id, order_details.order_id, etc. have DEFAULT uuid_generate_v4()? They should not. Foreign key fields will have values ​​stored in other tables.
  5. For fields with a limited number of values, such as order_detail.status, I recommend using enums: PostgreSQL: Documentation: 14: 8.7. Enumerated Types This will help avoid errors and typos in the field value .
  6. Instead of passing your middleware to every route in the group, you can use router.use(middleware) to have your middleware called for any request on that router. With this you don’t need to remember to include the middleware for the new route in group.
  7. Don’t write your secrets to stdout or stderr in production! You print to console DATABASE_URL and JWT_SECRET at least in db.js.
  8. Use console.error instead of console.log to log errors. This will output data to stderr, so you can easily separate error output from anything else. See Console | Node.js v17.3.1 Documentation. More about standard streams: Standard streams - Wikipedia

Great job!

1 Like

Thank you for the feedback. Will try to improve the code.