# iggaudier/inventory-api architecture

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

- Interactive diagram: https://gitdiagram.com/iggaudier/inventory-api
- Repository: https://github.com/iggaudier/inventory-api

## Overview

This is a Laravel API for a multi-organization product catalog, with role-aware accounts and catalog administration. The main workflow is an API request routed to a controller, validated where applicable, then handled against organization and catalog models; product operations also manage uploaded images and standardize some JSON responses. Separate branches cover login, user provisioning, and access requests by email. The README records database and role/demo seeding capabilities, but migrations are not present in the supplied tree. Some subsystem links rely on the source index or README rather than sampled implementation.

Main entry points: [`routes/api.php`](https://github.com/iggaudier/inventory-api/blob/develop/routes/api.php) (API routes), [`app/Models/Product.php`](https://github.com/iggaudier/inventory-api/blob/develop/app/Models/Product.php) (Products), [`app/Models/User.php`](https://github.com/iggaudier/inventory-api/blob/develop/app/Models/User.php) (Users and roles), [`app/Models/Organization.php`](https://github.com/iggaudier/inventory-api/blob/develop/app/Models/Organization.php) (Organizations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and responses"]
  node_api_routes["API routes<br/>[api.php]"]
  node_responses["JSON responses<br/>[ApiResponses.php]"]
end

subgraph group_accounts["Identity and access"]
  node_auth["Authentication<br/>[AuthController.php]"]
  node_users_api["User management<br/>[UserController.php]"]
  node_org_api["Organization API"]
  node_access_request["Access requests"]
  node_authorization["Policy registration"]
  node_policies["Authorization policies"]
  node_user_model["Users and roles<br/>[User.php]"]
  node_organization["Organizations<br/>[Organization.php]"]
end

subgraph group_catalog["Catalog domain"]
  node_brand_api["Brand API"]
  node_category_api["Category API"]
  node_subcategory_api["Subcategory API"]
  node_product_api["Product API"]
  node_brand["Brands<br/>[Brand.php]"]
  node_category["Categories<br/>[Category.php]"]
  node_subcategory["Subcategories<br/>[Subcategory.php]"]
  node_product["Products<br/>[Product.php]"]
end

subgraph group_operations["Provisioning and integrations"]
  node_image_storage[("Image storage")]
  node_request_mail["Access email"]
  node_seeders["Role and demo seeders"]
end

node_client(("API client"))
node_mail_service(("Mail service"))
node_database[("Relational database")]

node_client -->|"sends requests"| node_api_routes
node_api_routes -->|"routes to"| node_auth
node_api_routes -->|"routes to"| node_users_api
node_api_routes -->|"routes to"| node_org_api
node_api_routes -->|"routes to"| node_product_api
node_api_routes -->|"routes to"| node_brand_api
node_api_routes -->|"routes to"| node_category_api
node_api_routes -->|"routes to"| node_subcategory_api
node_api_routes -->|"routes to"| node_access_request
node_auth -->|"authenticates"| node_user_model
node_users_api -->|"queries and creates"| node_user_model
node_users_api -->|"loads organization"| node_organization
node_users_api -.->|"authorizes actions"| node_policies
node_org_api -->|"manages"| node_organization
node_product_api -->|"queries and updates"| node_product
node_product_api -->|"formats results"| node_responses
node_product_api -->|"stores and deletes images"| node_image_storage
node_brand_api -->|"manages"| node_brand
node_category_api -->|"manages"| node_category
node_subcategory_api -->|"manages"| node_subcategory
node_authorization -->|"registers"| node_policies
node_brand -->|"has products"| node_product
node_category -->|"has subcategories"| node_subcategory
node_product -->|"belongs to"| node_organization
node_product -->|"belongs to"| node_category
node_product -->|"belongs to"| node_subcategory
node_product -->|"belongs to"| node_brand
node_user_model -->|"belongs to"| node_organization
node_organization -->|"has users"| node_user_model
node_access_request -->|"sends message"| node_request_mail
node_access_request -->|"sends through"| node_mail_service
node_seeders -->|"creates seed users"| node_user_model
node_seeders -->|"seeds roles and demo data"| node_database
node_product -.->|"persists catalog records"| node_database
node_user_model -.->|"persists accounts"| node_database

click node_api_routes "https://github.com/iggaudier/inventory-api/blob/develop/routes/api.php"
click node_auth "https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/Api/AuthController.php"
click node_users_api "https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/Api/UserController.php"
click node_org_api "https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/Api/OrganizationController.php"
click node_access_request "https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/RequestAccessController.php"
click node_authorization "https://github.com/iggaudier/inventory-api/blob/develop/app/Providers/AuthServiceProvider.php"
click node_policies "https://github.com/iggaudier/inventory-api/tree/develop/app/Policies"
click node_user_model "https://github.com/iggaudier/inventory-api/blob/develop/app/Models/User.php"
click node_organization "https://github.com/iggaudier/inventory-api/blob/develop/app/Models/Organization.php"
click node_brand_api "https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/Api/BrandController.php"
click node_category_api "https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/Api/CategoryController.php"
click node_subcategory_api "https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/Api/SubcategoryController.php"
click node_product_api "https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/Api/ProductController.php"
click node_brand "https://github.com/iggaudier/inventory-api/blob/develop/app/Models/Brand.php"
click node_category "https://github.com/iggaudier/inventory-api/blob/develop/app/Models/Category.php"
click node_subcategory "https://github.com/iggaudier/inventory-api/blob/develop/app/Models/Subcategory.php"
click node_product "https://github.com/iggaudier/inventory-api/blob/develop/app/Models/Product.php"
click node_responses "https://github.com/iggaudier/inventory-api/blob/develop/app/Traits/ApiResponses.php"
click node_request_mail "https://github.com/iggaudier/inventory-api/blob/develop/app/Mail/RequestAccessMail.php"
click node_seeders "https://github.com/iggaudier/inventory-api/tree/develop/database/seeders"

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_api_routes,node_responses,node_client toneBlue
class node_auth,node_users_api,node_org_api,node_access_request,node_authorization,node_policies,node_user_model,node_organization,node_database toneAmber
class node_brand_api,node_category_api,node_subcategory_api,node_product_api,node_brand,node_category,node_subcategory,node_product toneMint
class node_image_storage,node_request_mail,node_seeders toneRose
class node_mail_service toneIndigo
```

## Components

### API and responses

- [API routes](https://github.com/iggaudier/inventory-api/blob/develop/routes/api.php): `routes/api.php`
- [JSON responses](https://github.com/iggaudier/inventory-api/blob/develop/app/Traits/ApiResponses.php): `app/Traits/ApiResponses.php`

### Identity and access

- [Authentication](https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/Api/AuthController.php): `app/Http/Controllers/Api/AuthController.php`
- [User management](https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/Api/UserController.php): `app/Http/Controllers/Api/UserController.php`
- [Organization API](https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/Api/OrganizationController.php): `app/Http/Controllers/Api/OrganizationController.php`
- [Access requests](https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/RequestAccessController.php): `app/Http/Controllers/RequestAccessController.php`
- [Policy registration](https://github.com/iggaudier/inventory-api/blob/develop/app/Providers/AuthServiceProvider.php): `app/Providers/AuthServiceProvider.php`
- [Authorization policies](https://github.com/iggaudier/inventory-api/tree/develop/app/Policies): `app/Policies`
- [Users and roles](https://github.com/iggaudier/inventory-api/blob/develop/app/Models/User.php): `app/Models/User.php`
- [Organizations](https://github.com/iggaudier/inventory-api/blob/develop/app/Models/Organization.php): `app/Models/Organization.php`

### Catalog domain

- [Brand API](https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/Api/BrandController.php): `app/Http/Controllers/Api/BrandController.php`
- [Category API](https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/Api/CategoryController.php): `app/Http/Controllers/Api/CategoryController.php`
- [Subcategory API](https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/Api/SubcategoryController.php): `app/Http/Controllers/Api/SubcategoryController.php`
- [Product API](https://github.com/iggaudier/inventory-api/blob/develop/app/Http/Controllers/Api/ProductController.php): `app/Http/Controllers/Api/ProductController.php`
- [Brands](https://github.com/iggaudier/inventory-api/blob/develop/app/Models/Brand.php): `app/Models/Brand.php`
- [Categories](https://github.com/iggaudier/inventory-api/blob/develop/app/Models/Category.php): `app/Models/Category.php`
- [Subcategories](https://github.com/iggaudier/inventory-api/blob/develop/app/Models/Subcategory.php): `app/Models/Subcategory.php`
- [Products](https://github.com/iggaudier/inventory-api/blob/develop/app/Models/Product.php): `app/Models/Product.php`

### Provisioning and integrations

- **Image storage**
- [Access email](https://github.com/iggaudier/inventory-api/blob/develop/app/Mail/RequestAccessMail.php): `app/Mail/RequestAccessMail.php`
- [Role and demo seeders](https://github.com/iggaudier/inventory-api/tree/develop/database/seeders): `database/seeders`

### Other components

- **API client**
- **Mail service**
- **Relational database**

## Connections

- API client → API routes: sends requests (evidence: `routes/api.php`)
- API routes → Authentication: routes to (evidence: `routes/api.php`)
- API routes → User management: routes to (evidence: `routes/api.php`)
- API routes → Organization API: routes to (evidence: `routes/api.php`)
- API routes → Product API: routes to (evidence: `routes/api.php`)
- API routes → Brand API: routes to (evidence: `routes/api.php`)
- API routes → Category API: routes to (evidence: `routes/api.php`)
- API routes → Subcategory API: routes to (evidence: `routes/api.php`)
- API routes → Access requests: routes to (evidence: `routes/api.php`)
- Authentication → Users and roles: authenticates (evidence: `app/Http/Controllers/Api/AuthController.php`)
- User management → Users and roles: queries and creates (evidence: `app/Http/Controllers/Api/UserController.php`)
- User management → Organizations: loads organization (evidence: `app/Http/Controllers/Api/UserController.php`)
- User management → Authorization policies: authorizes actions
- Organization API → Organizations: manages (evidence: `app/Http/Controllers/Api/OrganizationController.php`)
- Product API → Products: queries and updates (evidence: `app/Http/Controllers/Api/ProductController.php`)
- Product API → JSON responses: formats results (evidence: `app/Http/Controllers/Api/ProductController.php`)
- Product API → Image storage: stores and deletes images (evidence: `app/Http/Controllers/Api/ProductController.php`)
- Brand API → Brands: manages (evidence: `app/Http/Controllers/Api/BrandController.php`)
- Category API → Categories: manages (evidence: `app/Http/Controllers/Api/CategoryController.php`)
- Subcategory API → Subcategories: manages (evidence: `app/Http/Controllers/Api/SubcategoryController.php`)
- Policy registration → Authorization policies: registers (evidence: `app/Providers/AuthServiceProvider.php`)
- Brands → Products: has products (evidence: `app/Models/Brand.php`)
- Categories → Subcategories: has subcategories (evidence: `app/Models/Category.php`)
- Products → Organizations: belongs to (evidence: `app/Models/Product.php`)
- Products → Categories: belongs to (evidence: `app/Models/Product.php`)
- Products → Subcategories: belongs to (evidence: `app/Models/Product.php`)
- Products → Brands: belongs to (evidence: `app/Models/Product.php`)
- Users and roles → Organizations: belongs to (evidence: `app/Models/User.php`)
- Organizations → Users and roles: has users (evidence: `app/Models/Organization.php`)
- Access requests → Access email: sends message (evidence: `app/Http/Controllers/RequestAccessController.php`)
- Access requests → Mail service: sends through (evidence: `app/Http/Controllers/RequestAccessController.php`)
- Role and demo seeders → Users and roles: creates seed users (evidence: `database/seeders/SuperAdminSeeder.php`)
- Role and demo seeders → Relational database: seeds roles and demo data (evidence: `database/seeders/DatabaseSeeder.php`)
- Products → Relational database: persists catalog records
- Users and roles → Relational database: persists accounts
