- Introduction
- Technologies Used
- Features
- Setup Instructions
- API Interaction
- API Endpoints
- Testing
- Hosting
This is a RESTful API for an Inventory Management System that allows users to manage products, categories, and inventory levels efficiently. This project is built using Django and provides a robust backend for handling inventory data.
- Python 3.x
- Django
- Django REST Framework
- PostgreSQL
- Docker
- Git
- CRUD operations for products, suppliers and inventory
- Inventory management
- Docker support for easy deployment
- Detailed API documentation
Follow these steps to set up the project locally:
- Python 3.x installed
- PostgreSQL installed and running
- Git installed
- Docker installed
git clone git@github.com:temmy669/Inventory_Management_System.git
cd InventoryCreate a virtual environment and activate it.
- Create:
python3 -m venv venv
- Activate:
venv/scripts/activate
- Create:
python3 -m venv venv
- Activate:
venv/bin/activate
Install the necessary dependencies listed in the requirements.txt file using the command pip install -r requirements.txt.
Create a .env file in the root directory of the project and add your environment variables. For example:
SECRET_KEY='your-secret-key'
DATABASE_NAME='your-database-name'
DATABASE_USER='your-database-user'
DATABASE_PASSWORD='your-database-password'
DATABASE_HOST='your-database-host'
DATABASE_PORT='your-database-port'
Apply database migrations to set up your database schema.
- Make Migrations:
python manage.py makemigrations
- Migrate:
python manage.py migrate
- Make Migrations:
python3 manage.py makemigration
- Migrate:
python3 manage.py migrate
To access the admin panel, create a superuser account.
To create the superuser account use the command python manage.py createsuperuser, after you would be required to input your email, user, name and password to be able to access the admin panel.
Start the development server to run your API.
Your API should now be accessible at http://127.0.0.1:8000/
You can use tools like Postman or curl to interact with and test the API endpoints.
The following endpoints are available in the Inventory Management System API:
| Endpoint | Method | Description |
|---|---|---|
/api/v1/products/ |
GET | List all products with pagination and filtering options. |
/api/v1/products/ |
POST | Add a new product (name, description, price, supplier). |
/api/v1/products/{id}/ |
PUT | Update product details. |
/api/v1/products/{id}/ |
DELETE | Remove a product. |
/api/v1/suppliers/ |
GET | List all suppliers. |
/api/v1/suppliers/ |
POST | Add a new supplier (name, contact info). |
/api/v1/suppliers/{id}/ |
PUT | Update supplier details. |
/api/v1/suppliers/{id}/ |
DELETE | Remove a supplier. |
/api/v1/inventory/ |
GET | Check inventory levels for each product. |
/api/v1/inventory/ |
POST | Update inventory levels (product ID, quantity). |
/api/v1/inventory/generate-inventory-report/ |
GET | To generate inventory reports |
/api/v1/inventory/generate-supplier-report/ |
GET | To generate supplier performance reports |
/api/v1/notifications/ |
GET | To list the otifications |
/api/v1/upload/ |
POST | To upload a csv file containing product information to be stored |
Full API documentation can be found at http://127.0.0.1:8000/swagger/, or http://127.0.0.1:8000/redoc/ but the yaml file is also included in the repository incase you have any trouble viewing it at the url.
Ensure that the Django server is running
This project includes tests to ensure the functionality and reliability of the Inventory Management System API.
To run the test use the command python manage.py appname.test
replace appname with the name of the application in the project you want to test.
To access the endpoints on the live application, please follow these steps:
-
Base URL
The application is hosted at:
https://inventory-management-system-nmrq.onrender.com -
Accessing Endpoints
Since the base URL (https://inventory-management-system-nmrq.onrender.com) does not display specific content on its own, append endpoint paths to view specific functionalities. For example:-
Admin Panel:
https://inventory-management-system-nmrq.onrender.com/admin
(Admin credentials are required for access) -
API Endpoints:
Append specific API paths after/api/, such as:
https://inventory-management-system-nmrq.onrender.com/api/v1/products/
-
-
Sample Endpoint Access
To access the "products" endpoint in your API, use the following URL:
https://inventory-management-system-nmrq.onrender.com/api/v1/products/ -
To Access Documentation To access the documention for the APIs on the live url you can visit either: https://inventory-management-system-nmrq.onrender.com/swagger https://inventory-management-system-nmrq.onrender.com/redoc
-
Further Instructions
For other pages or actions, simply append the corresponding endpoint path to the base URL.