Skip to content
hammi837Public

About

AI-powered inventory management system with demand forecasting. Django + PostgreSQL backend, React frontend, and 20 trained Prophet time-series models predicting weekly product demand (avg. 14.35% MAPE).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

Repository files navigation

Invento — Backend API

Django REST API for an AI-assisted inventory management system.
Role-based access · Prophet demand forecasting · Purchase orders · Audit trail · JWT · OpenAPI

Live demo

URL
App (frontend) https://invento.hammadhafeez526.workers.dev
API https://hammi837.pythonanywhere.com/api/
Swagger https://hammi837.pythonanywhere.com/api/docs/

Demo logins: admin / Admin1234! · manager / Manager1234! · staff / Staff1234!


What This Is

Invento's backend sits between a React dashboard and a forecasting layer. It handles:

  • Authentication — JWT login with role claims (Admin / Manager / Staff)
  • Authorization — DRF permission classes on every endpoint
  • Demand Forecasting — Prophet models write weekly forecasts to PostgreSQL
  • Purchase Orders — draft → pending → ordered → received (stock + audit on receive)
  • Audit Logging — immutable create/update/delete history
  • User Management — Admin-only CRUD with self-lockout protection

Tech Stack

Layer Technology
Web framework Django 5.x
API Django REST Framework + drf-spectacular
Auth simplejwt
Database PostgreSQL 16 (SQLite optional in dev)
ML Facebook Prophet
Config python-decouple
Production Gunicorn + WhiteNoise + Sentry

API surface (high level)

Method Endpoint Access
POST /api/auth/login/ Public
POST /api/auth/refresh/ Public
GET /api/auth/me/ Any role
* /api/products/ Staff read; Manager+ write; Admin delete
GET /api/forecasts/ Staff+
* /api/suppliers/ Staff read; Manager+ write
* /api/purchase-orders/ Staff read; Manager+ workflow
POST /api/purchase-orders/from-critical/ Manager+
GET /api/audit-logs/ Manager+
* /api/users/ Admin
GET /api/docs/ Swagger UI

PO actions: submit, approve, receive, cancel.


Local Setup

python -m venv venv
venv\Scripts\activate
pip install -r requirements/development.txt
copy .env.example .env
python manage.py migrate
python manage.py seed_products
python manage.py runserver

Optional forecasts (after placing .pkl files in inventory/ml_models/):

python manage.py generate_forecasts
URL Purpose
http://127.0.0.1:8000/api/ API
http://127.0.0.1:8000/api/docs/ Swagger
http://127.0.0.1:8000/admin/ Django admin

Demo Credentials

Username Password Role
admin Admin1234! Full access
manager Manager1234! Products + POs + audit
staff Staff1234! Read-only

Tests

python manage.py test inventory

Related

License

MIT © 2026 Hammad

About

AI-powered inventory management system with demand forecasting. Django + PostgreSQL backend, React frontend, and 20 trained Prophet time-series models predicting weekly product demand (avg. 14.35% MAPE).

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages