This repository provides a complete, customizable e-commerce store template built with React, Redux, and Tailwind CSS. It includes essential features like product listing, cart functionality, and a checkout system, making it a perfect starting point for developers to create their own e-commerce projects.
- Features
- Project Setup
- File Structure
- Key Features and Customization
- Extending the Template
- FAQ
- Contributing
- Dynamic product display with category filtering.
- Add-to-cart functionality integrated with Redux.
- Modular components for easy customization.
- Responsive and mobile-friendly layout with Tailwind CSS.
- Extendable payment integration logic.
- Clean and intuitive user interface.
- Node.js (v14 or above)
- npm or yarn
- Clone the repository:
git clone https://github.com/Kobe0103/E-Commerce-Store-Template.git cd E-Commerce-Store-Template - Install dependencies:
npm install # or yarn install - Start the development server:
npm start # or yarn start - Open http://localhost:3000 in your browser to view the app.
src/
├── App.tsx
├── index.tsx
├── index.css
├── components/
│ ├── Footer.tsx
│ ├── Navbar.tsx
│ ├── ProductCard.tsx
├── pages/
│ ├── AboutPage.tsx
│ ├── CartPage.tsx
│ ├── CategoryPage.tsx
│ ├── CheckoutPage.tsx
│ ├── ContactPage.tsx
│ ├── HomePage.tsx
│ ├── ProductDetailPage.tsx
│ ├── ShopPage.tsx
├── store/
│ ├── cartSlice.ts
│ ├── store.ts
├── types/
│ ├── products.ts
File: src/components/Navbar.tsx
- Purpose: Displays navigation links, a category dropdown menu, and the cart icon with item count.
- How to Customize:
- Categories: Update the
menuSectionsarray in the component to add or modify categories. - Logo and Links: Replace the logo image and update the
Linkcomponents for custom navigation.
- Categories: Update the
File: src/components/Footer.tsx
- Purpose: Displays footer sections dynamically based on the
footerLinksarray. - How to Customize:
- Edit the
footerLinksarray in the component:const footerLinks = [ { title: 'Shop', links: [ { name: 'All Products', url: '/shop' }, { name: 'New Arrivals', url: '/shop?sort=new' }, ], }, ];
- Edit the
File: src/pages/HomePage.tsx
- Purpose: Landing page featuring a hero section, featured categories, and products.
- How to Customize:
- Hero Section: Update the text and background image in the JSX.
- Featured Categories: Modify the
featuredCategoriesarray to include new categories or images.
File: src/pages/ShopPage.tsx
- Purpose: Displays all products with filtering options by category.
- How to Customize:
- Products: Update the
sampleProductsarray insrc/types/products.tsto add or modify products. - Category Dropdown: Adjust the logic for filtering categories in the JSX.
- Products: Update the
File: src/pages/CartPage.tsx
- Purpose: Displays products added to the cart and calculates the total price.
- How to Customize:
- Modify Redux logic in
src/store/cartSlice.tsto implement additional cart functionality. - Customize the "Go to Checkout" button to match your checkout flow.
- Modify Redux logic in
File: src/pages/CheckoutPage.tsx
- Purpose: Collects billing and payment information and displays an order summary.
- How to Customize:
- Update the
handlePaymentSubmitfunction to integrate with your payment gateway (e.g., Stripe, PayPal):const handlePaymentSubmit = (e: React.FormEvent) => { e.preventDefault(); // Replace with your payment gateway logic fetch('/api/create-checkout-session', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ cartItems }), }) .then(res => res.json()) .then(data => { window.location.href = data.checkoutUrl; }); };
- Update the
File: src/pages/ProductDetailPage.tsx
- Purpose: Displays detailed information about a single product.
- How to Customize:
- Modify the product layout to include additional details like reviews or specifications.
- Create a new file in the
src/pages/directory. - Add a route in
App.tsx:<Route path="/new-page" element={<NewPage />} />
- Replace the
sampleProductsarray insrc/types/products.tswith API calls to fetch data dynamically. - Example:
useEffect(() => { fetch('/api/products') .then(res => res.json()) .then(data => setProducts(data)); }, []);
- Use Tailwind CSS classes for layout and styling.
- Add global styles in
src/index.css.
- Replace the image in the
Navbar.tsxcomponent and adjust thealttext as needed.
- Implement your payment logic in the
CheckoutPage.tsxfile within thehandlePaymentSubmitfunction.
- Replace the
sampleProductsarray with a dynamic API call in theShopPage.tsxfile.
- Fork the repository.
- Create a feature branch.
- Commit your changes.
- Open a pull request.
For questions or support, please contact youremail@example.com. Feel free to contribute or suggest improvements!