Congratulations on reaching the technical challenge stage of the interview process at Qogita.
We are excited to potentially have you join the Engineering team, where you will work alongside brilliant people to build a revolutionary global wholesale B2B platform.
This challenge is built around the front-end stack we use at Qogita – TypeScript, React, Next.js, and Tailwind CSS.
You are expected to use the tools and techniques are you are most comfortable with to produce good quality code that can be understood by engineers of varying experience.
Please address the functional requirements listed in the task below, and any non-functional requirements you see as appropriate.
Your task is to expand this project to display products, and allow customers to add them to a shopping cart. You may use third party libraries to assist you. We expect you to prioritise the usability of your user-interface over how pretty it looks.
This task should take 3-4 hours to complete, and you will be given a week to do this. You should commit your code to a repository of your choice, and then share this with us. Please also document any assumptions you make.
/products
endpoint. See API.The existing code includes a development environment, and an API with product data for you to interact with. The relevant API response types can be found in src/types.ts. Please do not use data/products.json
directly.
cd frontend-challenge
npm install
Start the project in development mode.
npm run dev
Build and start the project in production mode.
npm start
The API can be interacted with via http://localhost:3000/api
and has the following endpoints:
/products
The /products
endpoint accepts GET
requests and will return the first page of 20 products. To retrieve a different page of 20 products, you can pass the page
query parameter (e.g. /products?page=2
).
/products/[gtin]
The /products/[gtin]
endpoint accepts GET
requests and will return a product matching the GTIN (e.g. /products/8005610625720
). If no product is found, the API will respond with a 404
status.
First all, thanks for the opportunity. For doing the challenge I used react-query for the data fetching and zustand for the state management. I also used immer for changing states of objects without mutating.
For the pagination I used react query's infiniteQuery that already has some helpers that make the infinite scroll easier.
The store reducer controls what happens when for given productId, when we increment, decrement. If we decrement when the quantity is 1, I remove the product.
All the content is saved in the sessionStorage.
I implemented some tests you can run using npm run test
or npm e2e
components
reusable or domain specific components
features
hooks, queries and helpers associated to the product.
helpers
General helpers that are not related to any feature in particular. Like money and images.