# tdjosh-56/backend-benz_inventorysystem architecture

> Architecture diagram of the GitHub repository tdjosh-56/backend-benz_inventorysystem, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tdjosh-56/backend-benz_inventorysystem
- Repository: https://github.com/tdjosh-56/backend-benz_inventorysystem

## Overview

This is a Django REST backend for ingredient inventory, recipes, and an operational dashboard. Users manage ingredients and recipes through API views; inventory responses include stock status and history, while recipe records can reference inventory ingredients. Dashboard services assemble inventory summaries, alerts, stock levels, and a production-today figure. A separate archive service can archive stale recipes according to a setting. The tree omits the imported `production` package, and `app_settings/models.py` is listed as empty, so those integrations’ internals and some runtime wiring cannot be verified.

Main entry points: [`inventory/models.py`](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/inventory/models.py) (Ingredient and transactions), [`inventory/views.py`](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/inventory/views.py) (Ingredient API), [`inventory/serializers.py`](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/inventory/serializers.py) (Ingredient serialization), [`inventory/services.py`](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/inventory/services.py) (Stock and history)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inventory["Inventory management"]
  node_inventory_api["Ingredient API<br/>[views.py]"]
  node_ingredient_serialization["Ingredient serialization<br/>[serializers.py]"]
  node_stock_services["Stock and history<br/>[services.py]"]
  node_unit_conversion["Unit conversion<br/>[units.py]"]
  node_ingredient_data[("Ingredient and transactions<br/>[models.py]")]
end

subgraph group_recipes["Recipe catalog"]
  node_recipe_api["Recipe API<br/>[views.py]"]
  node_recipe_serialization["Recipe serialization<br/>[serializer.py]"]
  node_recipe_data[("Recipes and subcategories<br/>[models.py]")]
end

subgraph group_insights["Dashboard and archive"]
  node_dashboard_api["Dashboard API<br/>[views.py]"]
  node_dashboard_service["Dashboard summaries<br/>[services.py]"]
  node_archive_service["Recipe auto-archive<br/>[archive.py]"]
  node_archive_command["Archive command"]
end

subgraph group_support["Shared domain data"]
  node_settings_data[("Application settings<br/>[models.py]")]
end

node_user(("API user"))

node_user -.->|"requests"| node_inventory_api
node_user -.->|"requests"| node_recipe_api
node_user -.->|"requests"| node_dashboard_api
node_inventory_api -->|"serializes"| node_ingredient_serialization
node_inventory_api -->|"loads history"| node_stock_services
node_inventory_api -->|"queries"| node_ingredient_data
node_ingredient_serialization -->|"records and reads"| node_stock_services
node_ingredient_serialization -->|"validates and saves"| node_ingredient_data
node_ingredient_serialization -->|"checks units"| node_unit_conversion
node_stock_services -->|"updates and reads"| node_ingredient_data
node_stock_services -->|"converts units"| node_unit_conversion
node_ingredient_data -->|"converts thresholds"| node_unit_conversion
node_recipe_api -->|"serializes"| node_recipe_serialization
node_recipe_api -->|"queries"| node_recipe_data
node_recipe_serialization -->|"creates and updates"| node_recipe_data
node_recipe_serialization -->|"resolves ingredients"| node_ingredient_data
node_dashboard_api -->|"gets dashboard data"| node_dashboard_service
node_dashboard_api -->|"serializes response"| node_dashboard_service
node_dashboard_service -->|"summarizes inventory"| node_ingredient_data
node_archive_command -->|"runs"| node_archive_service
node_archive_service -->|"checks archive setting"| node_settings_data
node_archive_service -->|"archives stale recipes"| node_recipe_data

