A modern, responsive frontend application for the multi-vendor e-commerce platform built with React 18, TypeScript, and Tailwind CSS. This application provides an intuitive interface for customers, vendors, and administrators with a focus on performance, accessibility, and user experience.
- Modern Marketplace: Beautiful product discovery with advanced filtering
- Responsive Design: Optimized for all devices and screen sizes
- Shopping Cart: Persistent cart with real-time updates
- Wishlist: Save favorite products for later
- Order Tracking: Real-time order status updates
- User Reviews: Rate and review products and vendors
- Search & Filter: Advanced product search with multiple filters
- Vendor Dashboard: Comprehensive analytics and performance metrics
- Product Management: Advanced product catalog with bulk operations
- Order Management: Track and manage customer orders
- Inventory Tracking: Real-time stock management with alerts
- Sales Analytics: Detailed sales reports and insights
- Profile Management: Complete vendor profile customization
- System Dashboard: Platform-wide analytics and metrics
- Vendor Management: Approve, reject, and manage vendor applications
- User Management: Comprehensive user administration
- Content Management: Manage categories, products, and content
- System Analytics: Platform performance and usage statistics
- Design System: Consistent, professional design language
- Smooth Animations: Framer Motion powered transitions
- Loading States: Skeleton screens and loading indicators
- Error Handling: User-friendly error messages and fallbacks
- Accessibility: WCAG 2.1 AA compliant components
- Dark Mode: Optional dark theme support
- Node.js (v16 or higher)
- npm or yarn
- Backend API running (see backend README)
-
Clone and navigate to the project:
git clone https://github.com/your-username/multi-vendor-ecommerce cd multi_vendor_ecom-main -
Install dependencies:
npm install # or yarn install -
Environment Setup: Create a
.envfile in the root directory:# API Configuration VITE_API_BASE_URL=http://localhost:5000/api # Cloudinary Configuration VITE_CLOUDINARY_CLOUD_NAME=your_cloud_name VITE_CLOUDINARY_UPLOAD_PRESET=your_upload_preset # App Configuration VITE_APP_NAME=Multi-Vendor Marketplace VITE_APP_VERSION=1.0.0 # Feature Flags VITE_ENABLE_DARK_MODE=true VITE_ENABLE_PWA=true VITE_ENABLE_ANALYTICS=true
-
Start the development server:
npm run dev # or yarn dev -
Open your browser: Navigate to
http://localhost:5173
- Framework: React 18 with TypeScript
- Build Tool: Vite for fast development and optimized builds
- Styling: Tailwind CSS for utility-first styling
- State Management: Redux Toolkit for predictable state management
- Routing: React Router v6 for client-side routing
- Animations: Framer Motion for smooth animations
- Forms: React Hook Form for efficient form handling
- HTTP Client: Axios for API communication
- UI Components: Custom components with Radix UI primitives
src/
โโโ components/ # Reusable UI components
โ โโโ ui/ # Base UI components (Button, Input, etc.)
โ โโโ modern/ # Modern design components
โ โโโ vendor/ # Vendor-specific components
โ โโโ marketplace/ # Marketplace components
โ โโโ Dashboard/ # Dashboard components
โ โโโ Home/ # Homepage components
โ โโโ ErrorBoundary/ # Error handling components
โโโ pages/ # Page components
โ โโโ HomePage/ # Homepage and landing pages
โ โโโ Products/ # Product-related pages
โ โโโ UserDashboard/ # User dashboard pages
โ โโโ LoginPage/ # Authentication pages
โ โโโ ErrorPage/ # Error pages
โโโ redux/ # State management
โ โโโ store.ts # Redux store configuration
โ โโโ hook.ts # Typed hooks
โ โโโ api/ # RTK Query API slices
โ โโโ features/ # Feature-based slices
โโโ utils/ # Utility functions
โโโ types/ # TypeScript type definitions
โโโ hooks/ # Custom React hooks
โโโ lib/ # Third-party library configurations
โโโ assets/ # Static assets
components/
โโโ ui/ # Base components
โ โโโ button.tsx # Reusable button component
โ โโโ input.tsx # Form input component
โ โโโ card.tsx # Card container component
โ โโโ table.tsx # Data table component
โ โโโ badge.tsx # Status badge component
โโโ modern/ # Modern UI components
โ โโโ ModernNavbar.tsx # Navigation component
โ โโโ ModernFooter.tsx # Footer component
โ โโโ ModernBanner.tsx # Hero banner component
โ โโโ ProductCard.tsx # Product display card
โ โโโ ProductGrid.tsx # Product grid layout
โโโ vendor/ # Vendor components
โ โโโ VendorDashboard.tsx # Vendor analytics dashboard
โ โโโ VendorRegistration.tsx # Vendor application form
โ โโโ VendorProductManagement.tsx # Product management interface
โโโ marketplace/ # Marketplace components
โโโ MarketplaceHome.tsx # Marketplace homepage
โโโ VendorDirectory.tsx # Vendor listing page
โโโ ProductCatalog.tsx # Product catalog page
/* Primary Colors */
--primary-50: #eff6ff;
--primary-500: #3b82f6;
--primary-600: #2563eb;
--primary-700: #1d4ed8;
/* Secondary Colors */
--gray-50: #f9fafb;
--gray-100: #f3f4f6;
--gray-500: #6b7280;
--gray-900: #111827;
/* Status Colors */
--success: #10b981;
--warning: #f59e0b;
--error: #ef4444;
--info: #3b82f6;- Font Family: Inter (system fallback)
- Font Sizes: 12px - 48px (responsive scale)
- Font Weights: 400, 500, 600, 700, 800
- Line Heights: 1.2 - 1.8 (contextual)
- Base Unit: 4px
- Scale: 4px, 8px, 12px, 16px, 20px, 24px, 32px, 40px, 48px, 64px
- Breakpoints:
- Mobile: < 768px
- Tablet: 768px - 1024px
- Desktop: > 1024px
interface RootState {
auth: {
user: User | null;
token: string | null;
isAuthenticated: boolean;
loading: boolean;
};
products: {
items: Product[];
filters: ProductFilters;
loading: boolean;
error: string | null;
};
cart: {
items: CartItem[];
total: number;
itemCount: number;
};
vendors: {
list: Vendor[];
current: Vendor | null;
loading: boolean;
};
ui: {
theme: "light" | "dark";
sidebarOpen: boolean;
notifications: Notification[];
};
}// RTK Query API slices
export const authApi = createApi({
reducerPath: "authApi",
baseQuery: fetchBaseQuery({
baseUrl: "/api/auth",
prepareHeaders: (headers, { getState }) => {
const token = (getState() as RootState).auth.token;
if (token) {
headers.set("authorization", `Bearer ${token}`);
}
return headers;
},
}),
tagTypes: ["User"],
endpoints: (builder) => ({
login: builder.mutation<LoginResponse, LoginRequest>({
query: (credentials) => ({
url: "/login",
method: "POST",
body: credentials,
}),
}),
// ... other endpoints
}),
});- Base styles: Mobile (320px+)
- Tablet styles:
md:prefix (768px+) - Desktop styles:
lg:prefix (1024px+) - Large desktop:
xl:prefix (1280px+)
- Minimum touch targets: 44px ร 44px
- Gesture support: Swipe, pinch, tap
- Optimized navigation: Bottom navigation on mobile
- Reduced motion: Respects user preferences
// Route-based code splitting
const HomePage = lazy(() => import("../pages/HomePage/HomePage"));
const ProductPage = lazy(() => import("../pages/Products/ProductsDetails"));
const VendorDashboard = lazy(
() => import("../components/vendor/VendorDashboard")
);
// Component-based code splitting
const HeavyComponent = lazy(() => import("./HeavyComponent"));// Lazy loading with intersection observer
const LazyImage: React.FC<ImageProps> = ({ src, alt, ...props }) => {
const [isLoaded, setIsLoaded] = useState(false);
const [isInView, setIsInView] = useState(false);
const imgRef = useRef<HTMLImageElement>(null);
useEffect(() => {
const observer = new IntersectionObserver(
([entry]) => {
if (entry.isIntersecting) {
setIsInView(true);
observer.disconnect();
}
},
{ threshold: 0.1 }
);
if (imgRef.current) {
observer.observe(imgRef.current);
}
return () => observer.disconnect();
}, []);
return (
<img
ref={imgRef}
src={isInView ? src : undefined}
alt={alt}
onLoad={() => setIsLoaded(true)}
className={`transition-opacity duration-300 ${
isLoaded ? "opacity-100" : "opacity-0"
}`}
{...props}
/>
);
};- Tree shaking: Automatic dead code elimination
- Code splitting: Route and component-based splitting
- Asset optimization: Image compression and format optimization
- Caching: Service worker for offline functionality
- Unit Testing: Vitest + React Testing Library
- Component Testing: Storybook for component development
- E2E Testing: Playwright for end-to-end testing
- Visual Testing: Chromatic for visual regression testing
src/
โโโ __tests__/ # Test files
โ โโโ components/ # Component tests
โ โโโ pages/ # Page tests
โ โโโ utils/ # Utility tests
โ โโโ hooks/ # Custom hook tests
โโโ __mocks__/ # Mock files
โโโ test-utils/ # Testing utilities
# Unit tests
npm run test
npm run test:watch
npm run test:coverage
# E2E tests
npm run test:e2e
npm run test:e2e:ui
# Visual tests
npm run test:visual- JWT tokens: Secure token-based authentication
- Token refresh: Automatic token renewal
- Route protection: Protected routes for authenticated users
- Role-based access: Different access levels for users
- Input sanitization: XSS protection
- HTTPS enforcement: Secure data transmission
- Environment variables: Secure configuration management
- Content Security Policy: CSP headers for additional security
// Language configuration
const resources = {
en: {
translation: {
welcome: "Welcome to our marketplace",
products: "Products",
vendors: "Vendors",
},
},
es: {
translation: {
welcome: "Bienvenido a nuestro mercado",
products: "Productos",
vendors: "Vendedores",
},
},
};
// Usage in components
const { t } = useTranslation();
return <h1>{t("welcome")}</h1>;- Page views: Track page navigation
- User interactions: Button clicks, form submissions
- Performance metrics: Load times, error rates
- Conversion tracking: Purchase funnel analysis
// Analytics service
export const analytics = {
track: (event: string, properties?: Record<string, any>) => {
if (import.meta.env.VITE_ENABLE_ANALYTICS === "true") {
// Send to analytics service
gtag("event", event, properties);
}
},
page: (path: string) => {
if (import.meta.env.VITE_ENABLE_ANALYTICS === "true") {
gtag("config", "GA_MEASUREMENT_ID", {
page_path: path,
});
}
},
};// vite.config.ts
export default defineConfig({
plugins: [
react(),
// PWA plugin for offline functionality
VitePWA({
registerType: "autoUpdate",
workbox: {
globPatterns: ["**/*.{js,css,html,ico,png,svg}"],
},
}),
],
build: {
// Optimize bundle size
rollupOptions: {
output: {
manualChunks: {
vendor: ["react", "react-dom"],
ui: ["@radix-ui/react-dialog", "@radix-ui/react-dropdown-menu"],
},
},
},
},
});{
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint . --ext ts,tsx --fix",
"type-check": "tsc --noEmit",
"test": "vitest",
"test:ui": "vitest --ui",
"test:coverage": "vitest --coverage",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
}
}-
Build the project:
npm run build
-
Deploy to Netlify:
# Using Netlify CLI npm install -g netlify-cli netlify deploy --prod --dir=dist # Or connect GitHub repository in Netlify dashboard
-
Environment Variables: Configure in Netlify dashboard:
VITE_API_BASE_URL=https://your-api-domain.vercel.app/api VITE_CLOUDINARY_CLOUD_NAME=your_cloud_name VITE_CLOUDINARY_UPLOAD_PRESET=your_upload_preset
-
Install Vercel CLI:
npm i -g vercel
-
Deploy:
vercel --prod
- Largest Contentful Paint (LCP): < 2.5s
- First Input Delay (FID): < 100ms
- Cumulative Layout Shift (CLS): < 0.1
- Initial bundle: < 200KB gzipped
- Route chunks: < 100KB gzipped
- Vendor chunks: < 150KB gzipped
- Progressive Web App (PWA) capabilities
- Offline functionality with service workers
- Real-time notifications with WebSockets
- Advanced search with Elasticsearch integration
- Voice search capabilities
- Augmented Reality (AR) product preview
- Social commerce features
- Advanced personalization engine
- Micro-frontend architecture
- Server-side rendering (SSR) with Next.js
- Edge computing with Cloudflare Workers
- Advanced caching strategies
- Performance monitoring with Sentry
- A/B testing framework
- Advanced analytics dashboard
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes with proper testing
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- TypeScript: Strict type checking enabled
- ESLint: Code quality and consistency
- Prettier: Code formatting
- Conventional Commits: Standardized commit messages
- Component Documentation: Storybook stories for components
- Include tests for new features
- Update documentation as needed
- Ensure all tests pass
- Follow the existing code style
- Add screenshots for UI changes
This project is licensed under the MIT License - see the LICENSE file for details.
- React Team: For the amazing React framework
- Tailwind CSS: For the utility-first CSS framework
- Framer Motion: For smooth animations
- Radix UI: For accessible UI primitives
- Vite Team: For the fast build tool
- Open Source Community: For the incredible ecosystem
- ๐ง Email: frontend-support@yourplatform.com
- ๐ Documentation: Component Library
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
- ๐จ Design System: Storybook
Built with โค๏ธ for the modern web