# legialam-gif/modern-admin-management-system architecture

> Architecture diagram of the GitHub repository legialam-gif/modern-admin-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/legialam-gif/modern-admin-management-system
- Repository: https://github.com/legialam-gif/modern-admin-management-system

## Overview

This is a PHP/MySQL admin application for managing products and the operational data around them. The main workflow is an authenticated admin request routed through the front controller, which checks access, invokes a domain repository, and renders a view; order creation additionally checks stock and records inventory changes within a transaction. The README also documents catalog export, analytics, password reset, activity logs, and a session-protected JSON API. Some routes and repositories were not sampled, so only evidenced calls are shown; the documented but unsampled export path is left unlinked.

Main entry points: [`app/public/index.php`](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/public/index.php) (Request router), [`app/src/db.php`](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/db.php) (PDO connection), [`app/src/auth.php`](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/auth.php) (Admin auth), [`app/views`](https://github.com/legialam-gif/modern-admin-management-system/tree/main/app/views) (Admin views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and routing"]
  node_front["Request router<br/>[index.php]"]
  node_auth["Admin auth<br/>[auth.php]"]
  node_reset["Password reset<br/>[password_reset.php]"]
  node_api["JSON API<br/>[api.php]"]
  node_views["Admin views"]
end

subgraph group_catalog["Catalog management"]
  node_categories["Categories"]
  node_brands["Brands"]
  node_products["Products and images"]
  node_export["Product export<br/>[excel_export.php]"]
end

subgraph group_sales["Orders and customers"]
  node_orders["Order processing"]
  node_customers["Customers"]
end

subgraph group_operations["Inventory and insights"]
  node_inventory["Stock movements"]
  node_dashboard["Sales analytics"]
  node_activity["Activity logs"]
end

subgraph group_platform["Shared services"]
  node_db["PDO connection<br/>[db.php]"]
  node_config["Configuration<br/>[config.php]"]
  node_mysql[("MySQL")]
end

node_admin(("Admin"))

node_admin -->|"sends requests"| node_front
node_front -->|"checks access"| node_auth
node_front -->|"loads"| node_reset
node_front -->|"dispatches API"| node_api
node_front -->|"requests report"| node_dashboard
node_front -->|"reads logs"| node_activity
node_front -->|"creates movement"| node_inventory
node_front -->|"requests products"| node_orders
node_front -->|"renders dashboard"| node_views
node_front -->|"renders activity log"| node_views
node_front -->|"renders inventory"| node_views
node_front -->|"renders order form"| node_views
node_db -->|"loads settings"| node_config
node_db -->|"connects"| node_mysql
node_categories -->|"queries"| node_db
node_brands -->|"queries"| node_db
node_products -->|"queries"| node_db
node_orders -->|"transactions"| node_db
node_customers -->|"queries"| node_db
node_inventory -->|"transactions"| node_db
node_dashboard -->|"queries"| node_db
node_activity -->|"queries"| node_db
node_auth -->|"queries"| node_db
node_auth -->|"loads settings"| node_config
node_auth -->|"uses session"| node_admin
node_front -.->|"exports filtered products"| node_export

click node_front "https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/public/index.php"
click node_auth "https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/auth.php"
click node_reset "https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/password_reset.php"
click node_api "https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/api.php"
click node_views "https://github.com/legialam-gif/modern-admin-management-system/tree/main/app/views"
click node_categories "https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/category_repository.php"
click node_brands "https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/brand_repository.php"
click node_products "https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/product_repository.php"
click node_export "https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/excel_export.php"
click node_orders "https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/order_repository.php"
click node_customers "https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/customer_repository.php"
click node_inventory "https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/inventory_repository.php"
click node_dashboard "https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/dashboard_repository.php"
click node_activity "https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/activity_repository.php"
click node_db "https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/db.php"
click node_config "https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/config.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_front,node_auth,node_reset,node_api,node_views toneBlue
class node_categories,node_brands,node_products,node_export toneAmber
class node_orders,node_customers toneMint
class node_inventory,node_dashboard,node_activity toneRose
class node_db,node_config,node_mysql,node_admin toneIndigo
```

## Components

### Access and routing

- [Request router](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/public/index.php): `app/public/index.php`
- [Admin auth](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/auth.php): `app/src/auth.php`
- [Password reset](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/password_reset.php): `app/src/password_reset.php`
- [JSON API](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/api.php): `app/src/api.php`
- [Admin views](https://github.com/legialam-gif/modern-admin-management-system/tree/main/app/views): `app/views`

### Catalog management

- [Categories](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/category_repository.php): `app/src/category_repository.php`
- [Brands](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/brand_repository.php): `app/src/brand_repository.php`
- [Products and images](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/product_repository.php): `app/src/product_repository.php`
- [Product export](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/excel_export.php): `app/src/excel_export.php`

### Orders and customers

- [Order processing](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/order_repository.php): `app/src/order_repository.php`
- [Customers](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/customer_repository.php): `app/src/customer_repository.php`

### Inventory and insights

- [Stock movements](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/inventory_repository.php): `app/src/inventory_repository.php`
- [Sales analytics](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/dashboard_repository.php): `app/src/dashboard_repository.php`
- [Activity logs](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/activity_repository.php): `app/src/activity_repository.php`

### Shared services

- [PDO connection](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/db.php): `app/src/db.php`
- [Configuration](https://github.com/legialam-gif/modern-admin-management-system/blob/main/app/src/config.php): `app/src/config.php`
- **MySQL**

### Other components

- **Admin**

## Connections

- Admin → Request router: sends requests
- Request router → Admin auth: checks access (evidence: `app/public/index.php`)
- Request router → Password reset: loads (evidence: `app/public/index.php`)
- Request router → JSON API: dispatches API (evidence: `app/public/index.php`)
- Request router → Sales analytics: requests report (evidence: `app/public/index.php`)
- Request router → Activity logs: reads logs (evidence: `app/public/index.php`)
- Request router → Stock movements: creates movement (evidence: `app/public/index.php`)
- Request router → Order processing: requests products (evidence: `app/public/index.php`)
- Request router → Admin views: renders dashboard (evidence: `app/public/index.php`)
- Request router → Admin views: renders activity log (evidence: `app/public/index.php`)
- Request router → Admin views: renders inventory (evidence: `app/public/index.php`)
- Request router → Admin views: renders order form (evidence: `app/public/index.php`)
- PDO connection → Configuration: loads settings (evidence: `app/src/db.php`)
- PDO connection → MySQL: connects (evidence: `app/src/db.php`)
- Categories → PDO connection: queries (evidence: `app/src/category_repository.php`)
- Brands → PDO connection: queries (evidence: `app/src/brand_repository.php`)
- Products and images → PDO connection: queries (evidence: `app/src/product_repository.php`)
- Order processing → PDO connection: transactions (evidence: `app/src/order_repository.php`)
- Customers → PDO connection: queries (evidence: `app/src/customer_repository.php`)
- Stock movements → PDO connection: transactions (evidence: `app/src/inventory_repository.php`)
- Sales analytics → PDO connection: queries (evidence: `app/src/dashboard_repository.php`)
- Activity logs → PDO connection: queries (evidence: `app/src/activity_repository.php`)
- Admin auth → PDO connection: queries (evidence: `app/src/auth.php`)
- Admin auth → Configuration: loads settings (evidence: `app/src/auth.php`)
- Admin auth → Admin: uses session (evidence: `app/src/auth.php`)
- Request router → Product export: exports filtered products (evidence: `app/public/index.php`)
