This repository contains the frontend for an ecommerce web application built with React (Create React App), using React Router, Context API (auth/cart/search), and UI libraries like Ant Design.
Note: This project expects a separate backend (not included in this repo) for authentication, products/categories, and order management.
- Browse products by category and individual product pages
- Search functionality (via a search context)
- Shopping cart (stored in
localStorage) - Authentication & authorization
- User dashboard (profile, orders)
- Admin dashboard (category/product CRUD, admin orders)
- Role-based routing
- Nested dashboard route distinguishes admin vs user based on
auth.user.role
- Nested dashboard route distinguishes admin vs user based on
- Payments UI dependency included (
braintree-web-drop-in-react) (backend integration assumed)
- React 18 + React Router DOM v6
- Context API for auth/cart/search state
- Axios for API calls
- Ant Design + React Icons
- React Helmet / Toast notifications
client/- React applicationsrc/pages/- route-level pages (Home, Products, Cart, Auth, Admin, User)src/context/- auth/cart/search state managementsrc/components/- shared UI/layout componentssrc/hooks/- custom hooks (e.g. categories)
From the repository root:
cd client
npm installThis frontend uses Axios. Check any API base URL configuration in your code (commonly in an .env file or a config module). If the project currently hardcodes a base URL, update it to match your backend.
From client/:
npm startOpen:
/- Home/search- Search results/categories- Categories list/category/:slug- Category products/product/:slug- Product details/cart- Cart page
Auth:
/register/login/forgot-password
Dashboard:
/dashboard/user- User dashboard, orders, profile/dashboard/admin- Admin dashboard, create/update categories/products, admin orders
From client/:
npm run build- Deploy the
client/buildoutput to a static hosting provider. - Ensure your frontend is configured to reach the backend API.
- If you see 401/403 errors, verify:
- backend JWT/token validation
- role values (
auth.user.role) for admin routes
- If pages show blank data:
- verify backend endpoints
- verify the expected response shapes (categories/products/orders)