A modern, full-featured e-commerce application built with React, Redux Toolkit, Firebase, and React Query. This project demonstrates advanced React concepts including state management, asynchronous data fetching, routing, session persistence, Firebase backend integration, and a robust CI/CD pipeline with comprehensive test coverage.
π Live Demo: https://e-commerce-product-listing-app.vercel.app
π¦ GitHub Repository: View Source Code
π CI/CD Status:
- Built a production-style React commerce app with Redux Toolkit, React Query, Firebase, and route-based UX flows.
- Implemented CI/CD with automated checks and deployment to Vercel.
- Added test coverage for key UI and integration behaviors (22 passing tests).
- Demonstrated scalable front-end patterns: feature components, state slices, and service modules.
Add screenshots and short GIFs under docs/media/ to highlight important user flows.


- Dynamic Product Listing: Fetches and displays all products from Firebase Firestore
- Product Information: Shows title, price, category, description, rating, and images
- Image Fallback: Handles broken image URLs with placeholder images
- Category Navigation: Dynamic dropdown populated from API categories
- Category Filtering: Filter products by category with real-time updates
- Redux State Management: Powered by Redux Toolkit for robust state management
- Add to Cart: Add products directly from the product listing page
- Remove from Cart: Remove individual items from the cart
- Quantity Tracking: Track the count of each product in the cart
- Session Persistence: Cart data persists across browser sessions using sessionStorage
- Real-time Calculations: Automatic calculation of total items and total price
- Checkout Functionality: Simulates checkout by clearing cart with visual feedback
- Responsive Design: Works seamlessly on desktop, tablet, and mobile devices
- Loading States: Spinner animations while fetching data
- Error Handling: Graceful error messages for failed API requests
- Visual Feedback: Button animations and success messages
- Navigation: Easy navigation between Home and Cart pages with cart badge showing item count
- React 18.2 - Modern React with hooks
- Redux Toolkit - State management for shopping cart
- React Query (TanStack Query) - Asynchronous data fetching and caching
- React Router DOM - Client-side routing
- Vite - Fast build tool and development server
- CSS3 - Custom styling with responsive design
- Firebase - Backend services (Firestore, Authentication)
- TypeScript - Type-safe backend and services
- Vitest - Fast unit test framework for Vite
- React Testing Library - Component testing utilities
- @testing-library/jest-dom - Custom Jest matchers
- @testing-library/user-event - User interaction simulation
- GitHub Actions - Automated CI/CD pipeline
- Vercel - Cloud platform for deployment
- ESLint - Code quality and linting
This project implements comprehensive testing following TDD principles:
-
ProductCard Component: 8 tests covering rendering, user interactions, and state changes
- Product information display
- Image error handling
- Add to cart functionality
- Visual feedback on user actions
- Navigation behavior
- Missing data handling
-
Navbar Component: 7 tests covering rendering and navigation
- Logo and navigation links
- Search functionality
- Cart badge updates
- Dynamic cart count display
- Link attributes and routing
- Cart Integration: 7 tests covering the complete shopping flow
- Adding products to cart
- Cart total calculations
- Quantity updates
- Product removal
- Duplicate product handling
- Checkout process
- Session storage persistence
- 22 passing tests across all components
- Independent and deterministic tests
- Focused on user interactions and state changes
- Simulates real user behavior using React Testing Library
# Run tests in watch mode
npm test
# Run tests once (CI mode)
npm run test:run
# Run tests with UI
npm run test:ui
# Run tests with coverage
npm run test:coverageThis project features a fully automated CI/CD pipeline using GitHub Actions and Vercel:
The CI workflow automatically runs on every push to main and on pull requests:
- Code Checkout - Retrieves latest code
- Environment Setup - Configures Node.js 18
- Dependency Installation - Installs npm packages with caching
- Code Linting - Runs ESLint for code quality
- Build Process - Compiles application with Vite
- Test Execution - Runs all unit and integration tests
- Artifact Upload - Stores build output for debugging
Pipeline Protection: The workflow fails if any test fails, preventing deployment of faulty code.
The CD workflow runs only after successful CI tests:
- Code Checkout - Retrieves verified code
- Production Build - Creates optimized production build
- Vercel Deployment - Deploys to Vercel hosting platform
Deployment Conditions:
- Only deploys from
mainbranch - Requires all tests to pass
- Only triggers on direct pushes (not PRs)
For detailed setup instructions, see CICD_SETUP.md.
Quick setup:
- Connect repository to Vercel
- Get Vercel credentials (token, org ID, project ID)
- Add credentials as GitHub Secrets
- Push to main branch to trigger pipeline
Before running this application, make sure you have the following installed:
- Node.js (v16 or higher)
- npm or yarn package manager
-
Clone the repository
git clone https://github.com/yousafzeb-byte/advanced-ecommerce-app.git cd advanced-ecommerce-app -
Install dependencies
npm install
-
Configure Firebase
Create a
.envfile in the root directory with your Firebase configuration:VITE_FIREBASE_API_KEY=your_api_key VITE_FIREBASE_AUTH_DOMAIN=your_auth_domain VITE_FIREBASE_PROJECT_ID=your_project_id VITE_FIREBASE_STORAGE_BUCKET=your_storage_bucket VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id VITE_FIREBASE_APP_ID=your_app_id
-
Start the development server
npm run dev
-
Open your browser
Navigate to
http://localhost:5173(or the URL shown in your terminal)
-
Build the application
npm run build
-
Preview production build locally
npm run preview
-
Run all tests
npm test -
Run tests once (CI mode)
npm run test:run
-
Run tests with coverage
npm run test:coverage
Advanced React E-Commerce Web App/
βββ .github/
β βββ workflows/
β βββ main.yml # CI/CD pipeline configuration
βββ src/
β βββ components/
β β βββ Home.jsx # Main product listing page
β β βββ Home.css
β β βββ ProductCard.jsx # Individual product card component
β β βββ ProductCard.css
β β βββ Cart.jsx # Shopping cart page
β β βββ Cart.css
β β βββ Navbar.jsx # Navigation bar with cart badge
β β βββ Navbar.css
β β βββ ProductDetails.jsx # Product details page
β β βββ ProductDetails.css
β βββ services/
β β βββ api.js # API service functions
β β βββ authService.ts # Firebase authentication service
β β βββ productService.ts # Firebase product service
β β βββ orderService.ts # Firebase order service
β β βββ userService.ts # Firebase user service
β βββ config/
β β βββ firebase.ts # Firebase configuration
β βββ store/
β β βββ store.js # Redux store configuration
β β βββ cartSlice.js # Cart reducer and actions
β βββ test/
β β βββ setup.js # Test configuration
β β βββ ProductCard.test.jsx # ProductCard unit tests
β β βββ Navbar.test.jsx # Navbar unit tests
β β βββ Cart.integration.test.jsx # Cart integration tests
β βββ App.jsx # Main app component with routing
β βββ App.css
β βββ main.jsx # Application entry point
β βββ index.css # Global styles
βββ index.html
βββ package.json
βββ vite.config.js # Vite build configuration
βββ vitest.config.js # Vitest test configuration
βββ vercel.json # Vercel deployment configuration
βββ CICD_SETUP.md # Detailed CI/CD setup guide
βββ README.md
React Query is used for all data fetching operations:
- Automatic caching and refetching
- Loading and error states management
- Optimized re-renders
- Stale data management
Shopping cart state is managed using Redux Toolkit:
- Reducers:
addToCart,removeFromCart,updateQuantity,clearCart - Selectors:
selectCartItems,selectCartTotal,selectCartItemCount - Middleware: Automatic sessionStorage synchronization
Cart data persists across browser sessions:
- Cart is saved to sessionStorage on every update
- Cart is loaded from sessionStorage on app initialization
- Survives page refreshes and tab closures (within the same session)
Backend powered by Firebase:
- Firestore Database - Product catalog, user data, and orders
- Firebase Authentication - User authentication and authorization
- Real-time Updates - Live data synchronization
- Cloud Functions - Serverless backend logic
The application features:
- Dark mode support with light mode fallback
- Responsive grid layouts for product displays
- Smooth animations for interactions
- Modern UI components with hover effects
- Mobile-first design approach
- View all products on the home page
- Use the category dropdown to filter by category
- See product details including ratings and descriptions
- Click "Add to Cart" on any product
- Navigate to the Cart page using the navigation bar
- View cart items with quantities and subtotals
- Remove items using the "Remove" button
- See real-time updates of total items and total price
- Click "Proceed to Checkout" in the cart
- View success message
- Cart is automatically cleared
# Build the application
npm run build
# Preview the production build
npm run previewThis creates an optimized production build in the dist directory.
The application is automatically deployed to Vercel via GitHub Actions when code is pushed to the main branch.
Manual Deployment:
# Install Vercel CLI
npm install -g vercel
# Deploy to production
vercel --prod
# Deploy preview
vercelThis project demonstrates:
- β Asynchronous data fetching with React Query
- β State management with Redux Toolkit
- β React Router for navigation
- β Session storage for data persistence
- β Component-based architecture
- β Responsive web design
- β Error handling and loading states
- β Modern React patterns and best practices
- β Firebase backend integration
- β TypeScript for type safety
- β Test-Driven Development (TDD)
- β Unit and Integration Testing
- β CI/CD Pipeline Implementation
- β GitHub Actions Workflows
- β Automated Deployment to Vercel
- β Code Quality with ESLint
- Live Application: https://e-commerce-product-listing-app.vercel.app
- GitHub Repository: https://github.com/yousafzeb-byte/advanced-ecommerce-app
- CI/CD Setup Guide: CICD_SETUP.md
- GitHub Actions: View Workflows
- Product images may fail to load if URLs are broken. The application gracefully handles this by displaying placeholder images.
Contributions, issues, and feature requests are welcome!
This project is licensed under the MIT License.
Yousaf Zeb
Built as a learning project to demonstrate advanced React concepts.
- Firebase for providing the backend infrastructure
- React, Redux, and React Query teams for excellent documentation
- Vite team for the amazing build tool