AABHAR is a production-grade, full-featured jewellery e-commerce platform built as a monorepo with a React 18 SPA frontend and a Node.js/Express REST API backend. It delivers a luxury shopping experience complete with an AI-powered chatbot, smart email campaigns, a full-featured admin dashboard with role-based access control, and seamless Indian payment integration via Razorpay.
"AABHAR" — a gratitude for craftsmanship, elegance, and artistry in every piece.
🛍️ Customer Experience
| Feature | Description |
|---|---|
| 💍 Product Catalogue | Browse jewellery with filters by metal type, category, price, and availability |
| 🔍 Smart Search | Full-text search with real-time suggestions across the product catalogue |
| 🛒 Cart & Checkout | Persistent cart synced server-side, streamlined checkout with address management |
| 💳 Razorpay Payments | Cards, UPI, Net Banking, EMI, and Cash on Delivery — all with payment verification |
| ❤️ Wishlist & Saved | Save favourites, share wishlists via unique links |
| 📦 Order Tracking | Real-time order status from confirmed → packed → shipped → delivered |
| 🔔 Notifications | In-app + SMS (Fast2SMS) alerts for every order status change |
| 🤖 AI Chatbot | Groq LLaMA-powered customer support with OpenRouter fallback |
| ⚡ Flash Sales | Time-limited offers with countdown timers |
| 📋 Bulk Orders | Request form for wholesale/bulk jewellery orders |
| 📝 Blog | Rich-text blog powered by React-Quill |
| 🌗 Dark Mode | System-preference aware theme toggle |
| ⌨️ Keyboard Shortcuts | Power-user command palette (CommandPalette) |
| 🍪 Cookie Consent | GDPR-compliant consent banner |
⚙️ Admin Dashboard
| Feature | Description |
|---|---|
| 📊 Analytics Dashboard | Sales reports, revenue charts, customer metrics |
| 🏪 Product Management | Full CRUD with Cloudinary image upload, image enhancement via Sharp |
| 📋 Order Management | View, update, and process orders; download PDF invoices |
| 👥 Customer Management | View customer profiles, segment analysis, birthday tracking |
| 🏷️ Coupon & Promo Codes | Create discount campaigns with rule-based validation |
| 📧 Email Center | Template editor, campaign scheduler, send history |
| 🔐 Roles & Permissions | Granular RBAC — create roles, assign per-resource permissions |
| ⚡ Flash Sale Manager | Schedule time-limited promotions |
| 💬 Testimonials | Approve/reject customer testimonials |
| ❓ FAQ Management | CRUD for FAQ entries |
| 📰 Blog Admin | Rich-text post editor and publisher |
| 📜 Audit Logs | Structured request and system logs |
| 🎯 Customer Segmentation | Auto-segments customers by behaviour (scheduled) |
📬 Email & Marketing Automation
| Feature | Description |
|---|---|
| ✉️ Brevo Integration | Transactional email via REST API (300 emails/day free tier) |
| 🎂 Birthday Emails | Automated personalised birthday greetings + offers |
| 📣 Newsletter Campaigns | Scheduled email campaigns with unsubscribe management |
| 🔧 Template Engine | HTML email template builder in admin panel |
| 📊 Email Preferences | Granular per-user email opt-in/out controls |
| 👤 Customer Segmentation | Behaviour-based segmentation for targeted campaigns |
┌────────────────────────────────────────────────────────────────┐
│ AABHAR Platform │
├─────────────────────────┬──────────────────────────────────────┤
│ FRONTEND (SPA) │ BACKEND (REST API) │
│ React 18 + Vite 2 │ Node.js + Express.js │
│ │ │
│ ┌─────────────────┐ │ ┌──────────┐ ┌───────────────┐ │
│ │ React Router │ │ │ Routes │ │ Controllers │ │
│ │ 22 Pages │◄───┼────│ /api/* │ │ 21 handlers │ │
│ │ 14 Admin Pages │ │ │ 27 files │ │ │ │
│ └────────┬────────┘ │ └────┬─────┘ └──────┬────────┘ │
│ │ │ │ │ │
│ ┌────────▼────────┐ │ ┌────▼──────────────▼────────┐ │
│ │ Context API │ │ │ Middleware │ │
│ │ Auth / Cart │ │ │ JWT Auth │ RBAC │ Upload │ │
│ │ Theme / RBAC │ │ └────────────────────────────┘ │
│ └─────────────────┘ │ │
│ │ ┌──────────────────────────────┐ │
│ ┌─────────────────┐ │ │ Services │ │
│ │ apiFetch() │ │ │ Email │ Cloudinary │ Payment │ │
│ │ API wrapper │ │ │ SMS │ Chatbot │ Logger │ │
│ └─────────────────┘ │ └──────────────┬───────────────┘ │
│ │ │ │
├─────────────────────────┤ ┌──────────────▼───────────────┐ │
│ DEPLOYMENT │ │ MySQL Database │ │
│ Vercel (Frontend) │ │ Connection Pool (×10) │ │
│ Backend → Cloud Server │ └──────────────────────────────┘ │
└─────────────────────────┴──────────────────────────────────────┘
Browser → apiFetch(JWT) → Vite Proxy → Express Routes
→ authMiddleware (JWT verify)
→ permissionMiddleware (RBAC DB lookup)
→ Controller → MySQL / Cloudinary / Razorpay
→ JSON response back to React Context → UI re-render
AABHAR implements a JWT + Role-Based Access Control system:
Public Routes → No auth required (products, blog, FAQs)
Authenticated User → JWT Bearer token required (cart, orders, profile)
Admin Role → role === 'admin' + ProtectedRoute guard
RBAC Permissions → Per-resource (read / write / edit / delete)
Super Admin → Bypasses all permission checks
Tokens are issued on login, stored in localStorage, and verified on every protected request by authMiddleware.js.
Granular permissions are stored in the roles table and checked via permissionMiddleware.js.
| Layer | Technology | Version |
|---|---|---|
| ⚛️ UI Framework | React | 18.2 |
| ⚡ Build Tool | Vite | 2.9 |
| 🛣️ Client Routing | React Router DOM | 6.20 |
| 🎨 Icons | Lucide React | 0.294 |
| ✏️ Rich Text | React Quill | 2.0 |
| 🖥️ Runtime | Node.js | ≥14.0 |
| 🚂 API Server | Express.js | 4.18 |
| 🗄️ Database | MySQL + mysql2 | — |
| 🔐 Auth | JWT + bcryptjs | 9.0 / 2.4 |
| 📁 File Uploads | Multer + Sharp | — |
| ☁️ Image CDN | Cloudinary | 2.8 |
| 💳 Payments | Razorpay | 2.9 |
| Brevo REST API | — | |
| 📱 SMS | Fast2SMS | — |
| 🤖 AI Chatbot | Groq (LLaMA 3.1) | — |
| ⏰ Scheduler | node-cron | 4.2 |
| 🚀 Deploy | Vercel (frontend) | — |
- Node.js ≥ 14.0.0
- MySQL 8.x running locally or a cloud MySQL host
- npm (comes with Node.js)
git clone https://github.com/your-username/aabhar-jewellery.git
cd aabhar-jewelleryBackend — backend/.env
# Server
PORT=5000
NODE_ENV=development
# Database
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=jewelry_shop
# Authentication
JWT_SECRET=your_super_secret_jwt_key_here
JWT_EXPIRES_IN=7d
# Cloudinary
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
# Razorpay
RAZORPAY_KEY_ID=rzp_test_xxxxxxxxxxxx
RAZORPAY_KEY_SECRET=your_razorpay_secret
# Brevo Email
BREVO_API_KEY=xkeysib-xxxxxxxxxxxxxxxxxxxxxxxx
BREVO_FROM_EMAIL=[email protected]
SMTP_FROM_NAME=AABHAR
# Fast2SMS
SMS_API_KEY=your_fast2sms_api_key
SMS_ENABLED=true
SMS_DEV_MODE=true # Set false in production
# Groq AI Chatbot
GROQ_API_KEY=gsk_xxxxxxxxxxxxxxxxxxxx
# OpenRouter (AI Fallback)
OPENROUTER_KEY_1=sk-or-xxxxxxxxxxxx
OPENROUTER_KEY_2=sk-or-xxxxxxxxxxxxFrontend — frontend/.env
VITE_API_URL=http://localhost:5000cd backend
npm install
# Seed the database with sample data
node seed.js
# Create your first admin account
node create_admin.js
# Start the API server
npm start
# → API running on http://localhost:5000cd frontend
npm install
npm run dev
# → App running on http://localhost:5173http://localhost:5173 → Customer storefront
http://localhost:5173/admin → Admin dashboard (requires admin login)
http://localhost:5000/api/health → API health check
All endpoints are prefixed with /api/. Protected routes require Authorization: Bearer <token> header.
Authentication Routes
POST /api/auth/send-signup-otp Send OTP to register
POST /api/auth/verify-signup-otp Verify OTP + create account
POST /api/auth/login Login → returns JWT token
POST /api/auth/forgot-password Send password reset OTP
POST /api/auth/reset-password Set new password with OTP
GET /api/auth/profile Get current user profile (auth)
PUT /api/auth/profile Update profile (auth)
Products & Catalogue
GET /api/products List products (public, filterable)
GET /api/products/:id Get single product detail (public)
POST /api/products Create product (admin)
PUT /api/products/:id Update product (admin)
DELETE /api/products/:id Delete product (admin)
POST /api/products/:id/images Upload product images (admin)
Cart & Orders
GET /api/cart Get cart items (auth)
POST /api/cart Add item to cart (auth)
PUT /api/cart/:id Update quantity (auth)
DELETE /api/cart/:id Remove item (auth)
DELETE /api/cart Clear cart (auth)
GET /api/orders List user orders (auth)
POST /api/orders Place order (auth)
GET /api/orders/:id Order detail (auth)
PUT /api/orders/:id/status Update order status (admin)
Payment
POST /api/payment/create-order Create Razorpay order
POST /api/payment/verify Verify payment signature (HMAC-SHA256)
GET /api/payment/:id Payment details
POST /api/payment/refund Process full/partial refund (admin)
Admin & Management
GET /api/admin/customers List all customers
GET /api/admin/reports Sales & revenue analytics
GET /api/admin/email/campaigns List email campaigns
POST /api/admin/email/campaigns Create campaign
GET /api/admin/roles List roles + permissions
POST /api/admin/roles Create role
PUT /api/admin/roles/:id Update permissions
GET /api/flash-sales List flash sales
POST /api/flash-sales Create flash sale (admin)
GET /api/chatbot AI chatbot message (public)
GET /api/health Health check (public)
aabhar-jewellery/ Monorepo Root
│
├── backend/ Node.js REST API
│ ├── server.js Express app bootstrap + route mounting
│ ├── config/db.js MySQL connection pool (mysql2)
│ ├── controllers/ 21 business logic handlers
│ ├── middleware/ JWT auth · RBAC · Multer upload · Logger
│ ├── routes/ 27 RESTful resource route files
│ ├── services/ 10 service integrations
│ │ ├── emailService.js Brevo email delivery
│ │ ├── cloudinaryService.js Cloudinary image management
│ │ ├── razorpayService.js Payment processing
│ │ ├── smsService.js Fast2SMS notifications
│ │ ├── chatbotService.js Groq AI + OpenRouter fallback
│ │ └── imageEnhancementService.js Sharp image processing
│ ├── scheduler/ 3 background cron jobs
│ │ ├── birthdayScheduler.js Automated birthday emails
│ │ ├── campaignScheduler.js Email campaign dispatch
│ │ └── segmentationScheduler.js Customer segmentation
│ └── middleware/
│ ├── authMiddleware.js JWT verification
│ └── permissionMiddleware.js RBAC permission checks
│
└── frontend/ React 18 SPA
├── vite.config.js Dev proxy → localhost:5000
└── src/
├── App.jsx Provider tree + all routes
├── config/api.js apiFetch() API wrapper
├── context/ 5 React Context providers
│ ├── AuthContext.jsx JWT + user state
│ ├── CartContext.jsx Cart synced with backend
│ ├── ThemeContext.jsx Light/dark theme
│ └── PermissionContext.jsx RBAC map
├── pages/ 22 customer pages
├── pages/admin/ 14 admin panel pages
└── components/ Reusable UI components
├── layout/ Header + Footer shell
├── Chatbot/ Floating AI chat widget
├── CartSidebar.jsx Slide-out cart drawer
├── ProtectedRoute.jsx Auth + permission guard
└── SEO.jsx Helmet-based meta tags
|
RESTful resource endpoints |
22 customer + 14 admin views |
External integration modules |
Background automation jobs |
AABHAR
│
├── 💳 Razorpay Payment gateway (Cards, UPI, Net Banking, EMI, COD)
│ └── HMAC-SHA256 signature verification on every payment
│
├── ☁️ Cloudinary Image CDN (product images, logos, email assets)
│ └── Auto quality/format optimization · Delete by public ID
│
├── 📧 Brevo Transactional + marketing email (REST API)
│ └── OTP · Order updates · Birthday campaigns · Newsletters
│
├── 📱 Fast2SMS SMS notifications (India — 10-digit mobile)
│ └── Order status templates: confirmed · packed · shipped · delivered
│
├── 🤖 Groq (LLaMA 3.1) Primary AI chatbot (temperature 0.7, max 500 tokens)
│ └── Restricted to jewellery shop context via system prompt
│
├── 🔀 OpenRouter AI chatbot fallback (LLaMA 3.2 free tier)
│ └── Dual API keys for redundancy
│
└── 🚀 Vercel Frontend hosting with SPA rewrite config
npm start # Start production API server
node seed.js # Seed database with demo products & users
node create_admin.js # Create the first admin account interactivelynpm run dev # Start Vite dev server on port 5173
npm run build # Build for production → dist/
npm run preview # Preview production buildContributions are welcome! Here's how to get started:
- Fork the repository
- Create your feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'feat: add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
Please follow the existing code conventions:
- Backend: camelCase functions,
try/catchin all controller handlers,res.status(N).json({ message })for errors - Frontend: PascalCase components,
apiFetch()for all API calls, Context API for shared state
Distributed under the MIT License. See LICENSE for more information.