A backend system for managing products, suppliers, inventory batches, and transactions. Built with Node.js, Express.js, and MongoDB, designed for modularity, clean architecture, and future scalability.
- Product Management: CRUD operations with SKU, category, pricing, and supplier validation.
- Supplier Management: CRUD for suppliers with contact details.
- Inventory Management: Track stock with batches, FEFO (First Expire First Out) rules, and transaction history.
- Authentication: Admin login with JWT-based authentication.
- Validation: Request validation for all routes.
- Error Handling: Centralized error handler with custom
AppErrorclass. - Logging: Structured logging for debugging and monitoring.
- Modular Architecture: Feature-based folder structure for maintainability.
- Scalable Design: Ready for caching, microservices, and cloud deployment.
- Backend: Node.js, Express.js
- Database: MongoDB (Mongoose)
- Authentication: JWT (Access Token, Refresh Token optional for v2)
- Validation: Custom middleware + express-validator
- Logging: Winston / Custom Logger
- Testing: Jest / Supertest (optional for future phases)
- Dev Tools: Nodemon, ESLint, Prettier
src/
├── config/
├── database/
├── modules/
│ ├── auth/
│ ├── product/
│ ├── supplier/
│ ├── inventory-batch/
│ └── inventory-transaction/
├── middlewares/
├── shared/
│ ├── errors/
│ ├── logger/
│ └── repositories/
├── routes/
├── app.js
└── server.js
- Clone the repository:
git clone <repo-url>
cd inventory-management- Install dependencies:
npm install- Create
.envfile based on.env.example:
PORT=3000
MONGO_URI=mongodb://localhost:27017/inventory
JWT_SECRET=your_jwt_secret
- Run the development server:
npm run dev- Health check:
GET http://localhost:3000/health
Response:
{
"status": "ok",
"message": "Inventory API is running"
}
- Phase 1: Project setup, MongoDB connection, health check ✅
- Phase 2: Product CRUD ---> (working)
- Phase 3: Supplier CRUD & relationships
- Phase 4: InventoryBatch & InventoryTransaction
- Phase 5: Authentication & Authorization
- Phase 6: Advanced features (pagination, filtering, soft delete)
- Phase 7: Testing & CI/CD
- Phase 8: Production enhancements (Docker, caching, cloud deployment, refresh tokens)
- Multi-device refresh token management
- Role-based access control (staff, admin)
- Redis caching for inventory queries
- Async message queues for stock alerts
- Cloud deployment (AWS / Docker)
- Fork the repository
- Create a new feature branch
- Write code, commit, and push
- Open a pull request