Shopping_Cart_With_Svelte Svelte Themes

Shopping_cart_with_svelte

πŸ›’ Shopping Cart with Svelte + TypeScript

A lightweight shopping cart application built with Svelte, TypeScript, and TailwindCSS.
The project demonstrates how to manage state, reactivity, and UI interactions in Svelte without relying on heavy frameworks.


πŸš€ Features

  • Product Listing – Products are loaded from an API (loadData) and displayed in a responsive grid.
  • Add to Cart – Users can add products with a single click.
  • Cart Drawer – A side cart panel shows selected items, quantities, and total price.
  • Increase / Decrease Quantity – Update product quantity directly from the cart.
  • Remove Items – Remove items individually from the cart.
  • Free Shipping Notification – Alerts the user when their total cart value exceeds $50.
  • Cart State Management – Implemented using Svelte’s $state, $derived, and $effect reactivity.
  • Type Safety – Written in TypeScript with strong typing for products and cart items.
  • Responsive Design – Styled with TailwindCSS for a modern, responsive layout.

πŸ“‚ Project Structure

src/ β”œβ”€β”€ Api.ts # API loader for fetching products β”œβ”€β”€ App.svelte # Main shopping cart UI β”œβ”€β”€ cart-item.svelte # Component for individual cart items β”œβ”€β”€ Types.ts # TypeScript interfaces (Product, CartProduct)


βš™οΈ Tech Stack


πŸ“Έ Screenshots

image

πŸ”§ Installation & Usage

  1. Clone the repo ```bash git clone https://github.com/awadreda/shopping-cart-svelte.git cd shopping-cart-svelte

npm install

npm run dev

Top categories

Loading Svelte Themes