Skip to content

CSO2/frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

88 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ–₯️ CS02 Computer Store - Frontend

Modern e-commerce frontend for PC components and custom PC building

πŸ“‹ Overview

CS02 Computer Store is a comprehensive e-commerce web application for a computer components and custom PC building store. The application is themed around WSO2 brand colors (orange #FF7300) and provides a complete shopping experience for computer enthusiasts.

Key Features

  • Product Catalog - Browse pre-built PCs and individual components
  • Custom PC Builder - 8-step wizard with compatibility checking
  • BuilderBot AI - AI-powered chat assistant for build recommendations
  • Shopping Cart & Wishlist - Full cart and wishlist management
  • User Account - Profile, orders, addresses, payment methods
  • Admin Dashboard - Complete store management

πŸ› οΈ Technology Stack

Component Technology Version
Framework Next.js (App Router) 16.0.5
UI Library React 19.2.0
Language TypeScript ^5
Styling Tailwind CSS ^4
State Management Zustand ^5.0.8
HTTP Client Axios ^1.13.2
Animations Framer Motion ^12.23.24
Icons Lucide React ^0.548.0
3D Graphics Three.js, React Three Fiber ^0.181.0
Font Inter (Google Fonts) -

Design System

  • Primary Color: WSO2 Orange (#FF7300)
  • Dark Mode: Class-based switching with system preference detection
  • Responsive: Mobile-first with md: tablet and lg: desktop breakpoints

πŸ“ Project Structure

frontend/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ globals.css          # Global styles and Tailwind imports
β”‚   β”œβ”€β”€ layout.tsx           # Root layout with providers
β”‚   β”œβ”€β”€ page.tsx             # Homepage
β”‚   β”œβ”€β”€ not-found.tsx        # 404 page
β”‚   β”œβ”€β”€ 500/                 # Server error page
β”‚   β”œβ”€β”€ about/               # About page
β”‚   β”œβ”€β”€ account/             # User account pages (12+)
β”‚   β”œβ”€β”€ admin/               # Admin dashboard (17+)
β”‚   β”œβ”€β”€ blog/                # Blog listing and posts
β”‚   β”œβ”€β”€ builder-quiz/        # System builder quiz
β”‚   β”œβ”€β”€ builderbot/          # AI chat assistant
β”‚   β”œβ”€β”€ cart/                # Shopping cart
β”‚   β”œβ”€β”€ checkout/            # Checkout flow
β”‚   β”œβ”€β”€ compare/             # Product comparison
β”‚   β”œβ”€β”€ components/          # Reusable React components
β”‚   β”œβ”€β”€ contact/             # Contact page
β”‚   β”œβ”€β”€ deals/               # Deals and promotions
β”‚   β”œβ”€β”€ faq/                 # FAQ page
β”‚   β”œβ”€β”€ financing/           # Financing options
β”‚   β”œβ”€β”€ gallery/             # Community build gallery
β”‚   β”œβ”€β”€ login/               # Login page
β”‚   β”œβ”€β”€ signup/              # Registration page
β”‚   β”œβ”€β”€ order-confirmation/  # Order success page
β”‚   β”œβ”€β”€ pc-builder/          # 8-step PC builder
β”‚   β”œβ”€β”€ pre-builts/          # Pre-built PCs
β”‚   β”œβ”€β”€ privacy/             # Privacy policy
β”‚   β”œβ”€β”€ product/             # Product details
β”‚   β”œβ”€β”€ returns/             # Returns policy
β”‚   β”œβ”€β”€ search/              # Search results
β”‚   β”œβ”€β”€ stores/              # Store locations
β”‚   β”œβ”€β”€ system-requirements/ # System requirements checker
β”‚   β”œβ”€β”€ terms/               # Terms of service
β”‚   β”œβ”€β”€ testimonials/        # Customer testimonials
β”‚   β”œβ”€β”€ trade-in/            # Trade-in program
β”‚   β”œβ”€β”€ warranty/            # Warranty info
β”‚   └── wishlist/            # Wishlist page
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ api/                 # API client configuration
β”‚   β”œβ”€β”€ data/                # Static data and types
β”‚   └── store/               # Zustand state stores
β”œβ”€β”€ public/                  # Static assets
β”œβ”€β”€ package.json
β”œβ”€β”€ tailwind.config.ts
β”œβ”€β”€ tsconfig.json
└── next.config.ts

πŸš€ Pages/Routes

Core E-Commerce (15+ pages)

Route Description
/ Landing page with Hero, Categories, Featured Products
/pre-builts Pre-built PC systems listing
/product/[category] Components category overview
/product/[category]/[subcategory] Dynamic category pages with filters
/product/[id] Product details with specs, reviews
/search Search results page
/cart Shopping cart
/wishlist Wishlist management
/compare Side-by-side product comparison (max 4)
/checkout 4-step checkout process
/order-confirmation/[id] Order success page

Advanced Features

Route Description
/pc-builder 8-step PC builder wizard with compatibility checking
/builderbot AI chat interface for build recommendations
/builder-quiz Multi-step system builder quiz
/gallery Community build gallery
/gallery/[id] Build detail pages

User Account (12+ pages)

Route Description
/account Profile dashboard
/account/orders Order history
/account/track Order tracking (visual timeline)
/account/addresses Saved addresses CRUD
/account/payment-methods Payment methods CRUD
/account/reviews User reviews management
/account/builds Saved PC builds
/account/invoices Download invoices
/account/notifications Notifications inbox
/account/rewards Loyalty rewards and tiers
/account/recently-viewed Browsing history
/account/settings Account settings

Admin Dashboard (17+ pages)

Route Description
/admin Dashboard with KPIs, recent orders, low stock alerts
/admin/orders Orders management
/admin/products Products management
/admin/stock Stock management with quick-edit
/admin/reviews Review moderation
/admin/analytics Revenue charts, top products
/admin/settings Store settings
/admin/categories Category management
/admin/customers Customer list
/admin/promotions Discount codes and deals
/admin/invoices Invoice tracking
/admin/stores Store locations management
/admin/rma Returns management
/admin/support Support tickets
/admin/inventory-alerts Low stock alerts
/admin/bulk Bulk import/export
/admin/abandoned-carts Abandoned carts tracking

Static/Marketing Pages

Route Description
/about Company mission, values, story
/contact Contact form with map
/privacy Privacy policy (GDPR/CCPA)
/terms Terms of service
/returns Returns policy
/faq FAQ accordion
/deals Deals and promotions
/blog Blog listing with categories
/testimonials Customer testimonials
/financing Payment plans and financing
/gift-cards Gift cards (placeholder)

πŸ”§ Configuration

Environment Variables

Variable Required Default Description
NEXT_PUBLIC_API_URL No http://localhost:8080 Backend API gateway URL

next.config.ts

const nextConfig = {
  output: 'standalone',
  images: {
    remotePatterns: [
      { protocol: 'https', hostname: '**' },
    ],
  },
}

πŸ“¦ State Management

Zustand Stores (lib/store/)

Store Purpose Persistence
themeStore.ts Dark/light mode toggle βœ… localStorage
userStore.ts User auth, addresses, payment methods, notifications βœ… localStorage
cartStore.ts Shopping cart items with stock validation βœ… localStorage
wishlistStore.ts Wishlist items βœ… localStorage
compareStore.ts Product comparison (max 4) βœ… localStorage
productStore.ts Products, categories, orders, reviews, saved builds ❌
orderStore.ts Order creation and fetching ❌
adminStore.ts Admin dashboard metrics ❌

πŸ”Œ API Integration

API Client (lib/api/client.ts)

  • Uses Axios with base URL from NEXT_PUBLIC_API_URL
  • Request interceptor: Adds JWT Bearer token from localStorage
  • Response interceptor: Handles 401 unauthorized errors

Backend Endpoints Used

Category Endpoints
Auth /api/auth/login, /api/auth/register
Users /api/users/me, /api/users/me/addresses, /api/users/me/payment-methods
Products /api/products, /api/products/{id}, /api/products/categories
Cart /api/cart, /api/cart/items, /api/cart/clear
Orders /api/orders, /api/orders/{id}
Wishlist /api/wishlist, /api/wishlist/builds
AI /api/ai/builder-bot
Analytics /api/analytics/dashboard, /api/analytics/top-products

πŸƒ Getting Started

Prerequisites

  • Node.js 20.9.0+
    • Recommend using nvm (Node Version Manager):
      curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
      # Restart terminal or source ~/.bashrc
      nvm install 20
      nvm use 20
  • npm or yarn
  • Backend services running (see Backend README)

Development

# Navigate to frontend directory
cd frontend

# Install dependencies
npm install

# Start development server
npm run dev

# Open http://localhost:3000

Production Build

# Build for production
npm run build

# Start production server
npm start

Docker

# Build Docker image
docker build -t cs02-frontend .

# Run container
docker run -p 3000:3000 \
  -e NEXT_PUBLIC_API_URL=http://api-gateway:8080 \
  cs02-frontend

Available Scripts

npm run dev      # Development server with hot reload
npm run build    # Production build
npm run start    # Start production server
npm run lint     # Run ESLint
npm run prepare  # Setup Husky git hooks

βœ… Features - Completion Status

Feature Category Status Items
Core E-Commerce βœ… 100% Product listing, search, cart, wishlist, checkout
PC Builder βœ… 100% 8-step wizard, compatibility checking, save builds
BuilderBot AI βœ… 100% Natural language parsing, recommendations
User Account βœ… 100% 12/12 pages (profile, orders, addresses, rewards, etc.)
Admin Dashboard βœ… 100% 17/17 pages (orders, products, stock, analytics, etc.)
Static Pages βœ… 100% About, contact, privacy, terms, FAQ, returns
Error Pages βœ… 100% 404, 500, 403
Dark Mode βœ… 100% Class-based switching, persistence
Responsive Design βœ… 100% Mobile, tablet, desktop breakpoints
Stock Awareness βœ… 100% System-wide out-of-stock handling

Overall Completion: ~95% βœ…

❌ Not Implemented / Future Enhancements

Feature Priority Notes
Gift cards purchase page Low Placeholder exists
Trade-in form page Low Link exists, page needed
Warranty registration page Low Link exists, page needed
Unit/integration tests Medium Jest/React Testing Library
E2E tests Medium Playwright/Cypress
Real image optimization Low Currently placeholders
PWA support Low Service worker, offline

πŸ”— Related Services

πŸ“ Notes

  • Frontend runs on port 3000
  • Requires backend API Gateway on port 8080
  • Uses Next.js App Router (not Pages Router)
  • Standalone output mode for Docker deployment
  • Theme toggle persists in localStorage
  • Auth token stored in localStorage
  • Demo credentials available for testing

About

Frontend of the Computer Services E-Commerce platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages