Features Β· Tech Stack Β· Getting Started Β· Deployment Β· Environment Variables Β· Screenshots
Bazarmart is a production-ready e-commerce web application featuring a modern customer storefront and a full-featured admin operations suite. It supports multiple payment methods, real-time order management, loyalty tracking, AI-powered chat assistance, and a rich analytics dashboard β all built on the MERN stack.
- Responsive storefront and mobile-optimized navigation
- Technical SEO foundations: canonical tags, Open Graph tags, Twitter tags, structured data,
robots.txt, andsitemap.xml - Production-oriented checkout with Stripe card flow, COD, JazzCash, and EasyPaisa
- Professional admin panel for products, orders, users, coupons, analytics, and tracking
- Route-level lazy loading and vendor chunk splitting for better frontend performance
- Quality checks already applied: lint cleanup, build verification, and end-to-end QA pass
| Feature | Details |
|---|---|
| Authentication | JWT-based register / login / logout with secure HTTP-only cookies |
| Product Catalog | Search, filter by category & price, pagination |
| Product Details | Image gallery, ratings, customer reviews, shoe size/color selection |
| Shopping Cart | Persistent cart with quantity management |
| Wishlist | Save products for later |
| Checkout Flow | Shipping β Order Confirmation β Payment |
| Payment Methods | Credit/Debit Card (Stripe), Cash on Delivery, JazzCash, EasyPaisa |
| Order Confirmation Email | Automatic email receipt sent via SMTP (Nodemailer) |
| Order History | View all orders with real-time status tracking |
| Invoice Download | Generate PDF invoices via jsPDF |
| Returns | Submit and track return requests |
| Loyalty Points | Earn points on purchases, redeem for discounts |
| Coupons | Apply discount codes at checkout |
| AI Chatbot | Built-in support assistant |
| PWA Support | Installable as a Progressive Web App |
| Feature | Details |
|---|---|
| Dashboard Analytics | Revenue charts, order stats, top products (Recharts) |
| Product Management | Full CRUD β create, edit, delete, manage stock, shoe color/size options |
| Order Management | View, update status (Processing β Shipped β Delivered) |
| User Management | View all registered users, assign roles |
| Coupon Management | Create and manage discount codes |
| Stock Alerts | Low-stock notifications |
| Activity Logs | Track admin actions across the platform |
| Export | Export orders to CSV |
- Server-side input validation & sanitization
- Rate limiting on all API endpoints (200 req/min global, stricter on login)
- Role-based access control (user / admin)
- Wallet payment number validation (regex enforced server-side)
- No sensitive data exposed in API responses
| Layer | Technology |
|---|---|
| Frontend | React 19, Vite 8, React Router v7, Axios |
| Styling | Plain CSS (custom design system) |
| State / Auth | React Context API, JWT, HTTP-only cookies |
| Backend | Node.js, Express 4, ES Modules |
| Database | MongoDB, Mongoose 8 |
| Auth | JWT (jsonwebtoken), bcryptjs |
| Payments | Stripe (card), local wallet simulation (JazzCash / EasyPaisa) |
| Nodemailer (SMTP) | |
| Charts | Recharts |
| jsPDF + jspdf-autotable | |
| Icons | React Icons |
| Notifications | React Hot Toast |
| Linting | ESLint 9 (0 errors, 0 warnings) |
| PWA | Service Worker + Web Manifest |
Ecom-Web/
βββ backend/ # Express API server
β βββ config/ # Database connection
β βββ controllers/ # Route handlers (MVC)
β βββ middleware/ # Auth, error handling, rate limiting
β βββ models/ # Mongoose schemas
β βββ routes/ # Express routers
β βββ utils/ # Utilities (email, error classes)
β βββ seed.js # Database seeder
β βββ app.js # Express app setup
β βββ server.js # Server entry point
β
βββ frontend/ # React + Vite SPA
β βββ public/ # Static assets, PWA manifest, service worker
β βββ src/
β βββ assets/ # Images
β βββ components/ # Reusable components (Header, Footer, etc.)
β βββ context/ # AuthContext
β βββ hooks/ # Custom hooks
β βββ pages/ # Page components + admin sub-pages
β
βββ .gitignore
βββ .env.example # (see backend/.env.example)
βββ LICENSE
βββ README.md
- Node.js v18 or higher
- MongoDB β local instance or Atlas cluster
- A Stripe account (for card payments β test mode works)
git clone https://github.com/YOUR_USERNAME/bazarmart.git
cd bazarmartcd backend
cp .env.example .envOpen backend/.env and fill in your values (see Environment Variables).
cd backend
npm install
cd ../frontend
npm installcd backend
npm run seedThis creates sample products and two default accounts:
| Role | Password | |
|---|---|---|
| Admin | admin@ecomweb.com |
admin123 |
| Customer | john@example.com |
password123 |
β οΈ Change these credentials before any public deployment.
Backend (runs on port 5000):
cd backend
npm run devFrontend (runs on port 5173):
cd frontend
npm run devOpen http://localhost:5173 in your browser.
- Build command:
npm run build - Output directory:
frontend/dist - Suitable hosts: Vercel, Netlify, Cloudflare Pages, Firebase Hosting
- Start command:
npm start - Suitable hosts: Render, Railway, Cyclic, VPS, Azure App Service
- Add production MongoDB URI
- Set secure JWT secret and cookie expiry
- Configure Stripe production keys if using live card payments
- Configure SMTP credentials if using order emails
- Update
FRONTEND_URLin backend environment variables - Replace the sample domain in
frontend/public/robots.txtandfrontend/public/sitemap.xml - Change seeded demo credentials before launch
All environment variables live in backend/.env. A documented template is provided in backend/.env.example.
| Variable | Required | Description |
|---|---|---|
MONGO_URI |
β | MongoDB connection string |
JWT_SECRET |
β | Long random string for signing JWTs |
JWT_EXPIRE |
β | JWT lifetime e.g. 7d |
COOKIE_EXPIRE |
β | Auth cookie lifetime in days |
PORT |
β | API server port (default 5000) |
NODE_ENV |
β | development or production |
FRONTEND_URL |
β | Frontend origin for CORS (default http://localhost:5173) |
STRIPE_SECRET_KEY |
β | Stripe secret key (card payments) |
STRIPE_PUBLISHABLE_KEY |
β | Stripe publishable key (sent to frontend) |
SMTP_HOST |
β | SMTP host for order emails |
SMTP_PORT |
β | SMTP port (default 587) |
SMTP_USER |
β | SMTP username / email address |
SMTP_PASSWORD |
β | SMTP password / app password |
EMAIL_FROM |
β | Sender display name + address |
Order confirmation emails are optional β the checkout flow works normally if SMTP vars are not set.
Base URL: http://localhost:5000/api/v1
| Resource | Method | Endpoint | Auth |
|---|---|---|---|
| Auth | POST | /users/register |
β |
| POST | /users/login |
β | |
| GET | /users/logout |
User | |
| GET | /users/me |
User | |
| PUT | /users/me/update |
User | |
| Products | GET | /products |
β |
| GET | /products/:id |
β | |
| POST | /products |
Admin | |
| PUT | /products/:id |
Admin | |
| DELETE | /products/:id |
Admin | |
| Orders | POST | /orders |
User |
| GET | /orders/me |
User | |
| GET | /orders/:id |
User | |
| GET | /orders |
Admin | |
| PUT | /orders/:id/status |
Admin | |
| Payments | GET | /payment/stripe-key |
User |
| POST | /payment/process/stripe |
User | |
| POST | /payment/process/local |
User | |
| Reviews | POST | /reviews |
User |
| GET | /reviews/product/:id |
β | |
| Wishlist | GET | /wishlist |
User |
| POST | /wishlist/:productId |
User | |
| DELETE | /wishlist/:productId |
User | |
| Coupons | POST | /coupons/apply |
User |
| POST | /coupons |
Admin | |
| Analytics | GET | /activity-logs |
Admin |
Add screenshots before publishing the repo. A good professional set is:
- Home page hero
- Product listing page
- Product detail page
- Cart and checkout flow
- Admin dashboard
| Storefront | Product Detail |
|---|---|
| (screenshot) | (screenshot) |
| Cart & Checkout | Admin Dashboard |
|---|---|
| (screenshot) | (screenshot) |
cd frontend
npm run buildThe optimised static files are output to frontend/dist/. Serve them via Nginx, Vercel, Netlify, or any static host. Point your frontend host to the deployed backend API URL by setting VITE_API_URL (if configured) or updating the Axios base URL.
See CONTRIBUTING.md for contribution guidelines, branch naming, and pull request expectations.
If you discover a security issue, see SECURITY.md before disclosing it publicly.
Distributed under the MIT License. See LICENSE for details.