A modern responsive e-commerce frontend built with React, Tailwind CSS, and Vite.
Features product listing, cart management, favorites, dummy payment flow, EmailJS contact form, AI-driven UI, and a clean responsive design.
π View Demo
| Home | Product | Cart |
|---|---|---|
![]() |
![]() |
![]() |
| Favorites | Contact | Payment |
|---|---|---|
![]() |
![]() |
![]() |
- ποΈ Product Listing β Images, prices, descriptions
- π Shopping Cart β Add/remove items, update quantities, localStorage persistent
- β€οΈ Favorites / Wishlist β Save favorite products
- βοΈ Contact Form β EmailJS frontend integration
- π³ Payment (Demo) β Address + card form UI for checkout simulation
- π Search & Filter β Keyword & category search
- π€ AI Visibility Component β AI-driven product suggestions
- π¦ Order History β Simulated order progress (Pending β Delivered)
- π§ͺ Testing β Vitest + Testing Library for UI & logic
- Frontend: React + Vite
- Styling: Tailwind CSS
- State Management: React Context API + Zustand + Hooks
- Email Service: EmailJS
- Icons: Lucide React
- Hosting: Vercel
- Data: Static JSON (mock backend)
# 1. Clone repo
git clone https://github.com/amanuel1221/e-commerce.git
cd e-commerce
# 2. Install dependencies
npm install
# 3. Add environment variables (.env)
VITE_EMAILJS_SERVICE_ID=xxxx
VITE_EMAILJS_TEMPLATE_ID=xxxx
VITE_EMAILJS_PUBLIC_KEY=xxxx
# 4. Start dev server
npm run dev
# 5. Open app
http://localhost:5173
π§ͺ Testing
bash
Copy code
# Run all tests
npm run test
ProductCard Tests: Rendering, add to cart, favorites, filtering, load more
Cart Tests: Increment/decrement, remove, clear cart, total calculation
Orders Tests: Current user filtering, mark delivered, clear history
Testing Experience:
Initial failures due to undefined props and missing store mocks
Solved with mocking Zustand store/context and passing proper test data
Learned state, props, and hooks interactions in tests
After debugging, all tests pass successfully β
π Project Structure
css
Copy code
e-commerce/
ββ public/
ββ src/
β ββ components/
β β ββ Header.jsx
β β ββ Footer.jsx
β β ββ ProductCard.jsx
β β ββ CartItem.jsx
β β ββ FavoriteItem.jsx
β β ββ ContactForm.jsx
β β ββ PaymentForm.jsx
β β ββ AIVisibility.jsx
β ββ pages/
β β ββ Home.jsx
β β ββ Product.jsx
β β ββ Cart.jsx
β β ββ Favorites.jsx
β β ββ Contact.jsx
β β ββ Payment.jsx
β ββ context/
β ββ data/
β ββ services/
β ββ store/
β ββ App.jsx
β ββ main.jsx
ββ package.json
ββ tailwind.config.js
ββ vite.config.js
ββ README.md
β‘ Usage
Browse products & add to Cart/Favorites
Manage items from Cart/Favorites
Submit Contact Form (EmailJS)
Test demo Payment UI
View AI suggested items
π§ What I Learned
Component Architecture: Reusable components, props, shared state
EmailJS: Setup, environment variables, debugging failed submissions
UI Libraries: Tailwind, Lucide icons, Framer Motion
Cart & Payment Logic: State management, totals, multi-step checkout
Testing: Mocking context, handling hooks, UI & state validation
Deployment: Vercel build fixes & environment variables
π§© Challenges & Solutions
Component connection issues β Fixed by lifting state & reorganizing components
EmailJS failures β Correct IDs & .env setup
UI bugs β Debugged imports & library setup
Cart/Payment bugs β Fixed totals & navigation
Testing failures β Mocked store & context properly, carefully passing data β all tests pass β
π§ Future Improvements
Real backend (Node.js / Django)
Real payments (Stripe/PayPal)
Admin dashboard
AI-powered recommendations
Persistent orders & favorites in database
π€ Contributing
bash
Copy code
# Fork the repo
git checkout -b feature/your-feature
git commit -m "Add feature"
git push origin feature/your-feature
Open a pull request π
π License
This project is licensed under the MIT License.
π Acknowledgements
React
Tailwind CSS
Vite
EmailJS
Lucide React Icons









