Complete e-commerce platform for automotive parts with multi-role support (Admin, Seller, Customer).
- Frontend: React + Vite + TailwindCSS + React Router
- Backend: Node.js + Express.js
- Database: PostgreSQL (Supabase)
- Storage: Supabase Storage (Images)
- Auth: JWT + bcrypt
- Deployment: Vercel (Frontend) + Render (Backend)
- Browse products by category and brand
- Search and filter products
- Shopping cart management
- Wishlist
- Order history
- Product reviews
- Product management (CRUD)
- Image upload (up to 5 images per product)
- Inventory tracking
- Category management
- Sales dashboard
- User management
- Full product oversight
- Category and brand management
- Order management
- Node.js 18+ or Bun
- Supabase account
- Git
- Go to supabase.com
- Create new project
- Wait for database to initialize
- Go to Supabase Dashboard → SQL Editor
- Copy contents of
database/supabase-schema.sql - Paste and click Run
- Verify 11 tables created in Table Editor
- Go to Storage in Supabase Dashboard
- Click New bucket
- Name:
product-images - Check Public bucket ✓
- Click Create bucket
- Go to Settings → API
- Copy:
- Project URL
anonpublic keyservice_rolesecret key
cd backend
# Install dependencies
bun install
# or: npm install# Create environment file
cp .env.template .env
# Edit .env with your Supabase credentials
nano .envConfigure .env:
PORT=3000NODE_ENV=developmentJWT_SECRET=your-random-secret-key-hereSUPABASE_URL=https://your-project.supabase.coSUPABASE_SERVICE_KEY=your-service-role-keyTest database connection:
bun run test-dbCreate admin user:
bun run create-adminDefault credentials: manny@carfixve.app / r00tr00t
Start backend:
bun run dev
# or: npm run devBackend runs on http://localhost:3000
cd frontend
# Install dependencies
bun install
# or: npm install# Create environment file
cp .env.template .env
# Edit .env
nano .envConfigure .env:
VITE_API_URL=http://localhost:3000Start frontend:
bun run dev
# or: npm run devFrontend runs on http://localhost:5173
- Open
http://localhost:5173 - Login with admin credentials
- Create categories and brands
- Add products with images
- Test customer features
Create Web Service:
- Repository: Your GitHub repo
- Branch:
master - Root Directory:
backend - Build Command:
bun install - Start Command:
bun run start
Environment Variables:
NODE_ENV=production JWT_SECRET=your-production-secret SUPABASE_URL=https://your-project.supabase.co SUPABASE_SERVICE_KEY=your-service-role-keyDeploy and copy your Render URL
Import Project:
- Connect GitHub repository
- Framework: Vite
- Root Directory:
frontend
Environment Variables:
VITE_API_URL=https://your-backend.onrender.com⚠️ Important: Do NOT include/apiat the endDeploy
carfix-mono/
├── backend/
│ ├── config/ # Database configuration
│ ├── middleware/ # Auth & validation
│ ├── routes/ # API routes
│ ├── scripts/ # Utility scripts
│ ├── index.js # Main server file
│ ├── package.json
│ └── .env.template
├── frontend/
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── contexts/ # React contexts
│ │ ├── pages/ # Page components
│ │ ├── api.js # API client
│ │ └── App.jsx
│ ├── package.json
│ └── .env.template
└── database/
├── supabase-schema.sql # Database schema
└── (test scripts)
bun run dev # Start development server
bun run start # Start production server
bun run test-db # Test database connection
bun run create-admin # Create admin userbun run dev # Start development server
bun run build # Build for production
bun run preview # Preview production build- ✅
.envfiles are gitignored - ✅ Never commit API keys or secrets
- ✅ Use strong JWT secrets in production
- ✅ Change default admin password after first login
- ✅ Service role key only used in backend
- ✅ CORS enabled for frontend domain
POST /api/auth/login- User loginPOST /api/auth/register- User registrationGET /api/auth/validate- Validate JWT token
GET /api/products- List all productsPOST /api/products- Create product (Seller)PUT /api/seller/products/:id- Update product (Seller)DELETE /api/seller/products/:id- Delete product (Seller)
GET /api/categories- List categoriesPOST /api/categories- Create category (Seller)GET /api/brands- List brands
GET /api/cart- Get user cartPOST /api/cart- Add to cartPUT /api/cart/:id- Update cart itemDELETE /api/cart/:id- Remove from cartGET /api/orders- Get user orders
- Verify Supabase credentials in
.env - Check if schema is applied:
bun run test-db - Ensure service_role key is used (not anon key)
- Verify
product-imagesbucket exists in Supabase Storage - Check bucket is set to public
- Ensure backend has correct SUPABASE_SERVICE_KEY
- Check
VITE_API_URLin frontend.env - Ensure backend is running
- Verify CORS is enabled in backend
- Check browser console for errors
- Verify JWT_SECRET matches between requests
- Check token expiration (24 hours default)
- Clear localStorage and login again
ISC
- Admin: Full system access
- Seller: Product and category management
- Customer: Browse, purchase, review
The database includes:
- Users (with role-based access)
- Products & Product Images
- Categories & Brands
- Orders & Order Items
- Cart & Wishlist
- Reviews & Notifications
All tables include soft delete support and timestamps.
For issues or questions, check the troubleshooting section or review the code comments.