An inventory management database backend built using Node.js, Express, and MongoDB. Manages Products, Suppliers, Orders, and Users with full CRUD operations.
Vinn Runkee Cañares
BSCS 4-2
- Node.js 18+
- MongoDB Atlas
- Code Editor (Command-line Environment)
- Git Bash (Optional Command-line Environment)
-
Clone the repository
-
Install dependencies:
npm install
-
Create
.envfile in project root:MONGO_URI=mongodb://127.0.0.1:27017/inventory PORT=3000
-
Start the server:
npm start # Production npm run start # Development with nodemon
Inventory_Store/
├── app.js # Server
├── config/
│ └── db.js # Database connection
├── controllers/ # Database Management Logic
│ ├── supplierController.js
│ ├── orderController.js
│ └── productController.js
├── models/ # Collection schemas
│ ├── productModel.js
│ ├── supplierModels.js
│ └── orderModel.js
├── routes/ # API route
│ ├── productRoutes.js
│ ├── supplierRoutes.js
│ └── orderRoutes.js
├── package.json
└── README.md
POST /product- Create new productGET /products- Get all productsGET /product/:id- Get product by IDPUT /product/:id- Update productDELETE /product/:id- Delete product
POST /supplier- Create new supplierGET /suppliers- Get all suppliersGET /supplier/:id- Get supplier by IDPUT /supplier/:id- Update supplierDELETE /supplier/:id- Delete supplier
POST /order- Create new orderGET /orders- Get all orders (with populated references)GET /order/:id- Get order by IDPUT /order/:id- Update orderDELETE /order/:id- Delete order
{
"sku": "string (required, unique)",
"name": "string (required)",
"price": "number (min: 0, required)",
"stock": "number (min: 0, default: 0, required)"
}{
"name": "string (required)",
"contact": "string (required, unique)"
}{
"supplierId": "ObjectId (required)",
"items": [
{
"productId": "ObjectId (required)",
"qty": "number (min: 1, required)",
"price": "number"
}
],
"status": "string (enum: pending, completed, cancelled)"
}