A modern, responsive React-based frontend for a beauty products e-commerce platform. Built with cutting-edge technologies and designed specifically for Ethiopian users with bilingual support (English/Amharic).
- Product Catalog - Browse and search beauty products with advanced filtering
- Shopping Cart - Add, update, remove items with persistent storage
- Wishlist - Save favorite products for later purchase
- User Authentication - Secure login/register with JWT tokens
- Order Management - Complete checkout process with order tracking
- User Profile - Manage personal information and order history
- Bilingual Support - Full English and Amharic (አማርኛ) translation
- Cultural Awareness - Designed for Ethiopian market and preferences
- Responsive Design - Mobile-first approach with seamless desktop experience
- Modern UI/UX - Clean, intuitive interface with smooth animations
- Chapa Payment Gateway - Secure Ethiopian payment processing
- Multiple Payment Methods - Support for various local payment options
- Real-time Payment Status - Instant payment confirmation and callbacks
- Dashboard - Overview of sales, orders, and system metrics
- Product Management - CRUD operations for products and categories
- Order Management - Track and update order statuses
- User Management - Manage customer accounts and roles
- Contact Management - Handle customer inquiries and support
- Dynamic Testimonials - Live customer reviews carousel (falls back to curated static samples if API empty)
- React 19 - Latest React with modern hooks and features
- Vite - Fast build tool and development server
- Remote-First Fallback - Automatic switch from production API to local dev API on network / 5xx failure (with manual override helpers)
- Tailwind CSS 4 - Utility-first CSS framework
- Framer Motion - Smooth animations and transitions
- React Icons - Comprehensive icon library
Create a
.envfile inClient-side/(root of the frontend project). The API base value SHOULD NOT include/apiif you want the automatic normalizer to append it once. (If you include it, the normalizer prevents duplication.)When the app boots it logs:# Primary remote (e.g. Render deployment root WITHOUT trailing /api preferred) VITE_API_BASE_URL=https://adeybloom-ecommerce-backend-1.onrender.com # Local fallback (used automatically if remote unreachable / 5xx) VITE_API_BASE_URL_LOCAL=http://localhost:5000 # Payment / Other keys VITE_CHAPA_PUBLIC_KEY=your_chapa_public_key
[API] Initial base URL set to: <resolved>/api. - Context API - Global state management for auth, cart, wishlist
- Axios - HTTP client for API communication
The shared src/config/axios.js client:
- Normalizes base so it ends with
/apiexactly once. - Starts with
VITE_API_BASE_URL(remote) when defined. - On network failure or server 5xx (first request only), it falls back to
VITE_API_BASE_URL_LOCAL. - Provides helpers:
forceLocalApi()– manually switch to local.resetToRemoteApi()– switch back to remote.getCurrentApiBase()– inspect current active base.
- Optional redirect on 401 (enabled by default). Can be toggled via
setRedirectOn401(false)(if added) to avoid loops during custom flows.
- HTTP-only cookie based (no manual token injection required in requests)
AuthContextcalls/auth/meon mount to hydrate user state
- 404 on remote before fallback triggers a console hint to check that the environment base is missing
/api. - Product fetch gracefully substitutes demo products if initial load fails, keeping the homepage populated.
- TypeScript Support - Type definitions for better development
Client-side/
├── public/ # Static assets
├── src/
│ ├── components/ # Reusable UI components
│ │ ├── Navbar.jsx # Navigation bar with language switcher
│ │ ├── Footer.jsx # Site footer
│ │ ├── ProductCard.jsx # Product display card
│ │ ├── SearchBar.jsx # Product search functionality
│ │ └── LoadingSpinner.jsx
**Local Override Flow**
In dev tools console you can run:
```js
import { forceLocalApi, resetToRemoteApi, getCurrentApiBase } from '/src/config/axios.js';
forceLocalApi();
getCurrentApiBase(); // -> http://localhost:5000/api
resetToRemoteApi();
Troubleshooting 404 /products
If you see Cannot GET /products from the remote host:
- Ensure backend actually mounts routes at
/api/products. - Ensure
VITE_API_BASE_URLdoes NOT already include/apitwice. - Confirm console log normalized:
.../api.
Dynamic Testimonials
Testimonials.jsx fetches /reviews/recent. If empty or error, fallback static testimonials render (ensures consistent UX during early staging).
Ratings & Discounts
product.controller.js enriches products with rating, reviewCount, discount, and computed final price; product cards reflect these.
│ ├── pages/ # Page components
│ │ ├── HomePage.jsx # Landing page with hero section
│ │ ├── ProductDetails.jsx # Individual product view
│ │ ├── ProductListing.jsx # Product catalog with filters
│ │ ├── Cart.jsx # Shopping cart
│ │ ├── Checkout.jsx # Checkout with Chapa payment
│ │ ├── UserProfile.jsx # User account management
│ │ ├── OrderHistory.jsx # Order tracking
│ │ ├── WishlistPage.jsx # Saved products
│ │ ├── AboutUs.jsx # Company information
│ │ ├── ContactUs.jsx # Contact form
│ │ ├── FAQ.jsx # Frequently asked questions
│ │ └── admin/ # Admin panel pages
│ │ ├── AdminDashboard.jsx
│ │ ├── ProductsPanel.jsx
│ │ ├── OrdersPanel.jsx
│ │ ├── UsersPanel.jsx
│ │ ├── ContactManagement.jsx
│ │ └── Settings.jsx
│ ├── context/ # React Context providers
│ │ ├── AuthContext.jsx # Authentication state
│ │ ├── CartContext.jsx # Shopping cart state
│ │ ├── WishlistContext.jsx # Wishlist management
│ │ ├── ToastContext.jsx # Notification system
│ │ └── TranslationContext.jsx # i18n management
│ ├── services/ # API service functions
│ │ ├── authService.js # Authentication APIs
│ │ ├── productService.js # Product management
│ │ ├── orderService.js # Order processing
│ │ ├── cartService.js # Cart operations
│ │ └── contactService.js # Contact form
│ ├── i18n/ # Internationalization
│ │ └── translation.js # English/Amharic translations
│ ├── routes/ # Routing configuration
│ │ ├── index.jsx # Main router setup
│ │ └── ProtectedRoute.jsx # Route protection
│ ├── config/ # Configuration files
│ │ └── axios.js # Axios configuration
│ ├── payment/ # Payment integration
│ │ ├── CallbackPage.jsx # Payment callback handler
│ │ └── SuccessPage.jsx # Payment success page
│ └── layouts/ # Layout components
│ └── RootLayout.jsx # Main app layout
├── package.json
└── README.md
## 🚀 Getting Started
### Prerequisites
- **Node.js** (v18 or higher)
- **npm** or **yarn**
- **Backend API** running (see backend README)
### Installation
1. **Clone the repository**
```bash
git clone <repository-url>
cd beauty-products-ecommerce-clientSide/Client-side
-
Install dependencies
npm install # or yarn install -
Environment Setup Create a
.envfile in the root directory:VITE_API_BASE_URL=http://localhost:5000/api VITE_CHAPA_PUBLIC_KEY=your_chapa_public_key
-
Start development server
npm run dev # or yarn dev -
Open your browser Navigate to
http://localhost:5173
npm run build
# or
yarn buildThe frontend communicates with the backend API through:
- Base URL:
http://localhost:5000/api - Authentication: JWT tokens stored in HTTP-only cookies
- Error Handling: Centralized error management with user-friendly messages
POST /auth/login- User authenticationGET /products- Fetch products with filteringPOST /cart- Add items to cartPOST /orders- Create new ordersGET /orders/my-orders- User order history
- Color Palette: Purple/pink gradient theme (#C585D7)
- Typography: Clean, readable fonts with proper hierarchy
- Spacing: Consistent spacing using Tailwind's spacing scale
- Components: Reusable, accessible UI components
- Mobile First: Optimized for mobile devices
- Tablet Support: Seamless tablet experience
- Desktop: Full-featured desktop interface
- Touch Friendly: Large touch targets and gestures
- Page Transitions: Smooth navigation between pages
- Loading States: Engaging loading animations
- Micro-interactions: Hover effects and button animations
- Form Feedback: Real-time validation and feedback
- English - Primary language
- Amharic (አማርኛ) - Ethiopian language support
- Dynamic Language Switching - Real-time language toggle
- Context-Aware Translations - Proper cultural adaptations
- Persistent Language Selection - Remembers user preference
- Fallback System - Graceful handling of missing translations
- Currency Formatting - Ethiopian Birr (ETB) support
- Ethiopian Payment Processing - Local payment gateway
- Multiple Payment Methods - Bank transfers, mobile money
- Secure Transactions - PCI compliant payment processing
- Real-time Callbacks - Instant payment status updates
- Test Mode Support - Development and testing capabilities
- User completes checkout form
- Order is created in the system
- Redirect to Chapa payment gateway
- Payment processing
- Callback to success/failure page
- Order status update
- JWT Authentication - Secure token-based authentication
- Protected Routes - Role-based access control
- Input Validation - Client-side form validation
- XSS Protection - Sanitized user inputs
- HTTPS Ready - Production-ready security headers
- Progressive Web App - PWA capabilities
- Responsive Design - Mobile-optimized interface
- Touch Gestures - Swipe navigation and interactions
- Mobile Payments - Optimized mobile payment flow
- ESLint Configuration - Code quality enforcement
- Component Testing - Unit tests for critical components
- Performance Monitoring - Core Web Vitals tracking
- Accessibility Testing - WCAG compliance
npm run build- Vercel - Recommended for React apps
- Netlify - Easy deployment with CI/CD
- AWS S3 + CloudFront - Scalable cloud deployment
- Docker - Containerized deployment
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Samuel Aemro - Lead Developer - @samuelAemro12
- davee1625 - Developer - @davee1625
- Ethiopian beauty industry for inspiration
- React community for excellent documentation
- Tailwind CSS for the amazing utility framework
- Chapa for Ethiopian payment gateway integration
AdeyBloom - Empowering Ethiopian beauty through technology 🌸