This is a RESTful API built with Node.js, Express, and Sequelize (MySQL) that allows users to manage products and categories in an inventory system. The API supports full CRUD operations, authentication, and role-based access control.
📄 View full API documentation here: 👉 Postman API Docs
-
✅ User Authentication (JWT)
-
✅ Role-based Access (Admin, Customer)
-
✅ CRUD operations for:
- Products
- Categories
-
✅ Sequelize ORM with MySQL
-
✅ Middleware for route protection
-
✅ Organized MVC structure
- Login returns a JWT token.
- Add token to
Authorizationheader as:Bearer <token>
- Node.js
- Express.js
- Sequelize
- MySQL
- Bcrypt.js
- JWT (jsonwebtoken)
- Railway (for deployment)
-
Clone the repo:
git clone https://github.com/your-username/inventory-management-api.git cd inventory-management-api -
Install dependencies:
npm install
-
Create
.envfile:DB_HOST=your_mysql_host DB_USER=your_mysql_user DB_PASSWORD=your_mysql_password DB_NAME=your_database TOKEN_KEY=your_jwt_secret -
Run the server:
npm run dev
📦 inventory-management-api
├── config/
│ └── db.js
├── controllers/
├── middleware/
├── model/
├── routes/
├── util/
└── server.js / app.js
POST /api/auth/login– Login a userPOST /api/products– Create product (admin only)GET /api/products– Get all productsPUT /api/products/:id– Update a productDELETE /api/products/:id– Delete a productGET /api/categories– Get all categories- ...and more in the documentation
Contributions, issues, and feature requests are welcome! Thank you.