Skip to content

Sanjoy-droid/Product-Explorer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Product Explorer Dashboard

A production-ready, feature-rich e-commerce product explorer built with Next.js 16, TypeScript, and Tailwind CSS. This application demonstrates modern React patterns, clean architecture, and exceptional user experience.

✨ Features

Core Features

  • πŸ“¦ Product Listing - Responsive grid layout with beautiful product cards
  • πŸ” Real-time Search - Debounced search with instant filtering
  • 🏷️ Category Filtering - Dynamic category filters from API
  • πŸ’° Price Sorting - Sort products by price (Low to High / High to Low)
  • πŸ“„ Pagination - Navigate through products with page controls
  • ❀️ Favorites System - Mark products as favorites with localStorage persistence
  • πŸ”” Toast Notifications - Real-time feedback for favorite toggle actions
  • πŸ“± Responsive Design - Mobile-first design that works on all devices
  • 🎨 Modern UI/UX - Beautiful gradients, shadows, and smooth animations
  • ⚑ Performance Optimized - Image optimization, lazy loading, and efficient rendering
  • πŸ”„ Loading States - Elegant skeleton loaders and loading indicators
  • ❌ Error Handling - Comprehensive error boundaries and user-friendly error messages

Technical Highlights

  • TypeScript - Fully typed for maximum type safety
  • Next.js App Router - Latest Next.js 16 with dynamic routing
  • Component Architecture - Reusable, maintainable components
  • Custom Hooks - Encapsulated state management logic
  • Toast Notifications - React Hot Toast for user feedback
  • Clean Code - Well-organized folder structure and naming conventions
  • Accessibility - ARIA labels and keyboard navigation support

πŸ—οΈ Project Structure

next-cart/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ layout.tsx              # Root layout with metadata
β”‚   β”œβ”€β”€ page.tsx                # Home page with product listing
β”‚   β”œβ”€β”€ globals.css             # Global styles and Tailwind
β”‚   β”œβ”€β”€ favicon.ico             # App favicon
β”‚   β”œβ”€β”€ order-placed/
β”‚   β”‚   └── page.tsx            # Order confirmation page
β”‚   └── products/
β”‚       └── [id]/
β”‚           └── page.tsx        # Dynamic product detail page
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ui/
β”‚   β”‚   └── Slider.tsx          # Slider/carousel component
β”‚   β”œβ”€β”€ FavoriteButton.tsx      # Favorite toggle button
β”‚   β”œβ”€β”€ ProductCard.tsx         # Product card component
β”‚   β”œβ”€β”€ ProductGrid.tsx         # Product grid layout
β”‚   β”œβ”€β”€ ProductFilters.tsx      # Filter sidebar with price sorting
β”‚   β”œβ”€β”€ SearchBar.tsx           # Debounced search input
β”‚   └── LoadingSkeleton.tsx     # Loading state skeleton
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ types.ts                # TypeScript type definitions
β”‚   β”œβ”€β”€ api.ts                  # API client functions
β”‚   └── utils.ts                # Utility functions
β”œβ”€β”€ hooks/
β”‚   └── useFavorites.ts         # Favorites management hook
β”œβ”€β”€ public/                      # Static assets
β”œβ”€β”€ README.md                    # Project documentation
β”œβ”€β”€ package.json                 # Dependencies and scripts
β”œβ”€β”€ package-lock.json           # Dependency lock file
β”œβ”€β”€ tsconfig.json               # TypeScript configuration
β”œβ”€β”€ next.config.ts              # Next.js configuration
β”œβ”€β”€ postcss.config.mjs          # PostCSS configuration
β”œβ”€β”€ eslint.config.mjs           # ESLint configuration
└── components.json             # Components configuration

πŸš€ Getting Started

Prerequisites

  • Node.js 18+ and npm/yarn/pnpm
  • Basic knowledge of React and Next.js

Installation

  1. Install dependencies:
npm install
# or
yarn install
# or
pnpm install
  1. Run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
  1. Open your browser: Navigate to http://localhost:3000

Building for Production

npm run build
npm run start

πŸ“¦ Dependencies

Current dependencies as per package.json:

{
  "dependencies": {
    "next": "16.1.1",
    "react": "19.2.3",
    "react-dom": "19.2.3",
    "lucide-react": "^0.562.0",
    "react-hot-toast": "^2.6.0",
    "clsx": "^2.1.1",
    "tailwind-merge": "^3.4.0"
  },
  "devDependencies": {
    "@tailwindcss/postcss": "^4",
    "@types/node": "^20",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "typescript": "^5",
    "tailwindcss": "^4",
    "eslint": "^9",
    "eslint-config-next": "16.1.1"
  }
}

🎨 Key Components

ProductCard

