# tahasinx/project_pharmax architecture

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

- Interactive diagram: https://gitdiagram.com/tahasinx/project_pharmax
- Repository: https://github.com/tahasinx/project_pharmax

## Overview

Pharmax is a pharmacy-management application with a session-authenticated Laravel backend and Inertia/Vue interface. Users sign in, then manage pharmacy operations—catalog, purchasing and stock, dispensing/POS and invoices, and finance/reporting—through server-driven pages. A separate platform-admin area manages tenant companies, provisioning, backups, schema upgrades, and billing. The README documents the major screens and capabilities; sampled source confirms Inertia rendering and some inventory/accounting operations, but does not expose every controller’s internal call graph, so uncertain subsystem wiring is omitted.

Main entry points: [`routes/web.php`](https://github.com/tahasinx/project_pharmax/blob/master/routes/web.php) (Web routes), [`resources/js/app.js`](https://github.com/tahasinx/project_pharmax/blob/master/resources/js/app.js) (Inertia app shell), [`app/Models`](https://github.com/tahasinx/project_pharmax/tree/master/app/Models) (Eloquent domain models), [`app/Http/Controllers/StockController.php`](https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/StockController.php) (Stock operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_routes["Web routes<br/>[web.php]"]
  node_auth["Session authentication"]
  node_pharmacy_ui["Pharmacy interface"]
  node_platform_ui["Platform interface"]
  node_inertia["Inertia app shell<br/>[app.js]"]
end

subgraph group_pharmacy["Pharmacy operations"]
  node_catalog["Catalog and customers"]
  node_purchasing["Purchasing"]
  node_inventory["Stock operations"]
  node_pos["Sales and invoices"]
  node_prescriptions["Prescriptions and compliance"]
  node_inventory_rules["Inventory allocation<br/>[FefoAllocator.php]"]
end

subgraph group_finance["Finance and oversight"]
  node_reports["Reports and dashboard"]
  node_accounting["Ledger posting<br/>[JournalPoster.php]"]
  node_audit["Audit recording<br/>[AuditRecorder.php]"]
  node_exports["Data import and export"]
end

subgraph group_platform["Tenant platform"]
  node_tenant_admin["Company administration"]
  node_tenant_provisioner["Tenant provisioning"]
  node_tenant_ops["Platform operations"]
end

subgraph group_state["Application state"]
  node_models["Eloquent domain models"]
  node_mysql[("MySQL databases")]
end

node_user(("Pharmacy user"))
node_platform_admin(("Platform admin"))

node_user -->|"opens screens"| node_routes
node_platform_admin -->|"opens screens"| node_routes
node_routes -->|"dispatches login"| node_auth
node_auth -->|"renders login"| node_inertia
node_auth -->|"redirects home"| node_routes
node_routes -->|"dispatches requests"| node_catalog
node_routes -->|"dispatches requests"| node_purchasing
node_routes -->|"dispatches requests"| node_inventory
node_routes -->|"dispatches requests"| node_pos
node_routes -->|"dispatches requests"| node_prescriptions
node_routes -->|"dispatches requests"| node_reports
node_routes -->|"dispatches requests"| node_exports
node_routes -->|"dispatches requests"| node_tenant_admin
node_routes -->|"dispatches requests"| node_tenant_ops
node_catalog -->|"renders pages"| node_inertia
node_purchasing -->|"renders pages"| node_inertia
node_inventory -->|"renders pages"| node_inertia
node_pos -->|"renders pages"| node_inertia
node_prescriptions -->|"renders pages"| node_inertia
node_reports -->|"renders pages"| node_inertia
node_tenant_admin -->|"renders pages"| node_inertia
node_tenant_ops -->|"renders pages"| node_inertia
node_inertia -->|"resolves pages"| node_pharmacy_ui
node_inertia -->|"resolves pages"| node_platform_ui
node_catalog -->|"reads and writes"| node_models
node_purchasing -->|"reads and writes"| node_models
node_inventory -->|"reads and writes"| node_models
node_pos -->|"reads and writes"| node_models
node_prescriptions -->|"reads and writes"| node_models
node_reports -->|"queries records"| node_models
node_models -->|"persists records"| node_mysql
node_inventory -->|"allocates stock"| node_inventory_rules
node_prescriptions -->|"posts entries"| node_accounting
node_tenant_admin -->|"starts provisioning"| node_tenant_provisioner
node_tenant_admin -->|"manages companies"| node_models
node_tenant_ops -->|"reads company data"| node_models
node_exports -->|"imports or exports"| node_models

click node_routes "https://github.com/tahasinx/project_pharmax/blob/master/routes/web.php"
click node_auth "https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/Auth/AuthenticatedSessionController.php"
click node_pharmacy_ui "https://github.com/tahasinx/project_pharmax/tree/master/resources/js/Pages"
click node_platform_ui "https://github.com/tahasinx/project_pharmax/tree/master/resources/js/Pages/Platform"
click node_inertia "https://github.com/tahasinx/project_pharmax/blob/master/resources/js/app.js"
click node_catalog "https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/MedicineController.php"
click node_purchasing "https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/PurchaseController.php"
click node_inventory "https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/StockController.php"
click node_pos "https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/InvoiceController.php"
click node_prescriptions "https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/PharmacyController.php"
click node_inventory_rules "https://github.com/tahasinx/project_pharmax/blob/master/app/Domain/Inventory/FefoAllocator.php"
click node_reports "https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/ReportController.php"
click node_accounting "https://github.com/tahasinx/project_pharmax/blob/master/app/Domain/Finance/JournalPoster.php"
click node_audit "https://github.com/tahasinx/project_pharmax/blob/master/app/Domain/Audit/AuditRecorder.php"
click node_exports "https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/DataExportController.php"
click node_tenant_admin "https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/Platform/CompanyController.php"
click node_tenant_provisioner "https://github.com/tahasinx/project_pharmax/blob/master/app/Services/Platform/CompanyProvisioner.php"
click node_tenant_ops "https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/Platform/OperationsController.php"
click node_models "https://github.com/tahasinx/project_pharmax/tree/master/app/Models"

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_pharmacy_ui,node_platform_ui,node_inertia,node_user toneBlue
class node_catalog,node_purchasing,node_inventory,node_pos,node_prescriptions,node_inventory_rules toneAmber
class node_reports,node_accounting,node_audit,node_exports toneMint
class node_tenant_admin,node_tenant_provisioner,node_tenant_ops toneRose
class node_models,node_mysql,node_platform_admin toneIndigo
```

## Components

### Web application

- [Web routes](https://github.com/tahasinx/project_pharmax/blob/master/routes/web.php): `routes/web.php`
- [Session authentication](https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/Auth/AuthenticatedSessionController.php): `app/Http/Controllers/Auth/AuthenticatedSessionController.php`
- [Pharmacy interface](https://github.com/tahasinx/project_pharmax/tree/master/resources/js/Pages): `resources/js/Pages`
- [Platform interface](https://github.com/tahasinx/project_pharmax/tree/master/resources/js/Pages/Platform): `resources/js/Pages/Platform`
- [Inertia app shell](https://github.com/tahasinx/project_pharmax/blob/master/resources/js/app.js): `resources/js/app.js`

### Pharmacy operations

- [Catalog and customers](https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/MedicineController.php): `app/Http/Controllers/MedicineController.php`
- [Purchasing](https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/PurchaseController.php): `app/Http/Controllers/PurchaseController.php`
- [Stock operations](https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/StockController.php): `app/Http/Controllers/StockController.php`
- [Sales and invoices](https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/InvoiceController.php): `app/Http/Controllers/InvoiceController.php`
- [Prescriptions and compliance](https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/PharmacyController.php): `app/Http/Controllers/PharmacyController.php`
- [Inventory allocation](https://github.com/tahasinx/project_pharmax/blob/master/app/Domain/Inventory/FefoAllocator.php): `app/Domain/Inventory/FefoAllocator.php`

### Finance and oversight

- [Reports and dashboard](https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/ReportController.php): `app/Http/Controllers/ReportController.php`
- [Ledger posting](https://github.com/tahasinx/project_pharmax/blob/master/app/Domain/Finance/JournalPoster.php): `app/Domain/Finance/JournalPoster.php`
- [Audit recording](https://github.com/tahasinx/project_pharmax/blob/master/app/Domain/Audit/AuditRecorder.php): `app/Domain/Audit/AuditRecorder.php`
- [Data import and export](https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/DataExportController.php): `app/Http/Controllers/DataExportController.php`

### Tenant platform

- [Company administration](https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/Platform/CompanyController.php): `app/Http/Controllers/Platform/CompanyController.php`
- [Tenant provisioning](https://github.com/tahasinx/project_pharmax/blob/master/app/Services/Platform/CompanyProvisioner.php): `app/Services/Platform/CompanyProvisioner.php`
- [Platform operations](https://github.com/tahasinx/project_pharmax/blob/master/app/Http/Controllers/Platform/OperationsController.php): `app/Http/Controllers/Platform/OperationsController.php`

### Application state

- [Eloquent domain models](https://github.com/tahasinx/project_pharmax/tree/master/app/Models): `app/Models`
- **MySQL databases**

### Other components

- **Pharmacy user**
- **Platform admin**

## Connections

- Pharmacy user → Web routes: opens screens
- Platform admin → Web routes: opens screens
- Web routes → Session authentication: dispatches login
- Session authentication → Inertia app shell: renders login
- Session authentication → Web routes: redirects home
- Web routes → Catalog and customers: dispatches requests
- Web routes → Purchasing: dispatches requests
- Web routes → Stock operations: dispatches requests
- Web routes → Sales and invoices: dispatches requests
- Web routes → Prescriptions and compliance: dispatches requests
- Web routes → Reports and dashboard: dispatches requests
- Web routes → Data import and export: dispatches requests
- Web routes → Company administration: dispatches requests
- Web routes → Platform operations: dispatches requests
- Catalog and customers → Inertia app shell: renders pages
- Purchasing → Inertia app shell: renders pages
- Stock operations → Inertia app shell: renders pages
- Sales and invoices → Inertia app shell: renders pages
- Prescriptions and compliance → Inertia app shell: renders pages
- Reports and dashboard → Inertia app shell: renders pages
- Company administration → Inertia app shell: renders pages
- Platform operations → Inertia app shell: renders pages
- Inertia app shell → Pharmacy interface: resolves pages
- Inertia app shell → Platform interface: resolves pages
- Catalog and customers → Eloquent domain models: reads and writes
- Purchasing → Eloquent domain models: reads and writes
- Stock operations → Eloquent domain models: reads and writes
- Sales and invoices → Eloquent domain models: reads and writes
- Prescriptions and compliance → Eloquent domain models: reads and writes
- Reports and dashboard → Eloquent domain models: queries records
- Eloquent domain models → MySQL databases: persists records
- Stock operations → Inventory allocation: allocates stock
- Prescriptions and compliance → Ledger posting: posts entries
- Company administration → Tenant provisioning: starts provisioning
- Company administration → Eloquent domain models: manages companies
- Platform operations → Eloquent domain models: reads company data
- Data import and export → Eloquent domain models: imports or exports
