An API for inventory management, scoped to a small grocery store.
-
Clone the repo:
gh repo clone POWRFULCOW89/Grocery-API
or download as ZIP.
-
Install the dependencies:
npm i
-
Run the tests:
npm test
-
Run the app:
npm run dev
An environment file is required in the project root, containg the MONGO_URI
and SAMPLE_TOKEN
variables for MongoDB and testing, respectively.
The current project is built with Express, a Node.js framework for backend code. Mongoose is used as Object Document Mapper along with the NoSQL database MongoDB. Unit tests are modeled with Chai and run with Mocha. As authentication mechanism, a local strategy is implemented with Passport. Finally, the API is deployed to Heroku.
- Admin: Super user that can generate reports, manage inventory and users.
- Manager: Logged in user that can manage the inventory and cashier users.
- Cashier: User that can make, edit and close sales.
- Product:
- Name, category, stock, price, code.
- User:
- Username, name, email, password, role.
- Sale:
- Products, quantity, subtotal, total.
The Grocery API documentation can be consulted in Swagger Hub.