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=3000
NODE_ENV=development
JWT_SECRET=your-random-secret-key-here
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_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-key -
Deploy 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 end -
Deploy
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.