A modern, fully-functional e-commerce shopping cart application built with React. This project showcases a clean, intuitive interface where users can browse products, add items to their cart, and manage their shopping experience seamlessly.
- Dynamic Product Catalog – Browse through a collection of products with detailed information and pricing
- Shopping Cart Management – Add, remove, and update quantities of items in your cart
- Responsive Navigation – Easy-to-use navbar for seamless navigation between Home, Shop, and Cart pages
- Context-Based State Management – Utilizes React Context API for efficient cart state management across components
- Modern Component Architecture – Built with reusable React components for maintainable and scalable code
- API Integration – Fetches real product data from FakeStore API
- Comprehensive Testing – Includes unit tests for React components using Vitest
| Technology | Purpose |
|---|---|
| React 19 | Core framework for building the user interface |
| React Router DOM | Client-side routing and navigation |
| Vanilla CSS | Styling with custom CSS modules |
| FakeStore API | External API for fetching product data |
| Vitest | Unit testing framework for React components |
| Vite | Fast build tool and development server |
| Lucide React | Modern icon library |
| ESLint | Code quality and linting |
Before you begin, ensure you have the following installed:
- Node.js (v16 or higher)
- npm
-
Clone the repository
git clone <repository-url> cd shopping-cart
-
Install dependencies
npm install
-
Start the development server
npm run dev
The application will be available at
http://localhost:5173 -
Build for production
npm run build
-
Preview production build
npm run preview
Run the test suite:
npm testRun tests with coverage:
npm test -- --coveragesrc/
├── App Components/ # Main app component and logic
├── HomePage Components/ # Home page component
├── ShopPage Components/ # Shop/Products page component
├── Cart Components/ # Shopping cart component
├── assets/ # Static assets
├── ItemContext.jsx # React Context for cart state
├── routes.jsx # Route configuration
└── main.jsx # Application entry point
public/ # Static files and fonts
tests/ # Test configuration and utilities
- App.jsx – Main application component with navigation and routing
- ItemContext.jsx – Global cart state management using React Context API
- HomePage.jsx – Landing page with featured products
- Shop.jsx – Product catalog with filtering and display options
- Cart.jsx – Shopping cart with quantity management and checkout
- React Router Implementation – Mastered declarative routing in React, including route configuration, navigation, and handling dynamic routes for product pages
- Testing with Vitest – Gained experience in writing and running tests for React components using modern testing practices
- Context API – Implemented global state management using React Context for the shopping cart functionality without external state libraries
- API Integration – Implemented API calls to fetch product data from FakeStore API, handling async operations and error states gracefully
- Component Architecture – Developed scalable, reusable React components with proper separation of concerns
- Responsive Design – Created a responsive layout that works across different screen sizes
npm run dev– Start development server with hot reloadnpm run build– Create production-optimized buildnpm run preview– Preview the production build locallynpm test– Run the test suitenpm run lint– Check code quality with ESLint
This project uses the FakeStore API for product data:
- API Base URL: https://fakestoreapi.com
- Products Endpoint:
/api/products - Categories Endpoint:
/api/products/categories
FORSAKANG CHOFOR JUNIOR
Feel free to reach out with questions or feedback!