# dodiar/it-inventory architecture

> Architecture diagram of the GitHub repository dodiar/it-inventory, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dodiar/it-inventory
- Repository: https://github.com/dodiar/it-inventory

## Overview

IT Inventory is a Laravel API-first backend for managing IT inventory and assets. The documented user flow is an API client calling versioned endpoints; the sampled implementation shows authentication validating credentials, issuing or revoking a token, and returning user data. The domain model covers item and location catalogs, stock balances and movements, and individually tracked assets with assignments, movements, maintenance, and retirement. MySQL is documented as the database. CRUD routes and most domain handlers were not sampled, so those capabilities are represented as model subsystems without guessed controller flows.

Main entry points: [`backend/app/Models/Asset.php`](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Asset.php) (Assets), [`backend/app/Models/Item.php`](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Item.php) (Items), [`backend/app/Models/Location.php`](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Location.php) (Locations), [`backend/app/Http/Controllers/Api/V1/AuthController.php`](https://github.com/dodiar/it-inventory/blob/main/backend/app/Http/Controllers/Api/V1/AuthController.php) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and authentication"]
  node_routes["API routes<br/>[api.php]"]
  node_auth["Authentication<br/>[AuthController.php]"]
  node_loginrequest["Login validation<br/>[LoginRequest.php]"]
  node_userresource["User response<br/>[UserResource.php]"]
  node_role["Roles<br/>[Role.php]"]
  node_user["Users<br/>[User.php]"]
  node_active["Active-user check"]
  node_bootstrap["Application routing<br/>[app.php]"]
end

subgraph group_catalog["Inventory catalog"]
  node_category["Categories<br/>[Category.php]"]
  node_unit["Units<br/>[Unit.php]"]
  node_item["Items<br/>[Item.php]"]
  node_location["Locations<br/>[Location.php]"]
  node_employee["Employees<br/>[Employee.php]"]
end

subgraph group_stock["Stock operations"]
  node_stockbalance["Stock balances<br/>[StockBalance.php]"]
  node_stockmovement["Stock movements<br/>[StockMovement.php]"]
end

subgraph group_assets["Asset lifecycle"]
  node_asset["Assets<br/>[Asset.php]"]
  node_assignment["Assignments"]
  node_assetmovement["Asset movements<br/>[AssetMovement.php]"]
  node_maintenance["Maintenance tickets"]
  node_retirement["Asset retirement"]
end

node_client(("API client"))
node_mysql[("MySQL database")]

node_client -->|"calls API"| node_routes
node_routes -->|"routes auth"| node_auth
node_auth -->|"validates with"| node_loginrequest
node_auth -->|"loads and updates"| node_user
node_auth -->|"returns user"| node_userresource
node_userresource -->|"serializes role"| node_role
node_user -->|"belongs to"| node_role
node_bootstrap -->|"registers routes"| node_routes
node_bootstrap -->|"aliases middleware"| node_active
node_item -->|"belongs to"| node_category
node_item -->|"belongs to"| node_unit
node_item -->|"has assets"| node_asset
node_item -->|"has balances"| node_stockbalance
node_item -->|"has movements"| node_stockmovement
node_location -->|"has assets"| node_asset
node_location -->|"has balances"| node_stockbalance
node_stockmovement -->|"references item"| node_item
node_stockmovement -->|"references location"| node_location
node_asset -->|"belongs to"| node_item
node_asset -->|"belongs to"| node_location
node_asset -->|"has assignments"| node_assignment
node_asset -->|"has movements"| node_assetmovement
node_asset -->|"has tickets"| node_maintenance
node_asset -->|"has retirement"| node_retirement
node_assignment -->|"references employee"| node_employee
node_assetmovement -->|"references location"| node_location
node_mysql -.->|"stores records"| node_item
node_mysql -.->|"stores records"| node_asset

click node_routes "https://github.com/dodiar/it-inventory/blob/main/backend/routes/api.php"
click node_auth "https://github.com/dodiar/it-inventory/blob/main/backend/app/Http/Controllers/Api/V1/AuthController.php"
click node_loginrequest "https://github.com/dodiar/it-inventory/blob/main/backend/app/Http/Requests/LoginRequest.php"
click node_userresource "https://github.com/dodiar/it-inventory/blob/main/backend/app/Http/Resources/UserResource.php"
click node_role "https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Role.php"
click node_user "https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/User.php"
click node_active "https://github.com/dodiar/it-inventory/blob/main/backend/app/Http/Middleware/EnsureUserIsActive.php"
click node_bootstrap "https://github.com/dodiar/it-inventory/blob/main/backend/bootstrap/app.php"
click node_category "https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Category.php"
click node_unit "https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Unit.php"
click node_item "https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Item.php"
click node_location "https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Location.php"
click node_employee "https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Employee.php"
click node_stockbalance "https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/StockBalance.php"
click node_stockmovement "https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/StockMovement.php"
click node_asset "https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Asset.php"
click node_assignment "https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/AssetAssignment.php"
click node_assetmovement "https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/AssetMovement.php"
click node_maintenance "https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/MaintenanceTicket.php"
click node_retirement "https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/AssetRetirement.php"

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_routes,node_auth,node_loginrequest,node_userresource,node_role,node_user,node_active,node_bootstrap,node_client toneBlue
class node_category,node_unit,node_item,node_location,node_employee,node_mysql toneAmber
class node_stockbalance,node_stockmovement toneMint
class node_asset,node_assignment,node_assetmovement,node_maintenance,node_retirement toneRose
```

## Components

### API and authentication

- [API routes](https://github.com/dodiar/it-inventory/blob/main/backend/routes/api.php): `backend/routes/api.php`
- [Authentication](https://github.com/dodiar/it-inventory/blob/main/backend/app/Http/Controllers/Api/V1/AuthController.php): `backend/app/Http/Controllers/Api/V1/AuthController.php`
- [Login validation](https://github.com/dodiar/it-inventory/blob/main/backend/app/Http/Requests/LoginRequest.php): `backend/app/Http/Requests/LoginRequest.php`
- [User response](https://github.com/dodiar/it-inventory/blob/main/backend/app/Http/Resources/UserResource.php): `backend/app/Http/Resources/UserResource.php`
- [Roles](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Role.php): `backend/app/Models/Role.php`
- [Users](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/User.php): `backend/app/Models/User.php`
- [Active-user check](https://github.com/dodiar/it-inventory/blob/main/backend/app/Http/Middleware/EnsureUserIsActive.php): `backend/app/Http/Middleware/EnsureUserIsActive.php`
- [Application routing](https://github.com/dodiar/it-inventory/blob/main/backend/bootstrap/app.php): `backend/bootstrap/app.php`

### Inventory catalog

- [Categories](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Category.php): `backend/app/Models/Category.php`
- [Units](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Unit.php): `backend/app/Models/Unit.php`
- [Items](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Item.php): `backend/app/Models/Item.php`
- [Locations](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Location.php): `backend/app/Models/Location.php`
- [Employees](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Employee.php): `backend/app/Models/Employee.php`

### Stock operations

- [Stock balances](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/StockBalance.php): `backend/app/Models/StockBalance.php`
- [Stock movements](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/StockMovement.php): `backend/app/Models/StockMovement.php`

### Asset lifecycle

- [Assets](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/Asset.php): `backend/app/Models/Asset.php`
- [Assignments](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/AssetAssignment.php): `backend/app/Models/AssetAssignment.php`
- [Asset movements](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/AssetMovement.php): `backend/app/Models/AssetMovement.php`
- [Maintenance tickets](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/MaintenanceTicket.php): `backend/app/Models/MaintenanceTicket.php`
- [Asset retirement](https://github.com/dodiar/it-inventory/blob/main/backend/app/Models/AssetRetirement.php): `backend/app/Models/AssetRetirement.php`

### Other components

- **API client**
- **MySQL database**

## Connections

- API client → API routes: calls API (evidence: `README.md`)
- API routes → Authentication: routes auth (evidence: `backend/routes/api.php`)
- Authentication → Login validation: validates with (evidence: `backend/app/Http/Controllers/Api/V1/AuthController.php`)
- Authentication → Users: loads and updates (evidence: `backend/app/Http/Controllers/Api/V1/AuthController.php`)
- Authentication → User response: returns user (evidence: `backend/app/Http/Controllers/Api/V1/AuthController.php`)
- User response → Roles: serializes role (evidence: `backend/app/Http/Resources/UserResource.php`)
- Users → Roles: belongs to (evidence: `backend/app/Models/User.php`)
- Application routing → API routes: registers routes (evidence: `backend/bootstrap/app.php`)
- Application routing → Active-user check: aliases middleware (evidence: `backend/bootstrap/app.php`)
- Items → Categories: belongs to (evidence: `backend/app/Models/Item.php`)
- Items → Units: belongs to (evidence: `backend/app/Models/Item.php`)
- Items → Assets: has assets (evidence: `backend/app/Models/Item.php`)
- Items → Stock balances: has balances (evidence: `backend/app/Models/Item.php`)
- Items → Stock movements: has movements (evidence: `backend/app/Models/Item.php`)
- Locations → Assets: has assets (evidence: `backend/app/Models/Location.php`)
- Locations → Stock balances: has balances (evidence: `backend/app/Models/Location.php`)
- Stock movements → Items: references item (evidence: `backend/app/Models/StockMovement.php`)
- Stock movements → Locations: references location (evidence: `backend/app/Models/StockMovement.php`)
- Assets → Items: belongs to (evidence: `backend/app/Models/Asset.php`)
- Assets → Locations: belongs to (evidence: `backend/app/Models/Asset.php`)
- Assets → Assignments: has assignments (evidence: `backend/app/Models/Asset.php`)
- Assets → Asset movements: has movements (evidence: `backend/app/Models/Asset.php`)
- Assets → Maintenance tickets: has tickets (evidence: `backend/app/Models/Asset.php`)
- Assets → Asset retirement: has retirement (evidence: `backend/app/Models/Asset.php`)
- Assignments → Employees: references employee (evidence: `backend/app/Models/AssetAssignment.php`)
- Asset movements → Locations: references location (evidence: `backend/app/Models/AssetMovement.php`)
- MySQL database → Items: stores records
- MySQL database → Assets: stores records