Beautiful, interactive product cards with:

  • High-quality image display
  • Favorite button overlay with toast feedback
  • Category badges
  • Rating display
  • Hover animations

ProductFilters

Comprehensive filtering system:

  • Category selection
  • Price sorting (Low to High / High to Low)
  • Favorites-only toggle
  • Active filter indicators
  • Smooth transitions

SearchBar

Debounced search input:

  • 300ms debounce for performance
  • Clear button
  • Real-time filtering
  • Accessible labels

Slider (UI Component)

Reusable slider/carousel component:

  • Smooth animations
  • Touch-friendly navigation
  • Customizable styling
  • Located in components/ui/ for shared UI elements

Pagination

Intuitive pagination controls:

  • Previous/Next navigation
  • Current page indicator
  • Disabled states for boundary pages
  • Responsive design

Toast Notifications

Real-time user feedback powered by React Hot Toast:

  • Success messages for adding favorites
  • Informative messages for removing favorites
  • Customizable styling
  • Auto-dismiss functionality

useFavorites Hook

Custom hook for favorites management:

  • localStorage persistence
  • Optimistic updates
  • Type-safe operations
  • Loading state handling
  • Toast notification integration

🎯 API Integration

The app uses the Fake Store API for product data:

  • GET /products - Fetch all products
  • GET /products/:id - Fetch single product
  • GET /products/categories - Fetch categories

πŸ“± Responsive Breakpoints

  • Mobile: < 640px (1 column)
  • Tablet: 640px - 1024px (2 columns)
  • Desktop: 1024px - 1280px (3 columns)
  • Large Desktop: > 1280px (4 columns)

🎨 Design Features

  • Gradient Backgrounds - Modern blue/purple gradients
  • Glass Morphism - Subtle backdrop blur effects
  • Smooth Animations - Transform and transition effects
  • Shadow Depth - Layered shadow system
  • Color Palette - Consistent blue/purple theme
  • Typography - Inter font for clean readability
  • Toast Notifications - Elegant, non-intrusive feedback

πŸ”§ Configuration Files

tailwind.config.ts

import type { Config } from "tailwindcss";

const config: Config = {
  content: [
    "./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
    "./src/components/**/*.{js,ts,jsx,tsx,mdx}",
    "./src/app/**/*.{js,ts,jsx,tsx,mdx}",
  ],
  theme: {
    extend: {},
  },
  plugins: [],
};
export default config;

tsconfig.json

{
  "compilerOptions": {
    "target": "ES2017",
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "bundler",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "paths": {
      "@/*": ["./src/*"]
    }
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
  "exclude": ["node_modules"]
}

πŸš€ Performance Optimizations

  • Image Optimization - Next.js Image component with proper sizing
  • Debounced Search - Prevents excessive re-renders
  • Memoization - useMemo for filtered products
  • Lazy Loading - Images load as needed
  • Code Splitting - Automatic route-based splitting
  • Caching - API responses cached with revalidation
  • Pagination - Reduces DOM load by limiting visible products

πŸ†• New Features

1. Pagination System

  • Navigate through products with previous/next controls
  • Displays current page number
  • Configurable items per page
  • Smooth transitions between pages

2. Price Filtering

  • Sort by Price: Low to High - View cheapest products first
  • Sort by Price: High to Low - View most expensive products first
  • Integrated with existing filters and search

3. Toast Notifications

  • Real-time feedback when adding/removing favorites
  • Non-intrusive, auto-dismissing notifications
  • Customizable styling matching the app theme
  • Powered by react-hot-toast library

πŸ” Best Practices Implemented

  • βœ… TypeScript strict mode
  • βœ… No any types
  • βœ… Proper error handling
  • βœ… Accessible components
  • βœ… SEO-friendly metadata
  • βœ… Mobile-first responsive design
  • βœ… Clean folder structure
  • βœ… Reusable components
  • βœ… Custom hooks for logic separation
  • βœ… Loading and error states
  • βœ… User feedback with toast notifications
  • βœ… Efficient pagination implementation

πŸŽ“ Learning Highlights

This project demonstrates:

  • Modern React patterns (hooks, composition)
  • Next.js 16 App Router and dynamic routing
  • TypeScript best practices
  • API integration and error handling
  • State management without libraries
  • localStorage for persistence
  • Responsive design principles
  • Performance optimization techniques
  • User experience enhancements (toasts, pagination)
  • Price sorting and filtering logic

πŸ“„ License

MIT License - feel free to use this project for learning or as a portfolio piece!

πŸ™Œ Acknowledgments


Built with ❀️ using Next.js 16, TypeScript, and Tailwind CSS

About

A web app that displays a list of products with filtering, detailed views, and a simple client-side state feature.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors