# emiroloji/dental-erp architecture

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

- Interactive diagram: https://gitdiagram.com/emiroloji/dental-erp
- Repository: https://github.com/emiroloji/dental-erp

## Overview

Dental ERP is a multi-tenant dental-clinic inventory and management monolith. Clinic staff manage organization-scoped catalog and stock through workflows for purchasing, receipt, movement, transfers, counts and returns; reports and alerts follow from that operational data. Separate capabilities cover finance, forecasting, natural-language report queries, medical-product tracking and platform administration. The README identifies StockMovementService as the sole stock-change entry point. Connections below follow documented workflows and sampled source references; some subsystem internals were not sampled.

Main entry points: [`resources/views/pages`](https://github.com/emiroloji/dental-erp/tree/main/resources/views/pages) (Clinic workspace), [`app/Domain/Stock/Services/StockMovementService.php`](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Stock/Services/StockMovementService.php) (Stock movement gateway), [`app/Models/User.php`](https://github.com/emiroloji/dental-erp/blob/main/app/Models/User.php) (Users and permissions), [`app/Domain/Purchasing/Services/PurchaseOrderService.php`](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Purchasing/Services/PurchaseOrderService.php) (Purchasing and receipts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tenant["Tenant and access"]
  node_identity["Users and permissions<br/>[User.php]"]
  node_organization[("Organization structure<br/>[Organization.php]")]
end

subgraph group_operations["Inventory operations"]
  node_catalog[("Product catalog<br/>[Product.php]")]
  node_purchasing["Purchasing and receipts"]
  node_stock["Stock movement gateway"]
  node_stockdata[("Lots and movements<br/>[StockMovement.php]")]
  node_transfers["Branch transfers"]
  node_counts["Stock counts"]
  node_returns["Supplier returns<br/>[ReturnService.php]"]
  node_alerts["Stock alerts"]
  node_uts["Medical product tracking"]
end

subgraph group_insights["Reports and insights"]
  node_reports["Reports and exports"]
  node_forecast["Consumption forecasts"]
  node_assistant["Natural-language reports"]
end

subgraph group_finance["Finance"]
  node_financeops["Finance ledger<br/>[LedgerService.php]"]
  node_financereports["Finance reports"]
end

subgraph group_platform["Platform services"]
  node_platformadmin["Platform administration"]
  node_backups["Database backups"]
  node_audit[("Audit log<br/>[AuditLog.php]")]
end

node_staff(("Clinic staff"))
node_workspace["Clinic workspace"]

node_staff -->|"uses"| node_workspace
node_workspace -->|"authorizes through"| node_identity
node_identity -->|"scopes access"| node_organization
node_workspace -->|"manages"| node_catalog
node_workspace -->|"orders and receives"| node_purchasing
node_purchasing -->|"records receipt"| node_stock
node_workspace -->|"records stock activity"| node_stock
node_stock -->|"writes movements"| node_stockdata
node_workspace -->|"requests transfers"| node_transfers
node_workspace -->|"records counts"| node_counts
node_workspace -->|"manages returns"| node_returns
node_workspace -->|"reviews alerts"| node_alerts
node_workspace -->|"requests reports"| node_reports
node_workspace -->|"requests forecasts"| node_forecast
node_workspace -->|"asks report questions"| node_assistant
node_assistant -->|"executes report intent"| node_reports
node_workspace -->|"tracks medical products"| node_uts
node_workspace -->|"manages finances"| node_financeops
node_financeops -.->|"supplies ledger data"| node_financereports
node_workspace -->|"requests finance reports"| node_financereports
node_staff -->|"platform administration"| node_platformadmin
node_platformadmin -->|"manages organizations"| node_organization
node_stock -.->|"audits changes"| node_audit
node_workspace -.->|"administers backups"| node_backups

click node_workspace "https://github.com/emiroloji/dental-erp/tree/main/resources/views/pages"
click node_identity "https://github.com/emiroloji/dental-erp/blob/main/app/Models/User.php"
click node_organization "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Organization/Models/Organization.php"
click node_catalog "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Catalog/Models/Product.php"
click node_purchasing "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Purchasing/Services/PurchaseOrderService.php"
click node_stock "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Stock/Services/StockMovementService.php"
click node_stockdata "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Stock/Models/StockMovement.php"
click node_transfers "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Transfer/Services/TransferService.php"
click node_counts "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Inventory/Services/StockCountService.php"
click node_returns "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Returns/Services/ReturnService.php"
click node_alerts "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Stock/Services/StockAlertService.php"
click node_reports "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Reporting/Services/ReportExportService.php"
click node_forecast "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Forecasting/Services/ConsumptionForecastService.php"
click node_assistant "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Assistant/Services/NaturalQueryService.php"
click node_uts "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Uts/Services/UtsConnectionService.php"
click node_financeops "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Finance/Services/LedgerService.php"
click node_financereports "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Finance/Reports/FinanceReportExporter.php"
click node_platformadmin "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Platform/Services/OrganizationAdminService.php"
click node_backups "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Platform/Services/DatabaseBackupService.php"
click node_audit "https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Audit/Models/AuditLog.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_identity,node_organization toneBlue
class node_catalog,node_purchasing,node_stock,node_stockdata,node_transfers,node_counts,node_returns,node_alerts,node_uts toneAmber
class node_reports,node_forecast,node_assistant toneMint
class node_financeops,node_financereports toneRose
class node_platformadmin,node_backups,node_audit,node_staff toneIndigo
class node_workspace toneTeal
```

## Components

### Tenant and access

- [Users and permissions](https://github.com/emiroloji/dental-erp/blob/main/app/Models/User.php): `app/Models/User.php`
- [Organization structure](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Organization/Models/Organization.php): `app/Domain/Organization/Models/Organization.php`

### Inventory operations

- [Product catalog](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Catalog/Models/Product.php): `app/Domain/Catalog/Models/Product.php`
- [Purchasing and receipts](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Purchasing/Services/PurchaseOrderService.php): `app/Domain/Purchasing/Services/PurchaseOrderService.php`
- [Stock movement gateway](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Stock/Services/StockMovementService.php): `app/Domain/Stock/Services/StockMovementService.php`
- [Lots and movements](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Stock/Models/StockMovement.php): `app/Domain/Stock/Models/StockMovement.php`
- [Branch transfers](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Transfer/Services/TransferService.php): `app/Domain/Transfer/Services/TransferService.php`
- [Stock counts](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Inventory/Services/StockCountService.php): `app/Domain/Inventory/Services/StockCountService.php`
- [Supplier returns](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Returns/Services/ReturnService.php): `app/Domain/Returns/Services/ReturnService.php`
- [Stock alerts](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Stock/Services/StockAlertService.php): `app/Domain/Stock/Services/StockAlertService.php`
- [Medical product tracking](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Uts/Services/UtsConnectionService.php): `app/Domain/Uts/Services/UtsConnectionService.php`

### Reports and insights

- [Reports and exports](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Reporting/Services/ReportExportService.php): `app/Domain/Reporting/Services/ReportExportService.php`
- [Consumption forecasts](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Forecasting/Services/ConsumptionForecastService.php): `app/Domain/Forecasting/Services/ConsumptionForecastService.php`
- [Natural-language reports](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Assistant/Services/NaturalQueryService.php): `app/Domain/Assistant/Services/NaturalQueryService.php`

### Finance

- [Finance ledger](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Finance/Services/LedgerService.php): `app/Domain/Finance/Services/LedgerService.php`
- [Finance reports](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Finance/Reports/FinanceReportExporter.php): `app/Domain/Finance/Reports/FinanceReportExporter.php`

### Platform services

- [Platform administration](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Platform/Services/OrganizationAdminService.php): `app/Domain/Platform/Services/OrganizationAdminService.php`
- [Database backups](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Platform/Services/DatabaseBackupService.php): `app/Domain/Platform/Services/DatabaseBackupService.php`
- [Audit log](https://github.com/emiroloji/dental-erp/blob/main/app/Domain/Audit/Models/AuditLog.php): `app/Domain/Audit/Models/AuditLog.php`

### Other components

- **Clinic staff**
- [Clinic workspace](https://github.com/emiroloji/dental-erp/tree/main/resources/views/pages): `resources/views/pages`

## Connections

- Clinic staff → Clinic workspace: uses (evidence: `README.md`)
- Clinic workspace → Users and permissions: authorizes through
- Users and permissions → Organization structure: scopes access (evidence: `app/Models/User.php`)
- Clinic workspace → Product catalog: manages (evidence: `README.md`)
- Clinic workspace → Purchasing and receipts: orders and receives (evidence: `README.md`)
- Purchasing and receipts → Stock movement gateway: records receipt (evidence: `app/Domain/Purchasing/Services/PurchaseOrderService.php`)
- Clinic workspace → Stock movement gateway: records stock activity (evidence: `README.md`)
- Stock movement gateway → Lots and movements: writes movements (evidence: `app/Domain/Stock/Services/StockMovementService.php`)
- Clinic workspace → Branch transfers: requests transfers (evidence: `README.md`)
- Clinic workspace → Stock counts: records counts (evidence: `README.md`)
- Clinic workspace → Supplier returns: manages returns (evidence: `README.md`)
- Clinic workspace → Stock alerts: reviews alerts (evidence: `README.md`)
- Clinic workspace → Reports and exports: requests reports (evidence: `README.md`)
- Clinic workspace → Consumption forecasts: requests forecasts (evidence: `README.md`)
- Clinic workspace → Natural-language reports: asks report questions (evidence: `README.md`)
- Natural-language reports → Reports and exports: executes report intent (evidence: `app/Domain/Assistant/Services/NaturalQueryService.php`)
- Clinic workspace → Medical product tracking: tracks medical products (evidence: `README.md`)
- Clinic workspace → Finance ledger: manages finances (evidence: `README.md`)
- Finance ledger → Finance reports: supplies ledger data
- Clinic workspace → Finance reports: requests finance reports (evidence: `README.md`)
- Clinic staff → Platform administration: platform administration (evidence: `README.md`)
- Platform administration → Organization structure: manages organizations (evidence: `README.md`)
- Stock movement gateway → Audit log: audits changes
- Clinic workspace → Database backups: administers backups
