A lightweight, fully functional ecommerce website built with vanilla JavaScript, HTML5, and CSS3. Features real-time product search, shopping cart management with localStorage persistence, and dynamic product display from a REST API.
Deployed using GitHub Pages - try it out now!
- Product Catalog: Display 100+ products fetched from DummyJSON API
- Shopping Cart: Full CRUD operations (Create, Read, Update, Delete)
- LocalStorage Persistence: Cart data persists across browser sessions
- Real-time Search: Filter products by title or description as you type
- Quantity Controls: Increment/decrement product quantities with +/- buttons
- Responsive UI: Clean, modern interface with smooth animations
- Cart Management: Add items, update quantities, remove items, or clear entire cart
fsd_project/
├── index.html # Main HTML file
├── assets/
│ ├── stylesheets/
│ │ └── main.css # All styles
│ └── javascript/
│ ├── model.js # Cart data model & localStorage logic
│ ├── api.js # API fetching & product display
│ └── main.js # User interaction handlers & UI updates
└── README.md
- HTML5: Semantic markup (aside, main, section, nav)
- CSS3: Flexbox, Grid, transitions, utility classes
- JavaScript ES6: Arrow functions, template literals, closures, Promises
- DOM APIs: querySelector, createElement, classList, addEventListener
- Browser Storage API: localStorage for cart persistence
- Font Awesome: Icons for UI elements
- DummyJSON API: Free REST API for product data
addItem(id, title, price, thumbnail)- Add item or increment quantityupdateQuantity(id, quantity)- Update item quantity or remove if 0deleteItem(id)- Remove item from cartclearCart()- Empty entire cartgetTotal()- Calculate total pricegetTotalItems()- Calculate total item countsaveCart()- Persist cart to localStorageloadCart()- Restore cart from localStorage
addToCartController()- Handles "Add to Cart" button clicksdeleteFromCartController()- Handles trash icon clicksdisplayCart()- Renders cart items in sidebartoggleCart()- Show/hide cart sidebarclearCartController()- Handles "Clear Cart" with confirmationsearchProducts()- Real-time product filtering
displayProducts(products)- Dynamically creates product cards- Fetches from
https://dummyjson.com/products
- model.js loads →
cartObj.loadCart()restores cart from localStorage - api.js loads → Fetches products → Displays 100 product cards
- main.js loads → Sets up event listeners → Displays restored cart
- User clicks "Add to Cart"
addToCartController()runs- Finds product in
productsarray cartObj.addItem()adds/updates item- Saves to localStorage
showCart()makes sidebar visibledisplayCart()refreshes UI
- User clicks +/- button
- Closure captures item details
cartObj.updateQuantity()updates quantity- Saves to localStorage
displayCart()refreshes UI
- User types in search box
searchProducts()fires on every keystroke- Filters
productsarray by title/description displayProducts()shows only matching products
- Every cart modification triggers
saveCart() - Cart saved as JSON string:
localStorage.setItem('ecomeasy_cart', JSON.stringify(cart)) - On page load:
loadCart()retrieves and parses cart data - Cart survives browser refresh/close
Visit the live demo: https://raghav5577.github.io/EcomEasy/
-
Clone the repository
git clone https://github.com/raghav5577/EcomEasy.git cd EcomEasy -
Open in browser
- Simply open
index.htmlin any modern browser - No build process or dependencies required
- Simply open
-
Start shopping!
- Browse 100 products
- Search for specific items
- Add to cart and manage quantities
- Cart persists across sessions
- Shows/hides with toggle button
- Displays product image, title, price
- Quantity controls with +/- buttons
- Delete button for each item
- Live total calculation
- Clear cart option with confirmation
- Product image
- Title and description
- Price display (₹)
- Add to Cart button
- Hover effects
- Case-insensitive search
- Searches title AND description
- Real-time filtering (input event)
- Shows all products when search cleared
- Chrome/Edge (recommended)
- Firefox
- Safari
- Requires localStorage support
- JavaScript must be enabled
- Checkout button not functional (placeholder)
- Desktop-only design (no mobile responsive styles)
- No user authentication
- No backend integration
- No payment processing
This project is open source and available for educational purposes.
Raghav Karnatak
- GitHub: @raghav5577
- DummyJSON - Free REST API for product data
- Font Awesome - Icon library
- Built as part of Full Stack Development projectwork
Happy Shopping! 🛒