✨━━━━━━━━━━━━━━━━━━━ ❖ ━━━━━━━━━━━━━━━━━━━✨
✔ JWT Authentication (Access + Refresh Tokens)
✔ Admin-only Product Management
✔ Cloudinary Image Uploads (upload_stream)
✔ Redis Caching (Products + Single Product)
✔ Advanced Search, Filters, Sort + Pagination
✔ Full Cart & Order System
✔ Stock Deduction Logic
✔ Enterprise Security Middleware
✔ Clean Modular Architecture
🔗 API URL: https://production-ecommerce-api.onrender.com
📁 GitHub Repo: https://github.com/Ashishjha013/production-ecommerce-api
- Cloudinary
upload_streamfor efficient image handling - Query-aware Redis caching (search + filters cached separately)
- Stock deduction logic inside order processing
- MongoDB aggregation for pricing accuracy
- Strong schema design for Users, Products, Cart & Orders
- Role-based admin protection on product + order routes
- httpOnly cookie storage for secure refresh token flow
- Separate controller/service pattern for scalability
- Register / Login with hashed passwords
- Short-lived access tokens
- Long-lived refresh tokens in httpOnly cookies
- Role-based access → Admin / User
- Logout + token rotation
- CRUD operations (Admin-only)
- Image uploads → Cloudinary (via Multer memoryStorage)
- Advanced search (regex)
- Sorting by price, date
- Category + price filtering
- Pagination
- Redis caching for:
- product list
- product detail
- Add to cart (+ incremental quantity)
- Remove from cart
- Clear entire cart
- User-specific persistent cart
- Place an order from cart
- Deduct stock safely
- Store item snapshot prices
- User order history
- Admin can view all orders
- Helmet
- CORS
- Express-rate-limit
- express-mongo-sanitize
- xss-clean
- httpOnly cookies
- Sanitized inputs
| Module | Endpoints |
|---|---|
/api/users |
Register, login, refresh, logout, profile |
/api/products |
List, search, sort, create, update, delete |
/api/cart |
Add, view, remove, clear |
/api/orders |
Place order, get history, admin orders |
{
"product": {
"name": "Nike Air Zoom",
"price": 4999,
"category": "Shoes",
"stock": 12,
"image": "https://cloudinary.com/xyz",
"createdBy": "674d1fbe9c8f123abc45ef90"
}
}
[Client]
|
HTTPS
|
[Express Server]
├── Auth (JWT)
├── Products
├── Cart
├── Orders
├── Redis Cache Layer
├── MongoDB Atlas
└── Cloudinary (images)
git clone https://github.com/Ashishjha013/production-ecommerce-api
cd production-ecommerce-apinpm installPORT=8080
MONGO_URI=your_mongo_uri
JWT_SECRET=your_secret
JWT_REFRESH_SECRET=your_refresh_secret
REDIS_URL=your_redis_cloud_url
CLOUDINARY_CLOUD_NAME=...
CLOUDINARY_API_KEY=...
CLOUDINARY_API_SECRET=...
CLIENT_URL=http://localhost:3000
npm start- Register → Login
- Check cookies stored
- Add product to cart
- Create order
- Check Redis cache
- Admin views orders & manages products
Ashish Kumar Jha
📍 India • Backend Developer
- GitHub: https://github.com/Ashishjha013
- LinkedIn: https://www.linkedin.com/in/ashishjha13
- Email: ashishjha1304@gmail.com





