A scalable backend service for managing products in an e-commerce system using Node.js, Express, MongoDB, and MVC architecture.
This service handles:
- Product creation and management
- Product listing and details
- Category-based filtering
- Seller-linked products
- Node.js
- Express.js
- MongoDB + Mongoose
- MVC Architecture
src/ ├── models/ │ └── product.model.js ├── controllers/ │ └── product.controller.js ├── routes/ │ └── product.routes.js ├── middlewares/ ├── config/ ├── app.js └── server.js
- Create product (seller-based)
- Get all products
- Get product by ID
- Search-ready schema (text indexing)
- Scalable MVC structure
POST /api/products
GET /api/products
GET /api/products/:id
Create a .env file:
PORT=5000
MONGO_URI=your_mongodb_url
JWT_SECRET=your_secret
git clone
npm install
npm run dev
- MVC Pattern (Model → Controller → Route)
- Scalable folder structure
- Ready for microservices migration
- Indexing for performance optimization
- Pagination & filtering
- Redis caching
- Cloudinary image upload
- Role-based access control
- Event-driven architecture
Implemented an API Gateway to act as a single entry point for all client requests. The gateway routes incoming requests to the appropriate microservices, specifically:
- Cart Service → Handles cart operations (add/remove/update items)
- Order Service → Manages order creation, processing, and history
- Centralized routing and request handling
- Improved scalability and service decoupling
- Easier integration of cross-cutting concerns like authentication, logging, and rate limiting
- Simplified client-side communication (single base URL)
- /api/cart → Routed to Cart Service
- /api/orders → Routed to Order Service
Vikram Mistry
MERN Stack Developer