Giter VIP home page Giter VIP logo

hardpost's Introduction

An online marketplace to buy, sell, and trade skateboarding items.

hp-demo.mov

Motivation

The prices of skateboarding hard-goods are at an all time high. Skateboarders typically accumulate lots of gear while many people cannot afford to buy those items brand new. There is no dedicated platform for people to specifically buy or sell skateboarding items from other individuals at a more affordable price. The main option has been to go on generic online marketplaces where the majority of users have no interest in skateboarding products. Hardpost aims to close that gap.

Description

The concept is straightforward. Skateboarders can create an account and make posts of items they have for sale, including an image and price tag. Other users can browse those items, add them to their cart, and then must be logged in with an account to purchase those items.

Technologies used

Typescript JavaScript Vite React React Router React Query NodeJS Express.js MySQL Sequelize Jest Cypress AWS JWT Stripe


badges source

Usage

  • Navigate to the landing page where you can browse items and add them to your cart
  • Because the app is still in test mode sign up with a dummy email address and password to checkout and simulate a purchase of your items in the cart
  • Feel free to post test items along with an image (you can delete them as well)

Testing

  • For unit testing, run 'npm run test' in both client and server folders individually (runs jest tests).
  • For integration testing, run 'npm start' at root of the project to start up the client and server. Then cd into the client and run 'npm run cypress', select chrome as the browser testing environment

Relational Database Design

steps for running locally

  • clone repo
  • 'npm install' all dependencies inside root, client, and server folders
  • in server folder, create .env file with DB_NAME="hardpost_db", and DB_USER and DB_PASSWORD set to your MySQL credentials (default user is 'root')
  • still in server, log into MySQL shell and run 'source db/schema.sql' to create database
  • return to root of project an 'npm run start' to concurrently run node-express server and vite dev mode

hardpost's People

Contributors

nirav-v avatar

Stargazers

Maël Chanon avatar Zyyzuki avatar Mukesh Kumar avatar

Watchers

 avatar

hardpost's Issues

Store item images in AWS S3 bucket

When a user uploads a new item, the image must be stored in an AWS S3 bucket, as the the will not persist in the filesystem in a production environment on heroku https://devcenter.heroku.com/articles/active-storage-on-heroku
Recommended solution is S3 stooage for image files https://devcenter.heroku.com/articles/s

After the user uploads an item and is redirected to the shop page, each item should display the corresponding image that was fetched from the S3 bucket

Style Items on Shop Page

It is done when each item on the shop page id displayed as an individual card component with image title price description using css grid layout

Only allow one of each item in cart

Currently add to cart functionality continues to increment quantity after item has been initially added. Assume that items users are posting are singular and, therefore, should only be able to add to cart once.

After a user adds an item to their cart, the button changes to show the item has been added, and the can no longer add additional quantities of that item

UI of landing page should immediately show items

Current behavior:
Upon visiting the landing page, a first-time user only sees the login form and has to scroll down in order to view items from the shop page. This is unintuitive and now a great user experience as they may only see the login form, not feel like creating an account, and leave

Expected behavior:
Upon visiting the site, user can immediately see browsable items without having to scroll. Two buttons are visible above the items to render and hide the login and signup forms. As opposed to rendering the form immediately over the items.

Bugfix: items from cart context not loading on initial render

when a user first logs into their account, the shop page and cart page do not reflect the current state of their shopping cart on first page visit, but onluy upon refreshing the page or navigating back to it

Users should immediately see the state of their cart when visiting the shop page and cart page

Product filter options

Users should be able to check filters for which products they want to see and then click 'apply filers' to only see matching products

It is done when users can filter products on shop page by category and price

Website Header/Logo

Site should have header DW Rugs with cut out images of popular rugs on either side. Either at the top or incorporated into navbar

Alert user on incorrect login credentials

When a user enters a wrong username or password, a text field appears next to the login form reading an error of incorrect credentials so the user knows why they were not logged in

SingleItem view

Users should be able to click on an item from the shop page and navigate to a page that shows all details for that specific item with a button to add to cart

It is done when clicking on an item from the shop page redirects to the backend route that gets an item by its id.

Implement JWT Authentication

