# reyansmith/medivault architecture

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

- Interactive diagram: https://gitdiagram.com/reyansmith/medivault
- Repository: https://github.com/reyansmith/medivault

## Overview

Mannath Medicals is a PHP/MySQL pharmacy management application. Users enter through login, where roles determine access to administrator or employee workflows: employees handle billing, inventory, dashboards and reports; administrators manage inventory, purchases, vendors, employees and reporting. Both areas use the shared database connection and common page layout. The README documents the broader module set; unsampled modules are represented by their exact tree paths, while their internal calls are not inferred. Edges reflect shown imports, calls, navigation or README-described behavior.

Main entry points: [`config/database.php`](https://github.com/reyansmith/medivault/blob/main/config/database.php) (Database connection), [`includes/sidebar.php`](https://github.com/reyansmith/medivault/blob/main/includes/sidebar.php) (Role navigation), [`employee/dashboard.php`](https://github.com/reyansmith/medivault/blob/main/employee/dashboard.php) (Employee dashboard), [`admin/inventory.php`](https://github.com/reyansmith/medivault/blob/main/admin/inventory.php) (Inventory management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_auth["Access and sessions"]
  node_entry["Application entry<br/>[index.php]"]
  node_login["Role login<br/>[login.php]"]
  node_session["Session audit<br/>[session_audit.php]"]
  node_logout["Session logout<br/>[logout.php]"]
end

subgraph group_employee["Employee operations"]
  node_employee_dashboard["Employee dashboard<br/>[dashboard.php]"]
  node_billing["Billing<br/>[billing.php]"]
  node_employee_inventory["Inventory view<br/>[inventory.php]"]
  node_employee_reports["Employee reports<br/>[reports.php]"]
  node_employee_sales_data["Sales chart data"]
end

subgraph group_admin["Administration"]
  node_admin_dashboard["Admin dashboard<br/>[dashboard.php]"]
  node_admin_sales_data["Sales chart data"]
  node_admin_inventory["Inventory management<br/>[inventory.php]"]
  node_purchases["Purchase management<br/>[purchases.php]"]
  node_create_purchase["Record purchase"]
  node_vendors["Vendor management<br/>[vendors.php]"]
  node_admin_employees["Employee management<br/>[employees.php]"]
  node_admin_reports["Admin reports<br/>[reports.php]"]
  node_report_generation["Generate report"]
end

subgraph group_shared["Shared services"]
  node_header["Page header<br/>[header.php]"]
  node_sidebar["Role navigation<br/>[sidebar.php]"]
  node_footer["Page footer and charts<br/>[footer.php]"]
  node_database_config["Database connection<br/>[database.php]"]
end

node_user(("User"))
node_mysql[("MySQL database")]

node_user -->|"opens app"| node_entry
node_entry -->|"redirects to"| node_login
node_user -->|"submits credentials"| node_login
node_login -->|"queries accounts"| node_database_config
node_login -->|"records employee session"| node_session
node_user -->|"requests logout"| node_logout
node_logout -->|"closes session"| node_session
node_employee_dashboard -->|"enforces session rules"| node_session
node_employee_inventory -->|"enforces session rules"| node_session
node_employee_reports -->|"enforces session rules"| node_session
node_billing -->|"uses connection"| node_database_config
node_employee_inventory -->|"uses connection"| node_database_config
node_employee_reports -->|"uses connection"| node_database_config
node_employee_dashboard -->|"uses connection"| node_database_config
node_employee_dashboard -.->|"loads chart data"| node_employee_sales_data
node_admin_dashboard -->|"loads chart data"| node_admin_sales_data
node_admin_inventory -->|"uses connection"| node_database_config
node_create_purchase -->|"uses connection"| node_database_config
node_purchases -->|"uses connection"| node_database_config
node_vendors -->|"uses connection"| node_database_config
node_admin_employees -->|"uses connection"| node_database_config
node_admin_reports -->|"queries metrics"| node_database_config
node_report_generation -->|"uses connection"| node_database_config
node_admin_dashboard -->|"uses connection"| node_database_config
node_database_config -->|"connects to"| node_mysql
node_admin_inventory -->|"includes"| node_header
node_admin_inventory -->|"includes"| node_sidebar
node_admin_inventory -->|"includes"| node_footer
node_employee_inventory -->|"includes"| node_footer
node_employee_dashboard -->|"includes"| node_footer
node_admin_dashboard -->|"includes"| node_footer
node_sidebar -->|"links to"| node_employee_dashboard
node_sidebar -->|"links to"| node_billing
node_sidebar -->|"links to"| node_employee_inventory
node_sidebar -->|"links to"| node_employee_reports
node_sidebar -->|"links to"| node_admin_inventory
node_sidebar -->|"links to"| node_purchases
node_sidebar -->|"links to"| node_vendors
node_sidebar -->|"links to"| node_admin_employees
node_sidebar -->|"links to"| node_admin_reports

click node_entry "https://github.com/reyansmith/medivault/blob/main/index.php"
click node_login "https://github.com/reyansmith/medivault/blob/main/auth/login.php"
click node_session "https://github.com/reyansmith/medivault/blob/main/includes/session_audit.php"
click node_logout "https://github.com/reyansmith/medivault/blob/main/auth/logout.php"
click node_employee_dashboard "https://github.com/reyansmith/medivault/blob/main/employee/dashboard.php"
click node_billing "https://github.com/reyansmith/medivault/blob/main/employee/billing.php"
click node_employee_inventory "https://github.com/reyansmith/medivault/blob/main/employee/inventory.php"
click node_employee_reports "https://github.com/reyansmith/medivault/blob/main/employee/reports.php"
click node_employee_sales_data "https://github.com/reyansmith/medivault/blob/main/employee/dashboard_sales_data.php"
click node_admin_dashboard "https://github.com/reyansmith/medivault/blob/main/admin/dashboard.php"
click node_admin_sales_data "https://github.com/reyansmith/medivault/blob/main/admin/dashboard_sales_data.php"
click node_admin_inventory "https://github.com/reyansmith/medivault/blob/main/admin/inventory.php"
click node_purchases "https://github.com/reyansmith/medivault/blob/main/admin/purchases.php"
click node_create_purchase "https://github.com/reyansmith/medivault/blob/main/admin/create_purchase.php"
click node_vendors "https://github.com/reyansmith/medivault/blob/main/admin/vendors.php"
click node_admin_employees "https://github.com/reyansmith/medivault/blob/main/admin/employees.php"
click node_admin_reports "https://github.com/reyansmith/medivault/blob/main/admin/reports.php"
click node_report_generation "https://github.com/reyansmith/medivault/blob/main/admin/generate_report.php"
click node_header "https://github.com/reyansmith/medivault/blob/main/includes/header.php"
click node_sidebar "https://github.com/reyansmith/medivault/blob/main/includes/sidebar.php"
click node_footer "https://github.com/reyansmith/medivault/blob/main/includes/footer.php"
click node_database_config "https://github.com/reyansmith/medivault/blob/main/config/database.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_entry,node_login,node_session,node_logout,node_user toneBlue
class node_employee_dashboard,node_billing,node_employee_inventory,node_employee_reports,node_employee_sales_data,node_mysql toneAmber
class node_admin_dashboard,node_admin_sales_data,node_admin_inventory,node_purchases,node_create_purchase,node_vendors,node_admin_employees,node_admin_reports,node_report_generation toneMint
class node_header,node_sidebar,node_footer,node_database_config toneRose
```

## Components

### Access and sessions

- [Application entry](https://github.com/reyansmith/medivault/blob/main/index.php): `index.php`
- [Role login](https://github.com/reyansmith/medivault/blob/main/auth/login.php): `auth/login.php`
- [Session audit](https://github.com/reyansmith/medivault/blob/main/includes/session_audit.php): `includes/session_audit.php`
- [Session logout](https://github.com/reyansmith/medivault/blob/main/auth/logout.php): `auth/logout.php`

### Employee operations

- [Employee dashboard](https://github.com/reyansmith/medivault/blob/main/employee/dashboard.php): `employee/dashboard.php`
- [Billing](https://github.com/reyansmith/medivault/blob/main/employee/billing.php): `employee/billing.php`
- [Inventory view](https://github.com/reyansmith/medivault/blob/main/employee/inventory.php): `employee/inventory.php`
- [Employee reports](https://github.com/reyansmith/medivault/blob/main/employee/reports.php): `employee/reports.php`
- [Sales chart data](https://github.com/reyansmith/medivault/blob/main/employee/dashboard_sales_data.php): `employee/dashboard_sales_data.php`

### Administration

- [Admin dashboard](https://github.com/reyansmith/medivault/blob/main/admin/dashboard.php): `admin/dashboard.php`
- [Sales chart data](https://github.com/reyansmith/medivault/blob/main/admin/dashboard_sales_data.php): `admin/dashboard_sales_data.php`
- [Inventory management](https://github.com/reyansmith/medivault/blob/main/admin/inventory.php): `admin/inventory.php`
- [Purchase management](https://github.com/reyansmith/medivault/blob/main/admin/purchases.php): `admin/purchases.php`
- [Record purchase](https://github.com/reyansmith/medivault/blob/main/admin/create_purchase.php): `admin/create_purchase.php`
- [Vendor management](https://github.com/reyansmith/medivault/blob/main/admin/vendors.php): `admin/vendors.php`
- [Employee management](https://github.com/reyansmith/medivault/blob/main/admin/employees.php): `admin/employees.php`
- [Admin reports](https://github.com/reyansmith/medivault/blob/main/admin/reports.php): `admin/reports.php`
- [Generate report](https://github.com/reyansmith/medivault/blob/main/admin/generate_report.php): `admin/generate_report.php`

### Shared services

- [Page header](https://github.com/reyansmith/medivault/blob/main/includes/header.php): `includes/header.php`
- [Role navigation](https://github.com/reyansmith/medivault/blob/main/includes/sidebar.php): `includes/sidebar.php`
- [Page footer and charts](https://github.com/reyansmith/medivault/blob/main/includes/footer.php): `includes/footer.php`
- [Database connection](https://github.com/reyansmith/medivault/blob/main/config/database.php): `config/database.php`

### Other components

- **User**
- **MySQL database**

## Connections

- User → Application entry: opens app (evidence: `README.md`)
- Application entry → Role login: redirects to (evidence: `README.md`)
- User → Role login: submits credentials (evidence: `README.md`)
- Role login → Database connection: queries accounts (evidence: `auth/login.php`)
- Role login → Session audit: records employee session (evidence: `auth/login.php`)
- User → Session logout: requests logout (evidence: `README.md`)
- Session logout → Session audit: closes session (evidence: `auth/logout.php`)
- Employee dashboard → Session audit: enforces session rules (evidence: `employee/dashboard.php`)
- Inventory view → Session audit: enforces session rules (evidence: `employee/inventory.php`)
- Employee reports → Session audit: enforces session rules (evidence: `employee/reports.php`)
- Billing → Database connection: uses connection (evidence: `employee/billing.php`)
- Inventory view → Database connection: uses connection (evidence: `employee/inventory.php`)
- Employee reports → Database connection: uses connection (evidence: `employee/reports.php`)
- Employee dashboard → Database connection: uses connection (evidence: `employee/dashboard.php`)
- Employee dashboard → Sales chart data: loads chart data
- Admin dashboard → Sales chart data: loads chart data
- Inventory management → Database connection: uses connection (evidence: `admin/inventory.php`)
- Record purchase → Database connection: uses connection (evidence: `admin/create_purchase.php`)
- Purchase management → Database connection: uses connection (evidence: `admin/purchases.php`)
- Vendor management → Database connection: uses connection (evidence: `admin/vendors.php`)
- Employee management → Database connection: uses connection (evidence: `admin/employees.php`)
- Admin reports → Database connection: queries metrics (evidence: `admin/reports.php`)
- Generate report → Database connection: uses connection (evidence: `admin/generate_report.php`)
- Admin dashboard → Database connection: uses connection (evidence: `admin/dashboard.php`)
- Database connection → MySQL database: connects to (evidence: `config/database.php`)
- Inventory management → Page header: includes (evidence: `admin/inventory.php`)
- Inventory management → Role navigation: includes (evidence: `admin/inventory.php`)
- Inventory management → Page footer and charts: includes (evidence: `admin/inventory.php`)
- Inventory view → Page footer and charts: includes (evidence: `employee/inventory.php`)
- Employee dashboard → Page footer and charts: includes (evidence: `employee/dashboard.php`)
- Admin dashboard → Page footer and charts: includes (evidence: `admin/dashboard.php`)
- Role navigation → Employee dashboard: links to (evidence: `includes/sidebar.php`)
- Role navigation → Billing: links to (evidence: `includes/sidebar.php`)
- Role navigation → Inventory view: links to (evidence: `includes/sidebar.php`)
- Role navigation → Employee reports: links to (evidence: `includes/sidebar.php`)
- Role navigation → Inventory management: links to (evidence: `includes/sidebar.php`)
- Role navigation → Purchase management: links to (evidence: `includes/sidebar.php`)
- Role navigation → Vendor management: links to (evidence: `includes/sidebar.php`)
- Role navigation → Employee management: links to (evidence: `includes/sidebar.php`)
- Role navigation → Admin reports: links to (evidence: `includes/sidebar.php`)
