A React frontend for the mock e-commerce cart backend in the repo root. It fetches products, lets you add/remove items from the cart, and keeps totals in sync with the Express + MongoDB API.
- Product catalogue with search + responsive grid layout
- Live cart summary with totals and item breakdown
- API integration with loading/empty states and user notifications
- Axios-based client with configurable backend base URL
- Install dependencies:
npm install
- Start the backend (from the repository root) so the API is available on
http://localhost:5000:npm run dev
- In this
frontendfolder, run the Vite dev server:npm run dev
- Open the provided local URL (default
http://localhost:5173). The app connects to the backend automatically when both are running.
VITE_API_BASE_URL(optional): set this if the backend runs on a different host/port. Example:Without this variable the app assumes:VITE_API_BASE_URL=http://localhost:5000
http://localhost:5000duringnpm run dev- the same origin when built for production
- Load the app to see the seeded products from the backend.
- Use “Add to cart” to push items to the server-side cart.
- Remove items from the cart panel and observe totals updating immediately.
Tailor the styling and interactions under src/App.css and src/api as needed to match your branding or extend business logic.*** End Patch