A full-stack e-commerce web app (Amazon/Flipkart-like) focused on selling tech/electronics accessories (keyboards, mice, CPUs, laptops, etc.) with RBAC for:
- Admin (owners / middle-man company): cannot register; can only login using credentials from
.env - Seller (franchise product sellers): can register + login; manage only their products and see product orders/reviews
- Customer (end users): can register + login; browse, cart, direct purchase, rate + review purchased items
- Node.js 18+
- MongoDB (local or Atlas)
npm installCreate server/.env using server/.env.example:
cp server/.env.example server/.envCreate client/.env using client/.env.example:
cp client/.env.example client/.envnpm run seednpm run dev:serverOpen a second terminal:
npm run dev:clientAdmins are defined in server/.env as comma-separated email:password:
[email protected]:Admin@123,[email protected]:Owner@123
Register from the UI. Sellers can create products; customers can buy/review.
server/Express + MongoDB + JWT + RBAC APIsclient/React (Vite) + Tailwind UI
Repository: https://github.com/RamzanKhansLab/COSMOS-TECH
- Build client: npm run build
- Set server NODE_ENV=production and CORS_ORIGIN to your domain
- Start server: npm run start
If older products have broken/remote image URLs, run:
�ash npm run fix:images -w server \r\n
This repo is set up for a single Render Web Service:
- React is built to client/dist
- Express serves the static build when NODE_ENV=production
- Build Command: pm install && npm run build
- Start Command: pm run start
Set these in Render Dashboard → Environment:
- NODE_ENV=production
- PORT=10000
- MONGODB_URI=... (MongoDB Atlas)
- JWT_SECRET=...
- ADMIN_CREDS=email:password,email2:password2
- CORS_ORIGIN=https://.onrender.com
For a single-service deployment, the frontend calls the backend at the same domain.
- Set VITE_API_URL to empty in the Render environment (or build with it empty) so requests go to /api.
Tip: A ender.yaml blueprint is included at ender.yaml.