Skip to content

kweephyo-pmt/e-commerce

Repository files navigation

⚑ Techno World β€” Thailand's Premium Tech Store

Techno World Banner

A full-featured cyberpunk-themed e-commerce web application built with React, Vite, and Firebase. Features a real-time admin dashboard, bank transfer payment verification, secure role-based authentication, Cloudinary image uploads, and a complete order management system.


πŸ“Έ Screenshots

πŸ›οΈ Customer Pages

Home Page Product Page
Home Products
Product Detail Cart
Product Detail Cart
Orders Profile
Orders Profile

πŸ›‘οΈ Admin Panel

Dashboard Products
Admin Dashboard Admin Products
Orders Customers
Admin Orders Admin Customers
Categories Bank Accounts
Admin Categories Admin Bank Accounts
Settings
Admin Settings

✨ Features

πŸ›οΈ Customer-Facing

  • Product Browsing β€” Filter by category, price range, and star rating via a dynamic sidebar
  • Product Details β€” Multi-image gallery with lightbox viewer, stock status, reviews & ratings
  • Smart Cart β€” Add/remove items, adjust quantities, real-time totals
  • Bank Transfer Checkout β€” Upload payment slip; admin verifies before order is confirmed
  • Real-time Order Tracking β€” Status updates live (Pending β†’ Processing β†’ Shipped β†’ Delivered)
  • Order Success Page β€” Reflects payment confirmation in real-time without refresh
  • User Profile β€” Manage personal info and shipping address (auto-filled at checkout)
  • Reviews & Ratings β€” Leave and view product reviews
  • Wishlist β€” Save products for later
  • Authentication β€” Email/password and Google sign-in via Firebase Auth

πŸ›‘οΈ Admin Dashboard

  • Overview Dashboard β€” Live stats: total sales, orders, products, and real-time activity feed
  • Product Management β€” Full CRUD with multi-image Cloudinary uploads, category assignment, real-time stock updates
  • Order Management β€” Confirm or reject bank transfer payments; stock only deducted on confirmation
  • Customer Management β€” View all users, order counts, and total spend (excludes cancelled/rejected orders)
  • Category Management β€” Create, edit, and delete product categories
  • Bank Account Management β€” Manage payment accounts shown to customers at checkout
  • Settings & Access Control β€” Grant or revoke admin access per user; update shipping fee settings
  • Activity Log β€” Real-time feed of all admin actions with admin identity (name + avatar)
  • Separate Admin Login β€” Admins and customers use completely separate login flows

πŸ› οΈ Tech Stack

Technology Purpose
React 18 + Vite UI framework & build tool
Tailwind CSS Utility-first styling
Lucide React Icon library
React Context API Auth, Cart, Wishlist global state
React Router DOM Client-side routing
Firebase Auth Authentication
Firebase Firestore Real-time database
Cloudinary Product image hosting & uploads

βš™οΈ Installation & Setup

Prerequisites

  • Node.js v18+
  • A Firebase project with Authentication and Firestore enabled
  • A Cloudinary account with an unsigned upload preset

1. Clone the Repository

git clone https://github.com/kweephyo-pmt/e-commerce.git
cd e-commerce

2. Install Dependencies

npm install

3. Configure Environment Variables

Create a .env file in the root directory:

# Firebase
VITE_FIREBASE_API_KEY=your_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_id

# Cloudinary
VITE_CLOUDINARY_CLOUD_NAME=your_cloud_name
VITE_CLOUDINARY_UPLOAD_PRESET=your_unsigned_upload_preset

Tip: Copy .env.example and fill in your values.


4. Start the Development Server

npm run dev

Open http://localhost:5173 in your browser.


πŸ“‚ Project Structure

β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/         # Reusable UI (Navbar, Toast, FilterSidebar, CloudinaryUpload, etc.)
β”‚   β”œβ”€β”€ context/            # Global state (AuthContext, CartContext, WishlistContext)
β”‚   β”œβ”€β”€ pages/              # All pages
β”‚   β”‚   β”œβ”€β”€ Home.jsx
β”‚   β”‚   β”œβ”€β”€ Products.jsx
β”‚   β”‚   β”œβ”€β”€ ProductDetails.jsx
β”‚   β”‚   β”œβ”€β”€ Cart.jsx
β”‚   β”‚   β”œβ”€β”€ Checkout.jsx
β”‚   β”‚   β”œβ”€β”€ OrderSuccess.jsx
β”‚   β”‚   β”œβ”€β”€ Orders.jsx
β”‚   β”‚   β”œβ”€β”€ Profile.jsx
β”‚   β”‚   β”œβ”€β”€ Wishlist.jsx
β”‚   β”‚   β”œβ”€β”€ Login.jsx
β”‚   β”‚   β”œβ”€β”€ AdminLogin.jsx
β”‚   β”‚   β”œβ”€β”€ AdminDashboard.jsx      # Main admin shell + sidebar
β”‚   β”‚   β”œβ”€β”€ AdminOrders.jsx
β”‚   β”‚   β”œβ”€β”€ AdminCustomers.jsx
β”‚   β”‚   β”œβ”€β”€ AdminCategories.jsx
β”‚   β”‚   β”œβ”€β”€ AdminBankAccounts.jsx
β”‚   β”‚   └── AdminSettings.jsx
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   └── logActivity.js          # Shared activity logging utility
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── firebase.js             # Firebase initialization
β”‚   └── App.jsx
β”œβ”€β”€ firestore.rules                 # Firestore security rules
β”œβ”€β”€ vercel.json                     # Vercel deployment config
└── public/
    β”œβ”€β”€ favicon.png
    β”œβ”€β”€ Techno World.png            # OG share image
    └── TechnoWorld/                # App screenshots

πŸ”’ Security

Firestore Rules Summary

Collection Read Write
users Authenticated users Own doc or admin
products Public Admin (create/delete/update)
orders Own orders or admin Own orders (create); admin (update/delete)
reviews Public Authenticated (create); own or admin (update/delete)
categories Public Admin only
carts Own cart Own cart
activityLogs Admin only Authenticated users (create); admin (update/delete)
settings Public (read) Admin only

Auth Flow

  • Customers log in via /login β€” admin accounts are blocked here
  • Admins log in via /admin β€” redirected to /admin/dashboard
  • Regular users attempting to access /admin/dashboard are redirected to /

Payment Flow

  • Customer uploads bank transfer slip at checkout (stored via Cloudinary)
  • Stock is not deducted until admin confirms payment
  • Admin confirms β†’ stock decremented, order moves to Processing
  • Admin rejects β†’ order cancelled, stock untouched

πŸš€ Deployment

Vercel (Recommended)

The project includes a vercel.json for SPA routing. Deploy in one command:

vercel --prod

Or connect the GitHub repo directly in the Vercel dashboard and add your .env variables under Project β†’ Settings β†’ Environment Variables.


πŸ“„ License

This project is licensed under the MIT License.