It is done when the app has migrated from using sessions to JWT for authenticating users. This should circumvent the issue of having the client and server deployed separately and not being able to send a cookie and remember the session across requests bc JWT should keep the token in local storage for the user

User can add to cart when not logged in

Users should be able to add item to a cart and see the cart page, only when they click checkout should they be required to make an account.
--> currently users cannot add to cart (see message telling them to log in)
--> this is because the instances of a shopping cart is coupled to a user's account
--> when a user is not logged in a clicks an add to cart button, a local instance of that cart containing the item ids should be saved in local storage

simulate payment processing with Stripe

Users should be able to fill in their shipping and payment info on the checkout page and then have their payment be processed with the recipients being the users whose items they purchased. For now the payment process is simulated for development purposes and no real charge should be made.

Fix LoggedIn when no Cookie Bug

Cookie eventually gets removed from browser but logged in status remains true bc using local storage userId to check if user should be logged in. Currently if no cookie exists, it still looks like user is logged in bc of loggedIn state being true, but no session exists for any of the backend routes to work.

User should have the experience of being completely logged out once the cookie is no longer present

Loading spinner on AddItemForm Submit

After the user submits the form to post their item, it can take some time for that route's middleware to complete and return a success response - insert item into database, image must upload to s3..

During this time the user should see a message and loading spinner notifying them that the item is being uploaded and not to refresh or close page

on checkout: Modal to notify user of redirect to stripe using test mode only

When user clicks the checkout button from cart, they are notified that they are about to be redirected to Stripe and that it is using test mode, therefore no real payment/order will processed and no charge is going to be made. They are provided with a list of test credit card numbers to try instead of their real info

delete from s3

user deleting their item should automatically remove that item's image from s3 bucket

Mark Ordered Items as sold

After user finishes checkout for an item and it has been added to their orders, that item is marked as sold on the shop page with the add to cart option disabled.

Youtube Page

Youtube page should have iframe players for each video provided from channel.

BUG: logout from different path fails to redirect to homepage

Behavior: If user is on cart page or any page with a path parameter and clicks log out button, it reloads at the same path with the user no longer logged in, thus showing a blank page. Logging out should always redirect to the base url '/' so that the user can still see the shop page with all the items.

Admin user permissions

I should have an Admin user I can login as and have the ability to delete items belonging to any users and remove user accounts.

In production this will act as a safe guard against malicious users or inappropriate posts

local cart BUG

items in local storage cart are not removed after they are bought or deleted by another user

search bar feature

users should be able to type in an input and see their search results update in real time - debounce the api call/filtering and make sure it results are synced with the filter checkbox

Checkout page

user should be able to click checkout button on the cart page that navigates them to a checkout page where they can confirm their order details and fill out their shipping and payment information.

It is done when users can navigate from the cart page to the checkout page containing an order summary, form for address info, and form for payment info

Image uploads

Users should be able to upload an image of their choice when posting a new item and that image should then be displayed on the shop page with the rest of the items info

It is done when an image can be submitted through the add product form, be uploaded into the file system, and then have its path saved in the mysql database under the imagePath field for that product. The image should then be rendered back to the user on the front end when a request for that product's data is made with imagePath being the src attribute for the item's image

First time user's see welcome message and signup form

when a user first visits the page, set a key in local storage to keep track of this. When the localStorage value isn't there (first time user), render a message explaining what the app is, and that it is strictly in dev mode, therefore all purchases and sales are simulated and no real money is being exchanged.

Users visiting page for first time should see a message telling them about the app and development mode, and also see the signup form instead of login

Steps to implement:

add an Auth util function that returns a boolean for wether we have a returning user.
If not, we want to render an alert/modal with a message for first time users on page load

Server Side Auth error handling

Implement server side logic to handle when user a request for adding cart item is made without valid auth headers provided. Only being handled on client side currently.

If user is logged out and tries to add an item to cart, server should return appropriate status code and error message rather than crashing when it cannot find the logged in user from database

database item seeds

Have a seed npm script that can be run to bulk delete all items, and create a new list of items using the aws image urls.

Modals for when logged out user attempts to add to cart

Add to cart button is intentionally displayed when user is logged out to incentivize them to create an account to actually purchase an item.

Logged out users should see a modal message telling them to log in when they attempt to add an item

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.