Skip to content

Latest commit

Β 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›οΈ Hair Oil Ecommerce Frontend

A modern, responsive ecommerce frontend built with React and Vite.

The application provides a complete online shopping experience including product browsing, cart management, authentication, checkout, Stripe payment integration, order history, and a protected admin dashboard.


πŸš€ Project Overview

This project is the frontend application for a full-stack hair oil ecommerce platform.

It communicates with a separate Node.js/Express backend through REST APIs.

Main Areas

  • Customer storefront
  • Product browsing
  • Shopping cart
  • User authentication
  • Forgot Password / Reset Password
  • Checkout
  • Stripe payment
  • Order history
  • Admin dashboard
  • Product management
  • Order management
  • User management
  • Analytics
  • Admin messages

✨ Customer Features

  • 🏠 Home page
  • πŸ›οΈ Product listing
  • πŸ“„ Product details
  • πŸ” Product search
  • 🏷️ Category filtering
  • πŸ’° Price filtering
  • πŸ›’ Shopping cart
  • βž• Increase product quantity
  • βž– Decrease product quantity
  • ❌ Remove cart items
  • πŸ’Ύ Persistent cart using Local Storage
  • πŸ‘€ User registration
  • πŸ” User login
  • πŸ‘οΈ Show/hide password
  • πŸ”‘ Forgot Password
  • πŸ”„ Reset Password
  • πŸ“¦ Place orders
  • πŸ’³ Stripe Checkout
  • βœ… Payment success page
  • πŸ“œ My Orders
  • πŸ“± Responsive design

πŸ‘¨β€πŸ’Ό Admin Dashboard

The application includes a protected admin panel accessible only to authorized administrators.

πŸ“Š Dashboard

  • Revenue statistics
  • Monthly sales information
  • Total products
  • Total users
  • Total orders
  • Inventory information
  • Low-stock products
  • Top-selling products
  • Recent orders
  • Recent users

πŸ“ˆ Analytics

  • Business statistics
  • Sales information
  • Revenue data
  • Visual charts using Recharts

πŸ“¦ Product Management

  • Create products
  • Edit products
  • Delete products
  • Search products
  • Product pagination
  • Product images
  • Cloudinary image upload

πŸ›’ Order Management

  • View all orders
  • Search orders
  • View order details
  • Update order status
  • Cancel pending orders
  • Export orders as CSV

πŸ‘₯ User Management

  • View registered users
  • Search users
  • Admin-protected routes

πŸ’¬ Messages

  • Admin message management
  • View customer messages

πŸ“ Admin UI

The admin dashboard includes:

  • Collapsible sidebar
  • Sidebar navigation icons
  • Responsive layout
  • Dashboard cards
  • Tables
  • Charts
  • Admin-only protected routes

πŸ› οΈ Technology Stack

Frontend

  • React
  • Vite
  • JavaScript
  • React Router DOM
  • Context API
  • Axios
  • React Hook Form
  • Yup
  • CSS Modules
  • Custom CSS

UI Libraries

  • React Icons
  • Lucide React
  • PrimeReact
  • PrimeIcons

Charts

  • Recharts

Payments

  • Stripe
  • @stripe/react-stripe-js
  • @stripe/stripe-js

πŸ“¦ Main Dependencies

npm install axios
npm install react-router-dom
npm install react-hook-form
npm install yup
npm install @hookform/resolvers
npm install react-icons
npm install lucide-react
npm install primereact primeicons
npm install recharts
npm install @stripe/react-stripe-js
npm install @stripe/stripe-js

πŸ“ Project Structure

UiHairOil/
β”‚
β”œβ”€β”€ public/
β”‚
β”œβ”€β”€ src/
β”‚   β”‚
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   └── Axios.js
β”‚   β”‚
β”‚   β”œβ”€β”€ assets/
β”‚   β”‚
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ Navbar.jsx
β”‚   β”‚   β”œβ”€β”€ Footer.jsx
β”‚   β”‚   β”œβ”€β”€ AdminRoute.jsx
β”‚   β”‚   β”œβ”€β”€ ScrollToTop.jsx
β”‚   β”‚   └── admin/
β”‚   β”‚       β”œβ”€β”€ AdminLayout.jsx
β”‚   β”‚       └── Sidebar.jsx
β”‚   β”‚
β”‚   β”œβ”€β”€ context/
β”‚   β”‚   └── CartContext.jsx
β”‚   β”‚
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ Home.jsx
β”‚   β”‚   β”œβ”€β”€ Products.jsx
β”‚   β”‚   β”œβ”€β”€ ProductDetails.jsx
β”‚   β”‚   β”œβ”€β”€ About.jsx
β”‚   β”‚   β”œβ”€β”€ Contact.jsx
β”‚   β”‚   β”œβ”€β”€ Cart.jsx
β”‚   β”‚   β”œβ”€β”€ Login.jsx
β”‚   β”‚   β”œβ”€β”€ Register.jsx
β”‚   β”‚   β”œβ”€β”€ ForgotPassword.jsx
β”‚   β”‚   β”œβ”€β”€ ResetPassword.jsx
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ admin/
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminDashboard.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminProducts.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminCreateProduct.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminEditProduct.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminOrders.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminOrderDetails.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminStatsDashboard.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminUser.jsx
β”‚   β”‚   β”‚   └── AdminMessages.jsx
β”‚   β”‚   β”‚
β”‚   β”‚   └── order/
β”‚   β”‚       β”œβ”€β”€ Checkout.jsx
β”‚   β”‚       β”œβ”€β”€ OrderSuccess.jsx
β”‚   β”‚       β”œβ”€β”€ MyOrders.jsx
β”‚   β”‚       └── PaymentSuccess.jsx
β”‚   β”‚
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   └── auth.js
β”‚   β”‚
β”‚   β”œβ”€β”€ validations/
β”‚   β”‚   └── authSchema.js
β”‚   β”‚
β”‚   β”œβ”€β”€ Styles/
β”‚   β”‚
β”‚   β”œβ”€β”€ App.jsx
β”‚   └── main.jsx
β”‚
β”œβ”€β”€ .env
β”œβ”€β”€ .gitignore
β”œβ”€β”€ package.json
β”œβ”€β”€ vite.config.js
└── README.md

