A modern, production-grade e-commerce frontend built with React 19, TypeScript, and Tailwind CSS v4. This application provides a complete shopping experience with admin management capabilities.
- Product Catalog: Browse products with advanced filtering, search, and sorting
- Product Details: Comprehensive product pages with image galleries and reviews
- Shopping Cart: Persistent cart with quantity management and real-time updates
- Wishlist: Save products for later with easy management
- User Authentication: Secure login/signup with JWT token management
- User Account: Profile management, order history, and address book
- Checkout Flow: Multi-step checkout with payment integration
- Responsive Design: Mobile-first design with excellent UX
- Dashboard: Analytics overview with charts and key metrics
- Product Management: Complete CRUD operations for products and categories
- Order Management: Process orders, update status, track shipments
- User Management: Manage customer accounts and permissions
- Coupon System: Create and manage promotional codes
- Banner Management: Control homepage banners and promotional content
- TypeScript: Full type safety throughout the application
- React 19: Latest React features with concurrent rendering
- Tailwind CSS v4: Modern styling with custom design system
- React Query: Efficient server state management with caching
- Zustand: Lightweight client state management
- Error Handling: Comprehensive error boundaries and user feedback
- Performance: Lazy loading, code splitting, and optimization
- Testing: Unit and integration tests with Vitest
- Accessibility: WCAG compliant with proper ARIA attributes
- Frontend: React 19, TypeScript, Vite
- Styling: Tailwind CSS v4, Lucide React Icons
- State Management: Zustand, React Query
- Forms: React Hook Form, Zod validation
- Routing: React Router v7
- Testing: Vitest, Testing Library, jsdom
- Build: Vite with TypeScript compilation
- Linting: ESLint with TypeScript support
- Node.js 18+
- pnpm (recommended) or npm
# Clone the repository
git clone <repository-url>
cd frontend
# Install dependencies
pnpm install
# Copy environment variables
cp .env.example .env.local
# Configure environment variables
# Edit .env.local with your API endpoints and keys
# Start development server
pnpm devCreate a .env.local file with:
VITE_API_BASE_URL=http://localhost:3000/api
VITE_APP_NAME=Electronics Store
VITE_APP_VERSION=1.0.0
VITE_STRIPE_PUBLISHABLE_KEY=pk_test_xxxxx
VITE_GOOGLE_ANALYTICS_ID=G-XXXXXXXXXX# Development
pnpm dev # Start development server
pnpm build # Build for production
pnpm preview # Preview production build
# Testing
pnpm test # Run tests in watch mode
pnpm test:run # Run tests once
pnpm test:ui # Run tests with UI
pnpm test:coverage # Run tests with coverage
# Code Quality
pnpm lint # Run ESLint
pnpm typecheck # Run TypeScript checks
pnpm format # Format code with Prettier
# Utilities
pnpm clean # Clean build artifactssrc/
βββ components/ # Reusable UI components
β βββ ui/ # Base UI components
β βββ forms/ # Form components
β βββ layout/ # Layout components
β βββ charts/ # Chart components
β βββ error/ # Error handling components
β βββ performance/ # Performance components
βββ pages/ # Page components
βββ hooks/ # Custom React hooks
βββ stores/ # Zustand stores
βββ services/ # API services
βββ types/ # TypeScript type definitions
βββ utils/ # Utility functions
βββ constants/ # Application constants
βββ test/ # Testing utilities
The project includes comprehensive testing setup:
- Unit Tests: Individual components and functions
- Integration Tests: Component interactions and user flows
- Accessibility Tests: ARIA attributes and screen reader support
# Run all tests
pnpm test
# Run tests with UI dashboard
pnpm test:ui
# Run tests with coverage report
pnpm test:coverage
# Run specific test file
pnpm test ProductCard.test.tsx- Components: Unit tests for all UI components
- Pages: Integration tests for major user flows
- Hooks: Custom hook testing with proper mocking
- Utils: Utility function testing with edge cases
# Build the application
pnpm build
# Preview the build
pnpm preview-
Vercel (Recommended)
# Install Vercel CLI npm i -g vercel # Deploy vercel --prod
-
Netlify
# Build and deploy pnpm build netlify deploy --prod --dir=dist -
Docker
# Build Docker image docker build -t electronics-store . # Run container docker run -p 80:80 electronics-store
See DEPLOYMENT.md for detailed deployment instructions.
- Code Splitting: Route-based and component-based splitting
- Lazy Loading: Images and components loaded on demand
- Bundle Analysis: Built-in bundle size monitoring
- Caching: Aggressive caching for static assets
- Tree Shaking: Unused code elimination
- Lighthouse Score: 95+ across all categories
- First Contentful Paint: < 1.5s
- Largest Contentful Paint: < 2.5s
- Cumulative Layout Shift: < 0.1
- Content Security Policy: Prevents XSS attacks
- Input Validation: Zod schemas for all forms
- Authentication: Secure JWT token handling
- HTTPS: Enforced in production
- Environment Variables: Secure configuration management
- WCAG 2.1 AA: Compliant accessibility standards
- Keyboard Navigation: Full keyboard support
- Screen Reader: Proper ARIA labels and descriptions
- Color Contrast: Meets accessibility contrast ratios
- Focus Management: Logical focus order and visible focus indicators
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Make your changes and add tests
- Run tests:
pnpm test:run - Run linting:
pnpm lint - Commit your changes:
git commit -m 'Add new feature' - Push to the branch:
git push origin feature/new-feature - Submit a pull request
- Follow TypeScript best practices
- Write tests for new features
- Maintain accessibility standards
- Use conventional commit messages
- Keep components small and focused
The frontend integrates with a REST API providing:
- Product management endpoints
- User authentication and management
- Order processing and tracking
- Payment integration
- Analytics and reporting
See api-req-response.md for complete API documentation.
-
Build Failures
# Clear cache and reinstall pnpm clean rm -rf node_modules pnpm install -
Type Errors
# Run type checking pnpm typecheck -
Test Failures
# Update snapshots if needed pnpm test -- --update-snapshots
-
Performance Issues
# Analyze bundle size pnpm build:analyze
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the repository
- Check the troubleshooting section
- Review the deployment guide
- PWA support with offline functionality
- Advanced analytics dashboard
- Multi-language support (i18n)
- Dark mode theme
- Advanced search with AI recommendations
- Real-time notifications
- Voice search integration
- Mobile app with React Native
Built with β€οΈ using modern web technologies for optimal performance and user experience.