E-Commerce REST API
Secure E-Commerce Backend with Authentication, Payments & Order Management
Project Overview
E-Commerce REST API is a scalable, production-ready server-side application built with Node.js, Express, and MongoDB Atlas. Engineered with a layered MVC-inspired architecture, the service powers complete e-commerce operations ranging from secure authentication to transactional payment processing. The API features JWT-based authentication with bcrypt password hashing, role-based access control across user, manager, and admin tiers, and automated 6-digit email OTP password recovery via Nodemailer. Comprehensive catalog services deliver full CRUD operations for products, categories, subcategories, and brands, accompanied by automated slug generation, customer reviews, and aggregated ratings. The shopping subsystem manages persistent carts, promotional coupon validation, cash-on-delivery flows, and Stripe checkout sessions with cryptographically verified webhook handlers for payment reconciliation. Advanced API utilities provide query filtering, sorting, field limiting, and pagination, reinforced by Multer uploads, Sharp image resizing, rate limiting, and security headers.
Key Engineering Highlights
- Authentication & RBAC: JWT authentication with bcrypt password hashing, role-based authorization (user/manager/admin), and email OTP recovery
- Catalog & Product Management: Full CRUD for products, categories, subcategories, and brands with slug generation and rating aggregation
- Cart & Order Lifecycle: Complete shopping cart management, coupon discount verification, cash orders, and automated stock reconciliation
- Stripe Payments & Webhooks: Stripe checkout integration with cryptographically verified webhook handlers for automated order status updates
- Advanced Query Pipeline: Reusable query architecture delivering multi-field filtering, sorting, field limiting, search, and pagination
- Security & Media Processing: Sharp image optimization pipeline, Multer uploads, Helmet security headers, CORS, HPP, and rate limiting