click node_inventory_api "https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/inventory/views.py"
click node_ingredient_serialization "https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/inventory/serializers.py"
click node_stock_services "https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/inventory/services.py"
click node_unit_conversion "https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/inventory/units.py"
click node_ingredient_data "https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/inventory/models.py"
click node_recipe_api "https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/recipe/views.py"
click node_recipe_serialization "https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/recipe/serializer.py"
click node_recipe_data "https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/recipe/models.py"
click node_dashboard_api "https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/dashboard/views.py"
click node_dashboard_service "https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/dashboard/services.py"
click node_archive_service "https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/recipe/services/archive.py"
click node_archive_command "https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/recipe/management/command/autoarchive_recipe.py"
click node_settings_data "https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/app_settings/models.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_inventory_api,node_ingredient_serialization,node_stock_services,node_unit_conversion,node_ingredient_data,node_user toneBlue
class node_recipe_api,node_recipe_serialization,node_recipe_data toneAmber
class node_dashboard_api,node_dashboard_service,node_archive_service,node_archive_command toneMint
class node_settings_data toneRose
```

## Components

### Inventory management

- [Ingredient API](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/inventory/views.py): `inventory/views.py`
- [Ingredient serialization](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/inventory/serializers.py): `inventory/serializers.py`
- [Stock and history](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/inventory/services.py): `inventory/services.py`
- [Unit conversion](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/inventory/units.py): `inventory/units.py`
- [Ingredient and transactions](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/inventory/models.py): `inventory/models.py`

### Recipe catalog

- [Recipe API](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/recipe/views.py): `recipe/views.py`
- [Recipe serialization](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/recipe/serializer.py): `recipe/serializer.py`
- [Recipes and subcategories](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/recipe/models.py): `recipe/models.py`

### Dashboard and archive

- [Dashboard API](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/dashboard/views.py): `dashboard/views.py`
- [Dashboard summaries](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/dashboard/services.py): `dashboard/services.py`
- [Recipe auto-archive](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/recipe/services/archive.py): `recipe/services/archive.py`
- [Archive command](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/recipe/management/command/autoarchive_recipe.py): `recipe/management/command/autoarchive_recipe.py`

### Shared domain data

- [Application settings](https://github.com/tdjosh-56/backend-benz_inventorysystem/blob/main/app_settings/models.py): `app_settings/models.py`

### Other components

- **API user**

## Connections

- API user → Ingredient API: requests
- API user → Recipe API: requests
- API user → Dashboard API: requests
- Ingredient API → Ingredient serialization: serializes (evidence: `inventory/views.py`)
- Ingredient API → Stock and history: loads history (evidence: `inventory/views.py`)
- Ingredient API → Ingredient and transactions: queries (evidence: `inventory/views.py`)
- Ingredient serialization → Stock and history: records and reads (evidence: `inventory/serializers.py`)
- Ingredient serialization → Ingredient and transactions: validates and saves (evidence: `inventory/serializers.py`)
- Ingredient serialization → Unit conversion: checks units (evidence: `inventory/serializers.py`)
- Stock and history → Ingredient and transactions: updates and reads (evidence: `inventory/services.py`)
- Stock and history → Unit conversion: converts units (evidence: `inventory/services.py`)
- Ingredient and transactions → Unit conversion: converts thresholds (evidence: `inventory/models.py`)
- Recipe API → Recipe serialization: serializes (evidence: `recipe/views.py`)
- Recipe API → Recipes and subcategories: queries (evidence: `recipe/views.py`)
- Recipe serialization → Recipes and subcategories: creates and updates (evidence: `recipe/serializer.py`)
- Recipe serialization → Ingredient and transactions: resolves ingredients (evidence: `recipe/serializer.py`)
- Dashboard API → Dashboard summaries: gets dashboard data (evidence: `dashboard/views.py`)
- Dashboard API → Dashboard summaries: serializes response (evidence: `dashboard/views.py`)
- Dashboard summaries → Ingredient and transactions: summarizes inventory (evidence: `dashboard/services.py`)
- Archive command → Recipe auto-archive: runs (evidence: `recipe/management/command/autoarchive_recipe.py`)
- Recipe auto-archive → Application settings: checks archive setting (evidence: `recipe/services/archive.py`)
- Recipe auto-archive → Recipes and subcategories: archives stale recipes (evidence: `recipe/services/archive.py`)
