https://ciaindia.github.io/ecommerce/
Product Requirement Document (PRD)
1. Project Overview
The Product CRUD API is a simple RESTful web service built using Node.js and Express.js. It allows users to perform Create, Read, Update, and Delete (CRUD) operations on a collection of products.
2. Purpose
The goal of this project is to provide a foundational backend API that can manage product data. It can later be integrated with a frontend dashboard or connected to a database such as MySQL.
3. Scope
The system will:
- Allow users to add new products
- Retrieve all or specific products
- Update existing products
- Delete products from the list
4. Functional Requirements
4.1 Product Entity
Each product contains the following fields:
Field | Type | Description |
---|---|---|
id | Integer | Unique identifier for each product |
title | String | Name or title of the product |
price | Number | Product price in currency value |
stock | Number | Quantity of product available in inventory |
4.2 API Endpoints
Method | Endpoint | Description |
---|---|---|
GET | /products | Fetch all products |
GET | /products/:id | Fetch single product by ID |
POST | /products | Create new product |
PUT | /products/:id | Update existing product |
DELETE | /products/:id | Delete a product |
4.3 Request/Response Examples
POST /products
{
"title": "Keyboard",
"price": 1200,
"stock": 50
}
Response:
{
"id": 3,
"title": "Keyboard",
"price": 1200,
"stock": 50
}
PUT /products/3
{
"price": 1000,
"stock": 60
}
5. Non-Functional Requirements
- Scalability: Can later be integrated with a database.
- Performance: Should handle up to 1000 requests per second on local tests.
- Security: Input validation required for all API calls.
- Maintainability: Code follows modular and RESTful design principles.
6. Technology Stack
Component | Technology |
---|---|
Backend | Node.js |
Framework | Express.js |
Database (Future) | MySQL |
Tools | Postman for testing, npm for dependency management |
7. Assumptions
- The system will initially store data in-memory.
- The
id
field auto-increments based on the existing array size. - No user authentication is implemented at this stage.
8. Future Enhancements
- Integrate with persistent storage (MySQL or MongoDB)
- Add authentication and authorization
- Implement pagination and search filters
- Include product image uploads
9. Deliverables
- Node.js Express application (
server.js
) - Postman collection for API testing
- Documentation (this PRD)