Django REST API for an AI-assisted inventory management system.
Role-based access · Prophet demand forecasting · Purchase orders · Audit trail · JWT · OpenAPI
| 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!
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
| 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 |
| 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.
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 runserverOptional 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 |
| Username | Password | Role |
|---|---|---|
admin |
Admin1234! |
Full access |
manager |
Manager1234! |
Products + POs + audit |
staff |
Staff1234! |
Read-only |
python manage.py test inventory- Frontend: hammi837/Invento-FE
- Monorepo overview: parent
README.md+docker-compose.yml
MIT © 2026 Hammad