Skip to content

afzalhussein/inventory-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inventory Management API

A Django REST API for tracking and managing assets.

Login

image

Admin page

image

Add Group (showing assets)

image

Add Group (showing users)

image

Doc (/api/docs/#/)

image

Features

  • JWT authentication
  • Custom user model with roles (admin, manager, viewer)
  • Asset management with status tracking
  • DRF and drf-spectacular for API schema/docs

Setup

1. Clone the repository

git clone [inventory-api](https://github.com/afzalhussein/inventory-api)
cd inventory-api

2. Create and activate a virtual environment

python -m venv env
env\Scripts\activate

3. Install dependencies

pip install -r requirements.txt

4. Install PostgreSQL and create the database

  • Ensure PostgreSQL is running.
  • Create a database named inventory_db:
psql -U postgres
CREATE DATABASE inventory_db;
\q

5. Configure settings (if needed)

Edit config/settings.py for your database credentials if needed.

6. Run migrations

python manage.py makemigrations
python manage.py migrate

7. Create a superuser

python manage.py createsuperuser

8. Run the development server

python manage.py runserver

9. Run tests

pytest

Requirements

Add the following to your requirements.txt:

Django>=5.2,<6.0
djangorestframework
drf-spectacular
djangorestframework-simplejwt
django-filter
psycopg2-binary
pytest
pytest-django

API Endpoints

  • Assets: /api/assets/
  • Authentication: /api/token/, /api/token/refresh/
  • API Docs: /api/schema/, /api/docs/

Notes

  • Make sure django-filter is installed:
    pip install django-filter
  • If you use pytest, ensure pytest.ini contains:
    [pytest]
    DJANGO_SETTINGS_MODULE = config.settings
    

Project Structure

inventory-api/
├── assets/
│   ├── models.py
│   ├── urls.py
│   └── views.py
├── users/
│   ├── models.py
│   └── ...
├── config/
│   ├── settings.py
│   ├── urls.py
│   └── ...
├── tests/
│   └── test_assets.py
├── requirements.txt
└── README.md

About

Inventory Management API built with Django, DRF, PostgreSQL, JWT, RBAC, and pytest.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages