A modern open-source e-commerce application built with React, TypeScript, and Vite, using DummyJSON API for product data.
- Product Catalog: Browse all products with pagination
- Category Navigation: Filter products by categories
- Product Search: Search functionality across all products
- Product Details: Individual product pages with images, reviews, and pricing
- Shopping Basket: Add/remove items with persistent storage
- Price Display: Formatted pricing with discount calculations
- File-based routing with TanStack Router
- Dynamic routes for products and categories
- Search functionality with URL parameters
- Zustand for basket state management
- Persistent storage using localStorage
- React Query for server state and caching
- Responsive design with Tailwind CSS
- Loading states with spinners
- Toast notification system for user feedback
- Error handling and user feedback
- Material Symbols icons
- Custom components library with enhanced Button component
- User Menu Dropdown: Interactive menu for logged-in users with My Account, Order History, and Logout options
- Order History Display: Full order history with expandable details showing items, shipping, and payment info
- Product Filters: Sort by name/price/rating and filter by minimum rating
- React 19 - UI framework
- TypeScript - Type safety
- Vite - Build tool and dev server
- Tailwind CSS 4 - Styling framework
- @tanstack/react-router - File-based routing
- @tanstack/react-query - Server state management
- Zustand - Client state management
- Zod - Schema validation and data safety
- @vitejs/plugin-react-swc - Fast refresh with SWC
- ESLint - Code linting
- Prettier - Code formatting
- TypeScript ESLint - TypeScript-specific linting
- Vitest - Unit testing framework
- pnpm - Package manager
src/
βββ api/ # API layer (products, auth)
β βββ auth/ # Authentication endpoints (login, me, logout)
β βββ products/ # Product endpoints (getProducts, etc.)
βββ routes/ # File-based routes
β βββ auth/ # Authentication routes (login, my-account)
β βββ checkout/ # Checkout routes (index, order-confirmation)
β βββ product/ # Individual product pages
β βββ products/ # Product listing pages
βββ stores/ # Zustand stores
β βββ basket/ # Shopping basket state
β βββ order/ # Order state and history
β βββ toast/ # Toast notification state
β βββ user/ # User state (empty - using context instead)
βββ types/ # TypeScript type definitions
βββ ui/ # UI components and styles
β βββ components/# Reusable components (Button, Login, Basket, Toast, etc.)
βββ utils/ # Utility functions (price, date formatting)
βββ main.tsx # App entry point
The app follows a modular architecture with clear separation of concerns:
- API Layer (
src/api/): Handles all external data fetching - Routes (
src/routes/): File-based routing with TanStack Router - Stores (
src/stores/): Client-side state management with Zustand - Components (
src/ui/components/): Reusable UI components - Types (
src/types/): TypeScript interfaces for type safety
- Change Base URL: Update
vite.config.tsproxy configuration:
proxy: {
'/api': {
target: 'https://your-api.com',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}-
Update API Functions: Modify functions in
src/api/to match your backend: -
Update Type Definitions: Modify
src/types/index.d.tsto match your data contracts:
- New Routes: Add files to
src/routes/(auto-generated routing) - New API Endpoints: Create functions in
src/api/ - New State: Add stores in
src/stores/ - New Components: Add to
src/ui/components/
# Install dependencies
pnpm install
# Start development server
pnpm dev
# Build for production
pnpm build
# Preview production build
pnpm preview
# Lint code
pnpm lint
# Format code
pnpm format
# Run tests
pnpm testThe app uses DummyJSON API with a proxy configuration:
- Base URL:
https://dummyjson.com/ - Proxy:
/apiroutes are proxied to the base URL - Endpoints: Products, categories, search, authentication
The app is configured for Netlify deployment with:
- _redirects file: Handles API proxy and SPA routing in production
- API Proxy:
/api/*routes redirect tohttps://dummyjson.com/ - SPA Support: All routes serve
index.htmlfor client-side routing
/- Homepage with categories and top products/products/all- All products listing/products/search- Search results/products/$category- Category-specific products/product/$productSku- Individual product details/basket- Shopping basket/auth/login- User login/auth/my-account- User profile/checkout- Complete 3-step checkout process/checkout/order-confirmation- Order confirmation with full details
Overall Completion: ~85% β¬οΈ (Updated December 2025)
- β User Menu Dropdown: Replaced static user name with interactive dropdown menu
- β Order History UI: Full order history display with expandable details
- β Product Filters: Added sorting (name/price/rating) and rating filter
- β Bug Fixes: Fixed order history persistence, removed non-functional features
- β Code Quality: TypeScript strict mode, all type checks passing
-
Fix Authentication Flow β
- β
Update
my-account.tsx- remove token parameter fromme()call - β Implement logout functionality (using login with 0 expiry)
- β Add silent error handling for expected 401s during auth checks
- β
Update
-
Complete Missing API Functions β
- β
Implement
logout.tsfunction - β Add proper error handling to all API calls
- β
Implement
-
Security Enhancements β
- β Fixed SSRF vulnerabilities in API layer
- β
Refactored
getProductsandgetCategoriesto use structured parameters - β Added Zod schema validation for all API responses
- β Implemented data transformation for Date fields
-
User Account Management β
- β
Build user profile display in
my-account.tsx - β Add user data fetching and display
- β Optimize API calls with context passing
- β Add date formatting utility
- β Global auth context for shared state
- β Dynamic UI based on auth state (Login component)
- β Protected routes with beforeLoad guards
- β Implement account settings/preferences - TODO
- β
Build user profile display in
-
Checkout Process β FULLY IMPLEMENTED!
- β Complete CheckoutForm component with 3-step flow (shipping β payment β review)
- β Shipping form with Zod validation
- β Payment form with card validation
- β Review step before order placement
- β Order confirmation page with full details
- β Order store with localStorage persistence
- β Cart summary display in sidebar
- β Guest and logged-in user support
- β Input component for forms
- β Validation schemas (shipping, billing, payment)
-
Form Validation β
- β Zod installed and integrated in dependencies
- β Zod validation for API responses
- β Enhanced Button component with disabled state
- β Error messages in all forms
- β Loading states in components
-
Navigation & State β
- β Show login/logout states in header (Login component)
- β Basket persists across sessions (localStorage)
- β Order history persists in localStorage
-
User Feedback β
- β Toast notification system implemented with Zustand
- β Success notifications (green) when adding products to basket
- β Error notifications (red) when removing products from basket
- β Auto-dismiss notifications after 3 seconds
- β Image error handling with fallback placeholders
- β Enhanced Button component with disabled state support
-
Fix Critical Security Issues β
- β Implemented CSRF protection in API calls
- β Zod validation for API responses to prevent malicious data
- β Improved error handling in auth API calls
- β Runtime data validation with Zod schemas
- β Add input sanitization for user inputs - TODO
-
Expand Test Coverage
β οΈ - β Unit tests for utility functions (price, date formatting)
- β Add tests for auth API functions - TODO
- β Test protected route behavior - TODO
- β Add integration tests for login flow - TODO
- β Add component tests - TODO
-
Error Handling & Performance β
- β Global error boundaries implemented (ErrorFallback, ErrorInfo)
- β Proper API error handling in auth functions
- β User-friendly error recovery UI
- β Development vs production error displays
- β Review performance in utility functions - TODO
- β Add network error recovery - TODO
- β User Menu Dropdown: Interactive dropdown when logged in with navigation to My Account, Order History, and Logout
- β Order History UI: Complete order history display with expandable order details, persisted in localStorage
- β Product Filters: Sort by name/price/rating and filter by minimum rating with URL parameter persistence
- β Wishlist functionality - TODO
- β Product reviews/ratings submission (data exists, no form) - TODO
- β Mobile responsive improvements
- Use environment variables for sensitive configuration
- Implement proper CORS policies
- Add rate limiting for API endpoints
- Validate and sanitize all user inputs
Sorry for not doing TDD! π I promise the code works... mostly... probably... please don't break it
This is currently a Proof of Concept focusing on technology implementation. We're looking for collaborators to help improve:
Design & UX
- UI/UX Designer to create a cohesive design system
- Improve visual hierarchy and user experience
- Mobile-first responsive design improvements
- Accessibility enhancements
Frontend Development
- Component library expansion
- Animation and micro-interactions
- Performance optimizations
- Advanced filtering and search features
Backend Integration
- Real API integration beyond DummyJSON
- Authentication and user management
- Payment processing integration
- Order management system
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and add tests
- Run tests:
pnpm test - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
Contact: Open an issue to discuss ideas or reach out for collaboration opportunities!