You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Go to Supabase Dashboard → SQL Editor and run supabase/seed.sql.
4. Start development servers
# Terminal 1 — Backendcd server
npm run dev
# Runs on http://localhost:4000# Terminal 2 — Frontendcd frontend
npm run dev
# Runs on http://localhost:3000
5. Test the API
# Health check
curl http://localhost:4000/api/health
# Get categories
curl http://localhost:4000/api/categories
# Get products
curl http://localhost:4000/api/products
# Register
curl -X POST http://localhost:4000/api/auth/register \
-H "Content-Type: application/json" \
-d '{"email":"[email protected]","password":"test123","fullName":"Test User"}'
API Endpoints
Public
Method
Path
Description
GET
/api/health
Health check
GET
/api/categories
All categories (cached)
GET
/api/products
Product listing (search, filter, paginate)
GET
/api/products/:slug
Product detail (cached)
Auth
Method
Path
Description
POST
/api/auth/register
Register new user
POST
/api/auth/login
Login (returns JWT)
POST
/api/auth/refresh
Refresh access token
POST
/api/auth/logout
Logout (clear cookies)
GET
/api/auth/me
Current user profile
Buyer (requires auth)
Method
Path
Description
GET
/api/cart
Get cart
POST
/api/cart/items
Add item to cart
PATCH
/api/cart/items/:variantId
Update quantity
DELETE
/api/cart/items/:variantId
Remove item
GET
/api/addresses
List addresses
POST
/api/addresses
Create address
POST
/api/checkout
Place order
GET
/api/orders
Order history
GET
/api/orders/:id
Order detail
Admin (requires admin role)
Method
Path
Description
GET
/api/admin/dashboard
Dashboard stats
GET/POST
/api/admin/products
List/Create products
PATCH/DELETE
/api/admin/products/:id
Update/Delete product
GET/POST
/api/admin/categories
List/Create categories
PATCH/DELETE
/api/admin/categories/:id
Update/Delete category
GET
/api/admin/orders
All orders
PATCH
/api/admin/orders/:id/status
Update order status
GET
/api/admin/users
List users
Delivery Partner (requires delivery_partner role)
Method
Path
Description
GET
/api/delivery/dashboard
Delivery stats
GET
/api/delivery/orders
Assigned orders
PATCH
/api/delivery/orders/:id/status
Update delivery status
Deployment
Docker (recommended)
docker-compose up --build
Manual
Backend (Render/Railway):
cd server
npm run build
npm start
Frontend (Vercel):
cd frontend
# Set NEXT_PUBLIC_API_URL to your deployed backend URL# Deploy via Vercel CLI or GitHub integration
Environment Variables for Production
Set NODE_ENV=production on the server
Set FRONTEND_URL to your production frontend domain
Use strong, unique JWT secrets (generate with openssl rand -hex 32)