A simple e-commerce application built using React and TypeScript.
- Product listing page
- Category-based filtering (via API)
- Sorting (price & name)
- Product detail page
- Add to cart
- Remove from cart
- Cart persistence using localStorage
- URL-based filter persistence
- End-to-end testing using Playwright
- React + TypeScript
- React Router
- Context API
- Axios
- Tailwind CSS
- Playwright (E2E Testing)
git clone <your-repo-url>
cd react-ecommerce-assignmentnpm installcp .env.example .envUpdate .env if needed:
VITE_API_BASE_URL=https://fakestoreapi.com or
VITE_API_BASE_URL=https://dummyjson.comnpm run devApp will run at:
http://localhost:5173
npx playwright testTo run in UI mode:
npx playwright test --headedGitHub Actions is configured to run Playwright tests on every push.
- Filtering and sorting is API-based as required.
- URL query parameters are used to persist filters and sorting.
- Cart data is stored in localStorage.
The original requirement suggested using FakeStore API. However, due to API unavailability during development, DummyJSON (https://dummyjson.com) was used as an alternative. The application is structured with a service layer, making it easy to switch APIs without affecting the UI.
- Pagination implemented for product listing to handle large datasets efficiently
- Accessible UI improvements (aria-labels for icon buttons)
- API abstraction layer for easy switching between APIs
- GitHub Actions workflow for automated Playwright testing