πŸ” Environment Variables

The frontend uses Vite environment variables.

Create a local .env file:

VITE_API_URL=http://localhost:5000

For production, this value should point to the deployed backend API.

Example:

VITE_API_URL=https://your-production-backend-url

⚠️ Security

Never commit your real .env file to GitHub.

The repository should contain .env.example instead:

VITE_API_URL=

πŸš€ Getting Started

1. Clone the repository

git clone git@github.com:Faiza-tech/hairoilFrontend.git

2. Enter the project

cd hairoilFrontend

3. Install dependencies

npm install

4. Configure environment variables

Create:

.env

and add:

VITE_API_URL=http://localhost:5000

5. Start development server

npm run dev

The Vite development server normally runs on:

http://localhost:5173

πŸ—οΈ Production Build

Create a production build:

npm run build

Preview the production build locally:

npm run preview

πŸ“Έ Screenshots

Screenshots can be stored inside:

screenshots/

Recommended screenshots:

  • Home page
  • Products page
  • Product details
  • Shopping cart
  • Login
  • Forgot Password
  • Reset Password
  • Checkout
  • Stripe payment
  • Payment success
  • My Orders
  • Admin dashboard
  • Analytics
  • Product management
  • Order management
  • User management

Example:

![Home Page](./screenshots/home.png)

πŸ’³ Payment Flow

The customer checkout flow is:

Browse Products
      ↓
Add to Cart
      ↓
Checkout
      ↓
Enter Shipping Details
      ↓
Stripe Checkout
      ↓
Payment
      ↓
Payment Success
      ↓
Order Confirmation
      ↓
Order History

πŸ” Authentication Flow

Register
   ↓
Login
   ↓
JWT Authentication
   ↓
Protected Requests
   ↓
User Account

Forgot Password:

Forgot Password
      ↓
Enter Email
      ↓
Backend Sends Reset Email
      ↓
Open Reset Link
      ↓
Create New Password
      ↓
Login With New Password

πŸ‘¨β€πŸ’Ό Admin Flow

Admin Login
     ↓
AdminRoute Protection
     ↓
Admin Dashboard
     ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Dashboard     β”‚
β”‚ Analytics     β”‚
β”‚ Products      β”‚
β”‚ Orders        β”‚
β”‚ Users         β”‚
β”‚ Messages      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The admin sidebar can be collapsed to provide more workspace for the dashboard.


🧠 What I Learned

Through this project I worked with:

  • React component architecture
  • Vite
  • React Router
  • Protected routes
  • JWT authentication
  • Context API
  • Local Storage
  • REST API integration
  • Axios interceptors
  • Form validation
  • React Hook Form
  • Yup
  • Stripe Checkout
  • Payment confirmation
  • Order management
  • Admin dashboard architecture
  • CRUD operations
  • Search and filtering
  • Pagination
  • Recharts
  • Cloudinary
  • Responsive UI design
  • Forgot Password / Reset Password workflows
  • Email-based authentication workflows

πŸ“Œ Future Improvements

Potential future improvements include:

  • ❀️ Wishlist
  • ⭐ Product reviews and ratings
  • 🎟️ Coupon system
  • 🏷️ Discount management
  • πŸŒ™ Dark mode
  • 🌍 Multi-language support
  • πŸ“± Progressive Web App support
  • πŸ”” More notification features
  • πŸ“¦ Advanced inventory management
  • πŸ“Š More advanced analytics

πŸ”— Related Repository

Backend repository:

https://github.com/Faiza-tech/hairoilbackend

πŸ‘¨β€πŸ’» Author

Faiza

GitHub:

https://github.com/Faiza-tech

If you find this project useful, feel free to ⭐ the repository.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages