The target of this project is to develop a simple Shopping Cart with the followin features:
- Browse products in a list.
- Add and remove a product to their shopping cart, as long as it is available. 3. Go back to the products list view and keep browsing.
- Add another product to their cart.
- Go to the checkout and view their cart.
- Modify quantity and remove the product on the checkout page.
The status of the Cart is stored in the localStorage.
All products are stored in a static file in the path api/_db.json
The project contains unit tests with Jest and Enzime. The coverage is present in the most critical areas in the project.
I used NextJs to take advantage of the SSR to have a good SEO during the web indexation. The first page of each search is generated with a Server-Side Rendering. The detail page of the products are created with the Static Generation during the building step.
Start the project for development
yarn dev
Create the static html files
yarn build
Start nextJS server for production (this has to be executed after the yarn build
)
yarn start
Run tests
yarn test
Run tests with coverage report
yarn test --coverage