A modern B2B marketplace platform connecting raw material suppliers with vendors through a seamless, real-time commerce experience.
RawMate is a sophisticated B2B marketplace platform designed to streamline the sourcing and distribution of raw materials. The platform facilitates real-time transactions between suppliers (sellers) and vendors (buyers), offering a comprehensive suite of features including product management, order processing, real-time inventory tracking, and supplier reviews.
- Product Discovery: Browse and search a comprehensive catalog of raw materials from multiple suppliers
- Supplier Comparison: Compare offerings, pricing, and ratings across different suppliers
- Shopping Cart: Add products to cart with real-time quantity management and synchronization
- Order Management: Track incoming and historical orders with status updates and detailed information
- Supplier Reviews: Leave ratings and reviews based on product quality, delivery time, and service
- Account Management: Maintain business profile, contact information, and preferences
- Real-time Notifications: Stay updated on order status changes and supplier communications
- Product Management: Create, edit, and manage product listings with pricing and availability
- Order Processing: Receive and process incoming orders from vendors with order details
- Inventory Management: Track product stock and availability in real-time
- Performance Analytics: View supplier ratings and customer reviews to improve service quality
- Account Management: Manage business profile, contact information, and bank details
- Business Insights: Monitor sales performance and vendor interactions
- Dual Role Authentication: Secure login system for both vendors and suppliers with email verification
- Role-Based Access Control: Separate dashboards and features tailored to each user role
- Real-Time Data Synchronization: Account updates propagate instantly across the platform
- Responsive Design: Fully responsive UI optimized for desktop and mobile devices
- Dark Mode Support: Built-in theme switching for comfortable viewing
- Form Validation: Comprehensive validation with real-time user feedback
- Error Handling: Graceful error handling with informative user messages
- Framework: React 18.3 - Modern UI library with hooks and concurrent rendering
- Build Tool: Vite 5.4 - Lightning-fast build tool and dev server
- Language: TypeScript 5.5 - Type-safe JavaScript
- Routing: React Router 6.26 - Client-side routing and navigation
- Form Management: React Hook Form 7.53 - Performant form validation
- State Management: TanStack Query 5.56 - Server state management and caching
- UI Components: shadcn/ui - High-quality, accessible React components
- Styling: Tailwind CSS 3.4 - Utility-first CSS framework
- Icons: Lucide React 0.462 - Beautiful, consistent icon library
- Charts: Recharts 2.12 - Composable charting library
- Database: Supabase - PostgreSQL-based BaaS platform
- Authentication: Supabase Auth with email-based signup and verification
- Real-time Features: Supabase Realtime for instant data synchronization
- Row-Level Security (RLS): PostgreSQL policies for data access control
- Form Validation: Zod 3.23 - TypeScript-first schema validation
- Accessibility: Radix UI - Primitive components with accessibility built-in
- Animations: Tailwind CSS Animate
- Notifications: Sonner 1.5 - Toast notifications
- Command Palette: cmdk 1.0 - Fast command menu
RawMate/
βββ src/
β βββ pages/ # Page components
β β βββ vendor/ # Vendor (buyer) pages
β β β βββ VendorDashboard.tsx
β β β βββ BrowseProducts.tsx
β β β βββ Cart.tsx
β β β βββ MyOrders.tsx
β β β βββ CompareSuppliers.tsx
β β β βββ VendorReviews.tsx
β β β βββ AccountSettings.tsx
β β βββ supplier/ # Supplier (seller) pages
β β β βββ SupplierDashboard.tsx
β β β βββ MyProducts.tsx
β β β βββ AddProduct.tsx
β β β βββ EditProduct.tsx
β β β βββ IncomingOrders.tsx
β β β βββ SupplierReviews.tsx
β β β βββ AccountSettings.tsx
β β βββ Welcome.tsx # Landing page
β β βββ VendorLogin.tsx # Vendor login
β β βββ SupplierLogin.tsx # Supplier login
β β βββ Index.tsx # Main entry point
β βββ components/
β β βββ layouts/ # Layout components
β β βββ ui/ # shadcn/ui components
β β βββ AuthForm.tsx # Authentication form
β β βββ VendorLayout.tsx # Vendor layout wrapper
β β βββ SupplierLayout.tsx # Supplier layout wrapper
β β βββ VendorSidebar.tsx # Navigation sidebar
β β βββ SupplierSidebar.tsx # Navigation sidebar
β βββ contexts/ # React Context API contexts
β β βββ CartContext.tsx # Shopping cart state
β βββ hooks/ # Custom React hooks
β β βββ useAuth.ts # Authentication logic
β β βββ useProducts.ts # Product data fetching
β β βββ useOrders.ts # Order data fetching
β β βββ useSuppliers.ts # Supplier data fetching
β βββ lib/ # Utility functions
β βββ integrations/ # Third-party integrations
β βββ assets/ # Images, fonts, etc.
β βββ App.tsx # Main app component
β βββ main.tsx # Entry point
β βββ index.css # Global styles
βββ supabase/
β βββ config.toml # Supabase configuration
β βββ migrations/ # Database migrations
βββ public/ # Static assets
βββ vite.config.ts # Vite configuration
βββ tailwind.config.ts # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
βββ package.json # Dependencies and scripts
βββ eslint.config.js # ESLint configuration
- Node.js: v18.0.0 or higher
- Bun: v1.0.0 or higher (or npm/yarn as alternatives)
- Git: Latest version
-
Clone the repository
git clone <repository-url> cd RawMate
-
Install dependencies
bun install # or npm install # or yarn install
-
Configure environment variables
Create a
.env.localfile in the project root with your Supabase credentials:VITE_SUPABASE_URL=your_supabase_project_url VITE_SUPABASE_ANON_KEY=your_supabase_anon_key
Get these values from your Supabase project settings.
-
Start the development server
bun run dev # or npm run devThe application will be available at
http://localhost:8080
bun run build:dev
# or
npm run build:devbun run build
# or
npm run buildbun run preview
# or
npm run previewbun run lint
# or
npm run lintVendor (Buyer)
- Browse and purchase raw materials
- Manage orders and payments
- Leave supplier reviews
- Compare supplier offerings
Supplier (Seller)
- List and manage products
- Process incoming orders
- Receive customer reviews
- Track sales performance
- User selects role (Vendor or Supplier) on login page
- Email-based authentication with Supabase Auth
- Email verification for new accounts
- JWT token-based session management
- Automatic role-based routing to appropriate dashboard
- Row-Level Security (RLS): PostgreSQL policies ensure users can only access their own data
- Email Verification: Prevents unauthorized account creation
- Type Safety: TypeScript prevents common security vulnerabilities
- Secure Token Storage: JWT tokens managed securely by Supabase
- Input Validation: Zod schema validation on all forms
The application uses PostgreSQL via Supabase with the following main entities:
- Users: Authentication and profile information (vendors and suppliers)
- Products: Product listings managed by suppliers
- Orders: Purchase orders from vendors to suppliers
- Cart Items: Shopping cart management for vendors
- Reviews: Supplier reviews and ratings from vendors
Database migrations are stored in supabase/migrations/ and can be applied via the Supabase dashboard or CLI.
- Component Library: shadcn/ui with Radix UI primitives
- Styling: Tailwind CSS utility classes
- Responsiveness: Mobile-first design approach
- Accessibility: WCAG 2.1 AA compliance with semantic HTML
- Light mode (default)
- Dark mode support via
next-themes - Configurable in
tailwind.config.ts
- TypeScript: Strict mode enabled for type safety
- ESLint: Configured for React and TypeScript best practices
- Formatting: Use IDE formatting on save
import React from 'react';
import { Button } from '@/components/ui/button';
interface MyComponentProps {
title: string;
onClick?: () => void;
}
export const MyComponent: React.FC<MyComponentProps> = ({
title,
onClick
}) => {
return (
<div>
<h1>{title}</h1>
<Button onClick={onClick}>Click me</Button>
</div>
);
};Using React Hook Form with Zod validation:
import { useForm } from 'react-hook-form';
import { zodResolver } from '@hookform/resolvers/zod';
import { z } from 'zod';
const schema = z.object({
email: z.string().email(),
password: z.string().min(8),
});
export const MyForm = () => {
const { register, handleSubmit, formState: { errors } } = useForm({
resolver: zodResolver(schema),
});
return (
<form onSubmit={handleSubmit((data) => console.log(data))}>
<input {...register('email')} />
{errors.email && <span>{errors.email.message}</span>}
</form>
);
};Using TanStack Query (React Query):
import { useQuery } from '@tanstack/react-query';
export const useProducts = () => {
return useQuery({
queryKey: ['products'],
queryFn: async () => {
const { data, error } = await supabase
.from('products')
.select('*');
if (error) throw error;
return data;
},
});
};Currently, the project uses manual testing. Consider adding:
- Unit Tests: Jest with React Testing Library
- E2E Tests: Playwright or Cypress for user flows
- Integration Tests: API testing with Supabase
Issue: Port 8080 is already in use
# Kill the process using port 8080
lsof -ti:8080 | xargs kill -9Issue: Users can't log in
- Verify Supabase credentials in
.env.local - Check that email verification is enabled in Supabase settings
- Ensure database migrations have been applied
Issue: Products or orders not showing
- Verify Row-Level Security policies in Supabase
- Check browser console for errors
- Ensure user is properly authenticated
- Verify data exists in the Supabase dashboard
Issue: TypeScript compilation errors
# Clear cache and reinstall
rm -rf node_modules
bun install
bun run build- React Documentation
- TypeScript Handbook
- Vite Guide
- Supabase Documentation
- React Router Documentation
- Tailwind CSS Documentation
We welcome contributions to RawMate! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Use clear, descriptive commit messages
- Prefix with type:
feat:,fix:,docs:,style:,refactor:,test: - Example:
feat: add product search functionality
Made with β€οΈ by the RawMate team