Project Overview
AllMart is a full-stack application developed to simulate a grocery store API. It combines a Node.js backend with a responsive frontend to provide features like product search, category filtering, and voice search for accessibility.
Goal
While exploring grocery store websites, I noticed a lack of voice search functionality, which could improve accessibility for users. The goal was to create a user-friendly API and frontend that not only supports traditional search and filtering but also integrates voice search using the browser built-in Web Speech API.
Process
AllMart comprises of:
I developed the backend from scratch using Node.js and Express to create different endpoints for the API to serve product data to the frontend. The front-end includes features like dynamic product search, voice search, and wishlist management using local storage.
Throughout the development process, I encountered a few challenges:
-
Challenge: Handling errors during API calls and ensuring the application remains responsive.
Solution: I implemented atry...catchblock in the fetch logic to handle network issues and display user-friendly error messages. -
Challenge: Filtering products dynamically based on user input.
Solution: I used JavaScript array methods likefilter()to efficiently process and display the data based on user input. -
Challenge: Integrating voice search functionality.
Solution: I utilized the Web Speech API to capture and process voice input, ensuring compatibility across browsers. If the browser does not support the Web Speech API, a message is displayed to inform the user. A key feature that aids in accessibility. -
Challenge: Setting the backend server and building the API endpoints for product filtering.
Solution: I built a REST API using Node.js and Express. I implemented dynamic endpoints like/api/products?category=fruitusing query parameters{category, name, id}to filter data. For example, I usedfilter()method to return only products that match the user’s request. This allows the client to request exactly what it needs without overfetching data.
I hosted the API using Render to make it publicly accessible and used cors middleware to handle cross-origin requests from the front-end.
Tech Stack
Node.js
HTML5
TailwindCSS
JavaScript
GitHub
Key Features
- Search products by name, category, or ID
- Voice search using the Web Speech API
- Dynamic product rendering with error handling
- Wishlist functionality with local storage
What I Learned
This project taught me:
- How to build a REST API using Node.js and Express
- Build and connect a frontend with a backend
- How to manage real world API issues like errors and async logic
- Testing and debugging APIs effectively using Postman and Axios
- How to implement voice search for improved accessibility
- How to deploy a backend server using Render
- How to use CORS middleware for handling cross-origin requests