A modern, full-featured e-commerce web application built with React that enables businesses to sell their products online. This is the client-side application that provides an intuitive shopping experience for customers and a comprehensive admin panel for store management.
π Live Demo: https://sina-ecom.web.app/
- Features
- Technology Stack
- Project Structure
- Getting Started
- Environment Variables
- Available Scripts
- Key Functionalities
- API Integration
- State Management
- Deployment
- Product Catalog: Browse products with detailed descriptions, prices, images, and ratings
- Search Functionality: Search products by name with real-time filtering
- Category Navigation: Filter products by categories
- Product Details: View comprehensive product information with image magnification
- Shopping Cart: Add, update, and remove items from cart with quantity management
- User Authentication: Secure signup/login system with JWT tokens
- User Profile: Manage personal information and view order history
- Password Recovery: Forgot password and reset password functionality
- Shipping Information: Enter and save shipping addresses
- Order Placement: Complete checkout process with order confirmation
- Payment Integration: Secure payment processing
- Product Reviews: Leave ratings and reviews for purchased products
- Responsive Design: Fully responsive UI that works on all devices
- Admin Dashboard: Dedicated admin panel with protected routes
- Product Management: Add, edit, and manage products
- Category Management: Create and organize product categories
- Inventory Control: Track and update stock levels
- Rich Text Editor: Use Draft.js editor for product descriptions
- Image Upload: Upload product images via ImgBB API integration
- Order Management: View and manage customer orders
- React 17.0.2 - Core UI library
- React Router DOM 6.4.5 - Client-side routing and navigation
- Redux 4.1.2 - State management
- React Redux 7.2.6 - React bindings for Redux
- Redux Thunk 2.4.1 - Async Redux middleware
- Redux DevTools Extension - Development debugging tools
- React Bootstrap 2.1.2 - UI component library
- Bootstrap 4.6.0 - CSS framework
- Ant Design 4.18.5 - Enterprise-level UI design system
- Tailwind CSS 2.2.19 - Utility-first CSS framework
- Framer Motion 6.2.7 - Animation library
- React Icons 4.7.1 - Icon library
- React Hook Form 7.43.4 - Form validation and management
- React Hot Toast 2.4.0 - Toast notifications
- Draft.js 0.11.7 - Rich text editor framework
- TinyMCE React 3.13.0 - WYSIWYG editor
- React Image Magnify 2.7.4 - Product image zoom
- React Slick 0.29.0 - Carousel/slider component
- Slick Carousel 1.8.1 - Carousel base library
- Axios 0.24.0 - HTTP client for API requests
- Proxy: http://127.0.0.1:7070 (Backend server)
- JSON Web Token 8.5.1 - JWT token handling
- bcryptjs 2.4.3 - Password hashing
- SweetAlert2 11.3.10 - Beautiful alert dialogs
- React Loader Spinner 5.3.4 & React Spinners 0.11.0 - Loading indicators
- React Scripts 5.0.0 - Create React App build tooling
- Firebase Hosting - Deployment platform
sinaEcom-client/
βββ public/ # Static public assets
β βββ index.html # HTML template
β βββ manifest.json # PWA manifest
β βββ robots.txt # SEO robots file
β βββ images/ # Public images
β
βββ src/
β βββ index.js # Application entry point
β βββ App.js # Main App component
β βββ store.js # Redux store configuration
β βββ index.css # Global styles
β βββ App.css # App component styles
β βββ customizeCss.css # Custom styling
β
β βββ actions/ # Redux action creators
β β βββ cartActions.js # Cart operations
β β βββ categoriesAction.js # Category operations
β β βββ orderActions.js # Order operations
β β βββ payActions.js # Payment operations
β β βββ productActions.js # Product CRUD operations
β β βββ userActions.js # User authentication & profile
β
β βββ reducers/ # Redux reducers
β β βββ cartReducers.js
β β βββ categoriesReducers.js
β β βββ orderReducers.js
β β βββ payReducers.js
β β βββ productReducers.js
β β βββ userReducers.js
β
β βββ constants/ # Redux action constants
β β βββ cartConstant.js
β β βββ CategoriesConstant.js
β β βββ orderConstant.js
β β βββ payConstants.js
β β βββ productConstants.js
β β βββ urlConstant.js # API endpoint configuration
β β βββ userConstants.js
β
β βββ components/ # Reusable UI components
β β βββ Alert.js # Alert component
β β βββ Card.js # Card component
β β βββ Loader.js # Loading spinner
β β βββ Message.js # Message display
β β βββ Navbar.js # Navigation bar
β β βββ Product.js # Product card
β β βββ ProductList.js # Product grid
β β βββ Rating.js # Star rating display
β β βββ SideBar.js # Sidebar component
β β βββ Time.js # Time display utility
β
β βββ Layout/ # Layout components
β β βββ AdminLayout/ # Admin panel layout
β β β βββ AdminLayout.js
β β β βββ Admin.css
β β βββ Main/ # Main app layout
β β βββ Main.js
β
β βββ Router/ # Routing configuration
β β βββ PrivateRoutes/ # Protected route components
β β β βββ PrivateRoutes.js
β β βββ Routes/ # Route definitions
β β βββ Routes.js
β
β βββ screens/ # Page components
β β βββ HomeScreen.js # Homepage with slider & products
β β βββ CartScreen.js # Shopping cart
β β βββ ProductDetailsScreen.js # Product detail page
β β βββ SearchScreen.js # Search results
β β βββ ShippingScreen.js # Shipping address form
β β βββ PayScreen.js # Payment selection
β β βββ PlaceOrderScreen.js # Order confirmation
β β βββ SigninScreen.js # User login
β β βββ SignupScreen.js # User registration
β β βββ ForgotPasswordScreen.js # Password recovery
β β βββ ResetPasswordScreen.js # Password reset
β β β
β β βββ admin/ # Admin panel screens
β β β βββ AddProductScreen.js # Add new product
β β β βββ EditProductScreen.js # Edit product
β β β βββ ProductScreen.js # Product management
β β β βββ AddCategory.js # Category management
β β β
β β βββ Profile/ # User profile screens
β β β βββ ProfileScreen.js # User profile page
β β β βββ MyOrdersScreen.js # Order history
β β β βββ UserScreen.js # User management
β β β
β β βββ Categories/ # Category screens
β β β βββ Categories.js # Category listing
β β β βββ Category.js # Single category
β β β
β β βββ Footer/ # Footer component
β β β βββ FooterScreen.js
β β β
β β βββ Slider/ # Homepage slider
β β βββ HomeSlider.js
β
βββ firebase.json # Firebase hosting configuration
βββ package.json # Dependencies and scripts
βββ README.md # Project documentation
- Node.js (v14 or higher)
- npm or yarn package manager
- A running backend server (see API Integration section)
-
Clone the repository
git clone https://github.com/anis009/sinaEcom-client.git cd sinaEcom-client -
Install dependencies
npm install
-
Configure environment variables Create a
.envfile in the root directory (see Environment Variables section) -
Start the development server
npm start
-
Open your browser Navigate to
http://localhost:3000
Create a .env file in the root directory with the following variables:
# ImgBB API for image uploads (required for admin panel)
REACT_APP_imgbb_key=your_imgbb_api_key_hereTo get an ImgBB API key:
- Visit https://api.imgbb.com/
- Sign up for a free account
- Generate your API key
- Add it to your
.envfile
In the project directory, you can run:
Runs the app in development mode at http://localhost:3000. The page will reload when you make changes.
Builds the app for production to the build folder.
Optimizes the build for best performance.
Launches the test runner in interactive watch mode.
Note: this is a one-way operation! Ejects from Create React App for full configuration control.
Processes Tailwind CSS from src/tailwind.css to src/styles.css.
- JWT-based authentication with secure token storage
- User registration with email and password validation
- Login with credential verification
- Password recovery via email token
- Password reset functionality
- User profile updates
- Persistent login state using localStorage
- Add/remove products with quantity selection
- Real-time cart total calculation
- Cart persistence in localStorage
- Visual cart badge with item count
- Quantity adjustment in cart view
- Product listing with pagination
- Category-based filtering
- Search functionality with URL parameters
- Product detail view with image magnification
- Rating and review system
- Related products display
- Top-rated products section
- Add items to cart
- Proceed to checkout
- Enter shipping information
- Select payment method
- Review order details
- Place order and receive confirmation
- Track order in profile
- Protected routes (admin-only access)
- Add new products with rich text descriptions
- Upload product images to ImgBB
- Manage product inventory
- Create and manage categories
- View and manage all orders
- Edit existing products
- Production: https://sina-ecom-server.vercel.app
- Development Proxy: http://127.0.0.1:7070
User Endpoints:
POST /api/users- User registrationPOST /api/users/login- User loginPUT /api/users/- Update user profilePOST /api/users/forgotpassword- Request password resetPOST /api/users/resetpassword/:token- Reset password
Product Endpoints:
GET /api/products- Get all productsGET /api/products/:id- Get single productPOST /api/products- Create product (admin)PUT /api/products/:id- Update product (admin)POST /api/products/:id/reviews- Add product review
Category Endpoints:
GET /api/categories- Get all categoriesPOST /api/categories- Create category (admin)
Order Endpoints:
POST /api/orders- Create orderGET /api/orders/myorders- Get user ordersGET /api/orders/:id- Get single order
Payment Endpoints:
POST /api/payment- Process payment
{
userSignup: {
userInfo: { _id, name, email, token, isAdmin },
loading, error
},
userLogin: { loading, error },
updateUser: { loading, success, error },
cart: {
cartItems: [{ product, name, image, price, qty, countInStock }]
},
categories: {
categories: [{ _id, name, image }],
loading, error
},
order: { order, loading, success, error },
userOrder: { orders: [], loading, error },
payment: { loading, success, error },
getSingleOrder: { order, loading, error },
sentToken: { loading, success, error },
resetPassword: { loading, success, error },
addProduct: { loading, success, error },
editProduct: { loading, success, error },
getProducts: {
products: [], loading, error, pages, page
},
getTopProducts: { products: [], loading, error },
getSingleProduct: { product, loading, error },
addProductReview: { loading, success, error }
}- Redux Thunk: Handles async actions for API calls
- Redux DevTools: Browser extension integration for debugging
The application is deployed on Firebase Hosting:
-
Install Firebase CLI
npm install -g firebase-tools
-
Login to Firebase
firebase login
-
Build the application
npm run build
-
Deploy to Firebase
firebase deploy
The firebase.json file is configured to:
- Serve the
buildfolder as the public directory - Rewrite all routes to
index.htmlfor SPA routing
- Separation of concerns with dedicated folders for screens, components, and layouts
- Reusable components for consistency across the app
- Custom hooks for shared logic
- Centralized error messages using Message component
- Toast notifications for user feedback
- Form validation with error states
- Lazy loading with React.lazy (if implemented)
- Memoization of expensive computations
- Optimized re-renders with proper state management
- JWT token authentication
- Protected admin routes
- Password hashing (bcryptjs)
- Secure API communication
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is part of the MERN stack e-commerce application suite.
Anis Mola
- GitHub: @anis009
- Backend API: https://sina-ecom-server.vercel.app
- Deployed on Firebase Hosting
- Built with Create React App
- UI components from Bootstrap, Ant Design, and custom implementations
Note: This is the client-side application. Make sure the backend server is running for full functionality. For the backend repository, please visit the SinaEcom server repository.