# part-db/part-db-server architecture

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

- Interactive diagram: https://gitdiagram.com/part-db/part-db-server
- Repository: https://github.com/part-db/part-db-server

## Overview

Part-DB is a web-based electronic-component inventory system. The principal workflow is users managing parts and their inventory details, then searching and filtering that inventory; projects can use parts in bills of materials and withdraw needed stock. The README also documents API/MCP access, labels and scanning, imports, KiCad, event history, authentication, and external information providers. Most domain components are represented by their exact source paths, but implementation relationships beyond the sampled excerpts are limited to documented capabilities; unsampled subsystem paths indicate scope, not inspected code.

Main entry points: [`public/index.php`](https://github.com/part-db/part-db-server/blob/master/public/index.php) (Web entry point), [`src/Entity/UserSystem/User.php`](https://github.com/part-db/part-db-server/blob/master/src/Entity/UserSystem/User.php) (Users and groups), [`src/Repository/PartRepository.php`](https://github.com/part-db/part-db-server/blob/master/src/Repository/PartRepository.php) (Part search), [`src/Entity/Parts/Part.php`](https://github.com/part-db/part-db-server/blob/master/src/Entity/Parts/Part.php) (MCP tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inventory["Inventory and storage"]
  node_parts[("Parts and stock<br/>[Part.php]")]
  node_categories[("Categories<br/>[Category.php]")]
  node_storage[("Storage locations")]
  node_suppliers[("Suppliers<br/>[Supplier.php]")]
  node_attachments[("Attachments<br/>[Attachment.php]")]
  node_attachment_links["Attachment relationships"]
  node_part_search["Part search<br/>[PartRepository.php]"]
end

subgraph group_projects["Projects and labels"]
  node_projects[("Projects and BOM")]
  node_labels["Labels and scanning"]
end

subgraph group_interfaces["Application interfaces"]
  node_web["Web entry point<br/>[index.php]"]
  node_import_export["Import and export"]
  node_api["REST API<br/>[Part.php]"]
  node_mcp["MCP tools<br/>[Part.php]"]
  node_mcp_input["Element lookup input"]
end

subgraph group_identity["Identity and history"]
  node_users[("Users and groups<br/>[User.php]")]
  node_groups[("Permission groups<br/>[Group.php]")]
  node_permissions["Permission management"]
  node_tokens["API token levels<br/>[ApiTokenLevel.php]"]
  node_event_log[("Event history")]
end

subgraph group_integrations["External integrations"]
  node_provider_import[("Provider imports")]
  node_eda["KiCad integration"]
  node_ai_extraction["AI extraction"]
  node_external_providers{{"Part information providers"}}
end

node_user(("Inventory user"))
node_database[("Configured database")]

node_user -->|"uses browser"| node_web
node_web -.->|"manages inventory"| node_parts
node_web -.->|"searches parts"| node_part_search
node_part_search -->|"queries"| node_parts
node_web -.->|"manages BOM"| node_projects
node_web -.->|"creates and scans"| node_labels
node_web -.->|"imports and exports"| node_import_export
node_user -.->|"accesses inventory"| node_api
node_user -.->|"asks inventory questions"| node_mcp
node_mcp -.->|"accepts lookup input"| node_mcp_input
node_web -.->|"authenticates users"| node_users
node_users -->|"belongs to groups"| node_groups
node_permissions -->|"resolves permissions"| node_users
node_web -.->|"tracks changes"| node_event_log
node_web -.->|"imports provider data"| node_provider_import
node_provider_import -.->|"retrieves part data"| node_external_providers
node_web -.->|"integrates KiCad"| node_eda
node_web -.->|"extracts datasheet data"| node_ai_extraction
node_attachments -->|"associates elements"| node_attachment_links
node_web -.->|"stores inventory"| node_database

click node_web "https://github.com/part-db/part-db-server/blob/master/public/index.php"
click node_parts "https://github.com/part-db/part-db-server/blob/master/src/Entity/Parts/Part.php"
click node_categories "https://github.com/part-db/part-db-server/blob/master/src/Entity/Parts/Category.php"
click node_storage "https://github.com/part-db/part-db-server/blob/master/src/Entity/Parts/StorageLocation.php"
click node_suppliers "https://github.com/part-db/part-db-server/blob/master/src/Entity/Parts/Supplier.php"
click node_attachments "https://github.com/part-db/part-db-server/blob/master/src/Entity/Attachments/Attachment.php"
click node_attachment_links "https://github.com/part-db/part-db-server/blob/master/src/Entity/Attachments/AttachmentContainingDBElement.php"
click node_part_search "https://github.com/part-db/part-db-server/blob/master/src/Repository/PartRepository.php"
click node_projects "https://github.com/part-db/part-db-server/blob/master/src/Entity/ProjectSystem/ProjectBOMEntry.php"
click node_labels "https://github.com/part-db/part-db-server/blob/master/src/Controller/LabelController.php"
click node_import_export "https://github.com/part-db/part-db-server/blob/master/src/Controller/PartImportExportController.php"
click node_api "https://github.com/part-db/part-db-server/blob/master/src/Entity/Parts/Part.php"
click node_mcp "https://github.com/part-db/part-db-server/blob/master/src/Entity/Parts/Part.php"
click node_users "https://github.com/part-db/part-db-server/blob/master/src/Entity/UserSystem/User.php"
click node_groups "https://github.com/part-db/part-db-server/blob/master/src/Entity/UserSystem/Group.php"
click node_permissions "https://github.com/part-db/part-db-server/blob/master/src/Services/UserSystem/PermissionManager.php"
click node_tokens "https://github.com/part-db/part-db-server/blob/master/src/Entity/UserSystem/ApiTokenLevel.php"
click node_event_log "https://github.com/part-db/part-db-server/blob/master/src/Entity/LogSystem/AbstractLogEntry.php"
click node_provider_import "https://github.com/part-db/part-db-server/blob/master/src/Entity/InfoProviderSystem/BulkInfoProviderImportJob.php"
click node_eda "https://github.com/part-db/part-db-server/blob/master/src/Controller/KiCadApiController.php"
click node_ai_extraction "https://github.com/part-db/part-db-server/blob/master/src/Controller/InfoProviderController.php"
click node_external_providers "https://github.com/part-db/part-db-server/blob/master/src/Controller/InfoProviderController.php"
click node_mcp_input "https://github.com/part-db/part-db-server/blob/master/src/Mcp/DTO/ElementByIdInput.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_parts,node_categories,node_storage,node_suppliers,node_attachments,node_attachment_links,node_part_search,node_user toneBlue
class node_projects,node_labels,node_database toneAmber
class node_web,node_import_export,node_api,node_mcp,node_mcp_input toneMint
class node_users,node_groups,node_permissions,node_tokens,node_event_log toneRose
class node_provider_import,node_eda,node_ai_extraction,node_external_providers toneIndigo
```

## Components

### Inventory and storage

- [Parts and stock](https://github.com/part-db/part-db-server/blob/master/src/Entity/Parts/Part.php): `src/Entity/Parts/Part.php`
- [Categories](https://github.com/part-db/part-db-server/blob/master/src/Entity/Parts/Category.php): `src/Entity/Parts/Category.php`
- [Storage locations](https://github.com/part-db/part-db-server/blob/master/src/Entity/Parts/StorageLocation.php): `src/Entity/Parts/StorageLocation.php`
- [Suppliers](https://github.com/part-db/part-db-server/blob/master/src/Entity/Parts/Supplier.php): `src/Entity/Parts/Supplier.php`
- [Attachments](https://github.com/part-db/part-db-server/blob/master/src/Entity/Attachments/Attachment.php): `src/Entity/Attachments/Attachment.php`
- [Attachment relationships](https://github.com/part-db/part-db-server/blob/master/src/Entity/Attachments/AttachmentContainingDBElement.php): `src/Entity/Attachments/AttachmentContainingDBElement.php`
- [Part search](https://github.com/part-db/part-db-server/blob/master/src/Repository/PartRepository.php): `src/Repository/PartRepository.php`

### Projects and labels

- [Projects and BOM](https://github.com/part-db/part-db-server/blob/master/src/Entity/ProjectSystem/ProjectBOMEntry.php): `src/Entity/ProjectSystem/ProjectBOMEntry.php`
- [Labels and scanning](https://github.com/part-db/part-db-server/blob/master/src/Controller/LabelController.php): `src/Controller/LabelController.php`

### Application interfaces

- [Web entry point](https://github.com/part-db/part-db-server/blob/master/public/index.php): `public/index.php`
- [Import and export](https://github.com/part-db/part-db-server/blob/master/src/Controller/PartImportExportController.php): `src/Controller/PartImportExportController.php`
- [REST API](https://github.com/part-db/part-db-server/blob/master/src/Entity/Parts/Part.php): `src/Entity/Parts/Part.php`
- [MCP tools](https://github.com/part-db/part-db-server/blob/master/src/Entity/Parts/Part.php): `src/Entity/Parts/Part.php`
- [Element lookup input](https://github.com/part-db/part-db-server/blob/master/src/Mcp/DTO/ElementByIdInput.php): `src/Mcp/DTO/ElementByIdInput.php`

### Identity and history

- [Users and groups](https://github.com/part-db/part-db-server/blob/master/src/Entity/UserSystem/User.php): `src/Entity/UserSystem/User.php`
- [Permission groups](https://github.com/part-db/part-db-server/blob/master/src/Entity/UserSystem/Group.php): `src/Entity/UserSystem/Group.php`
- [Permission management](https://github.com/part-db/part-db-server/blob/master/src/Services/UserSystem/PermissionManager.php): `src/Services/UserSystem/PermissionManager.php`
- [API token levels](https://github.com/part-db/part-db-server/blob/master/src/Entity/UserSystem/ApiTokenLevel.php): `src/Entity/UserSystem/ApiTokenLevel.php`
- [Event history](https://github.com/part-db/part-db-server/blob/master/src/Entity/LogSystem/AbstractLogEntry.php): `src/Entity/LogSystem/AbstractLogEntry.php`

### External integrations

- [Provider imports](https://github.com/part-db/part-db-server/blob/master/src/Entity/InfoProviderSystem/BulkInfoProviderImportJob.php): `src/Entity/InfoProviderSystem/BulkInfoProviderImportJob.php`
- [KiCad integration](https://github.com/part-db/part-db-server/blob/master/src/Controller/KiCadApiController.php): `src/Controller/KiCadApiController.php`
- [AI extraction](https://github.com/part-db/part-db-server/blob/master/src/Controller/InfoProviderController.php): `src/Controller/InfoProviderController.php`
- [Part information providers](https://github.com/part-db/part-db-server/blob/master/src/Controller/InfoProviderController.php): `src/Controller/InfoProviderController.php`

### Other components

- **Inventory user**
- **Configured database**

## Connections

- Inventory user → Web entry point: uses browser
- Web entry point → Parts and stock: manages inventory
- Web entry point → Part search: searches parts
- Part search → Parts and stock: queries (evidence: `src/Repository/PartRepository.php`)
- Web entry point → Projects and BOM: manages BOM
- Web entry point → Labels and scanning: creates and scans
- Web entry point → Import and export: imports and exports
- Inventory user → REST API: accesses inventory
- Inventory user → MCP tools: asks inventory questions
- MCP tools → Element lookup input: accepts lookup input (evidence: `src/Entity/Parts/Part.php`)
- Web entry point → Users and groups: authenticates users
- Users and groups → Permission groups: belongs to groups (evidence: `src/Entity/UserSystem/User.php`)
- Permission management → Users and groups: resolves permissions (evidence: `src/Services/UserSystem/PermissionManager.php`)
- Web entry point → Event history: tracks changes
- Web entry point → Provider imports: imports provider data
- Provider imports → Part information providers: retrieves part data
- Web entry point → KiCad integration: integrates KiCad
- Web entry point → AI extraction: extracts datasheet data
- Attachments → Attachment relationships: associates elements (evidence: `src/Entity/Attachments/Attachment.php`)
- Web entry point → Configured database: stores inventory
