A modern shopping cart demo built with React 19, Vite, and Tailwind CSS. This application showcases a responsive e-commerce UI with add-to-cart functionality, persistent cart state using localStorage, and a sidebar cart summary.
This relies on the fact that all products that can be added to the cart are present in a single array in the data/index.js file. We don't add or remove products from cart, just update properties of each product like inCart and quantity.
- Browse a catalog of products (hoodies, jackets, shoes)
- Add/remove items to/from the cart
- Adjust item quantities in the cart
- Cart state persists across page reloads (localStorage)
- Responsive design using Tailwind CSS
- Modern UI icons via lucide-react
- React 19
- Vite
- Tailwind CSS
- lucide-react
- Node.js (v22 or newer recommended)
- npm
-
Clone the repository:
git clone https://github.com/your-username/shopping-cart-demo.git cd shopping-cart-demo
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open http://localhost:5173 in your browser.
npm run build
npm run preview
src/
- Source codecomponents/
- UI componentscontext/
- React context for cart statehooks/
- Custom hooksutils/
- Utility functionsassets/data/
- Product data
public/images/
- Product images
MIT