# nikrishdulal2006/ims architecture

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

- Interactive diagram: https://gitdiagram.com/nikrishdulal2006/ims
- Repository: https://github.com/nikrishdulal2006/ims

## Overview

IMS Nepal is a PHP/MySQL inventory and sales application for administrators and staff. Users sign in, then administrators manage products, stock, sales, alerts, staff, and reports; staff can record sales and view their own sales and bills. Sale recording updates stock and movement history and can raise stock alerts. Separate public pages introduce the product, while account flows include registration and email-based password recovery. The graph follows shown controller dispatch and shared-function calls; some view and login-action wiring is not visible in the excerpts.

Main entry points: [`dashboard.php`](https://github.com/nikrishdulal2006/ims/blob/main/dashboard.php) (Admin dashboard entry), [`dashboard/handlers.php`](https://github.com/nikrishdulal2006/ims/blob/main/dashboard/handlers.php) (POST dispatch), [`Staff_dashboard.php`](https://github.com/nikrishdulal2006/ims/blob/main/Staff_dashboard.php) (Staff dashboard), [`signin.php`](https://github.com/nikrishdulal2006/ims/blob/main/signin.php) (Sign-in entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public site"]
  node_landing["Product landing<br/>[index.php]"]
  node_public_pages["About and contact"]
end

subgraph group_identity["Accounts"]
  node_signin["Sign-in entry<br/>[signin.php]"]
  node_login_boot["Login setup<br/>[bootstrap.php]"]
  node_login_view["Login and recovery UI<br/>[login_page.php]"]
  node_authenticate["Authentication action<br/>[authenticate.php]"]
  node_register["Registration action<br/>[register.php]"]
  node_recovery["Password recovery actions"]
end

subgraph group_admin["Administrator"]
  node_admin_entry["Admin dashboard entry<br/>[dashboard.php]"]
  node_admin_dispatch["POST dispatch<br/>[handlers.php]"]
  node_staff_actions["Staff account actions<br/>[staff.php]"]
  node_admin_filters["Report filters<br/>[filters.php]"]
  node_admin_stats["Dashboard statistics<br/>[stats.php]"]
end

subgraph group_operations["Inventory and sales"]
  node_product_actions["Product and stock actions<br/>[products.php]"]
  node_sales_actions["Sales actions<br/>[sales.php]"]
  node_notification_actions["Alert actions<br/>[notifications.php]"]
  node_admin_views["Inventory and sales views"]
  node_staff_entry["Staff dashboard"]
  node_staff_views["Staff sales views"]
end

subgraph group_shared["Shared services"]
  node_messages["Status messages<br/>[messages.php]"]
  node_auth["Session and CSRF<br/>[auth.php]"]
  node_business_rules["Sales and stock rules<br/>[functions.php]"]
  node_invoice["Bills and invoices<br/>[invoice.php]"]
  node_mailer["Email delivery<br/>[Mailer.php]"]
  node_db_connection["PDO connection<br/>[connector.php]"]
  node_schema_upgrade["Schema migration<br/>[migrations.php]"]
end

node_visitor(("Visitor"))
node_admin_user(("Administrator"))
node_staff_user(("Staff member"))
node_database[("IMS database")]

node_visitor -->|"opens"| node_landing
node_landing -->|"links to"| node_public_pages
node_landing -->|"offers sign-in"| node_signin
node_visitor -->|"opens"| node_signin
node_signin -->|"loads setup"| node_login_boot
node_signin -->|"loads auth"| node_auth
node_signin -->|"renders"| node_login_view
node_login_boot -->|"loads connection"| node_db_connection
node_login_boot -->|"loads mailer"| node_mailer
node_login_view -.->|"submits login"| node_authenticate
node_login_view -.->|"submits registration"| node_register
node_login_view -.->|"submits recovery"| node_recovery
node_admin_user -->|"opens"| node_admin_entry
node_admin_entry -->|"loads auth"| node_auth
node_admin_entry -->|"loads controller"| node_admin_dispatch
node_admin_entry -->|"loads filters"| node_admin_filters
node_admin_entry -->|"loads statistics"| node_admin_stats
node_admin_entry -->|"renders messages"| node_messages
node_admin_entry -->|"loads connection"| node_db_connection
node_admin_dispatch -->|"dispatches"| node_product_actions
node_admin_dispatch -->|"dispatches"| node_sales_actions
node_admin_dispatch -->|"dispatches"| node_notification_actions
node_admin_dispatch -->|"dispatches"| node_staff_actions
node_admin_dispatch -->|"uses rules"| node_business_rules
node_admin_entry -.->|"selects views"| node_admin_views
node_staff_user -->|"opens"| node_staff_entry
node_staff_entry -->|"checks role"| node_auth
node_staff_entry -->|"records sale"| node_business_rules
node_staff_entry -->|"downloads bill"| node_invoice
node_staff_entry -->|"selects views"| node_staff_views
node_staff_entry -->|"renders messages"| node_messages
node_business_rules -->|"reads and writes"| node_database
node_db_connection -->|"connects"| node_database
node_admin_entry -.->|"loads migration"| node_schema_upgrade

click node_landing "https://github.com/nikrishdulal2006/ims/blob/main/landing/index.php"
click node_public_pages "https://github.com/nikrishdulal2006/ims/tree/main/landing"
click node_signin "https://github.com/nikrishdulal2006/ims/blob/main/signin.php"
click node_login_boot "https://github.com/nikrishdulal2006/ims/blob/main/login/bootstrap.php"
click node_login_view "https://github.com/nikrishdulal2006/ims/blob/main/login/views/login_page.php"
click node_authenticate "https://github.com/nikrishdulal2006/ims/blob/main/login/actions/authenticate.php"
click node_register "https://github.com/nikrishdulal2006/ims/blob/main/login/actions/register.php"
click node_recovery "https://github.com/nikrishdulal2006/ims/tree/main/login/actions"
click node_admin_entry "https://github.com/nikrishdulal2006/ims/blob/main/dashboard.php"
click node_admin_dispatch "https://github.com/nikrishdulal2006/ims/blob/main/dashboard/handlers.php"
click node_product_actions "https://github.com/nikrishdulal2006/ims/blob/main/dashboard/actions/products.php"
click node_staff_actions "https://github.com/nikrishdulal2006/ims/blob/main/dashboard/actions/staff.php"
click node_sales_actions "https://github.com/nikrishdulal2006/ims/blob/main/dashboard/actions/sales.php"
click node_notification_actions "https://github.com/nikrishdulal2006/ims/blob/main/dashboard/actions/notifications.php"
click node_admin_views "https://github.com/nikrishdulal2006/ims/tree/main/views"
click node_admin_filters "https://github.com/nikrishdulal2006/ims/blob/main/dashboard/filters.php"
click node_admin_stats "https://github.com/nikrishdulal2006/ims/blob/main/dashboard/stats.php"
click node_staff_entry "https://github.com/nikrishdulal2006/ims/blob/main/Staff_dashboard.php"
click node_staff_views "https://github.com/nikrishdulal2006/ims/tree/main/staff/views"
click node_messages "https://github.com/nikrishdulal2006/ims/blob/main/views/messages.php"
click node_auth "https://github.com/nikrishdulal2006/ims/blob/main/includes/auth.php"
click node_business_rules "https://github.com/nikrishdulal2006/ims/blob/main/includes/functions.php"
click node_invoice "https://github.com/nikrishdulal2006/ims/blob/main/includes/invoice.php"
click node_mailer "https://github.com/nikrishdulal2006/ims/blob/main/includes/Mailer.php"
click node_db_connection "https://github.com/nikrishdulal2006/ims/blob/main/config/connector.php"
click node_schema_upgrade "https://github.com/nikrishdulal2006/ims/blob/main/install/migrations.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_landing,node_public_pages toneBlue
class node_signin,node_login_boot,node_login_view,node_authenticate,node_register,node_recovery,node_database toneAmber
class node_admin_entry,node_admin_dispatch,node_staff_actions,node_admin_filters,node_admin_stats toneMint
class node_product_actions,node_sales_actions,node_notification_actions,node_admin_views,node_staff_entry,node_staff_views toneRose
class node_messages,node_auth,node_business_rules,node_invoice,node_mailer,node_db_connection,node_schema_upgrade,node_visitor,node_admin_user,node_staff_user toneIndigo
```

## Components

### Public site

- [Product landing](https://github.com/nikrishdulal2006/ims/blob/main/landing/index.php): `landing/index.php`
- [About and contact](https://github.com/nikrishdulal2006/ims/tree/main/landing): `landing`

### Accounts

- [Sign-in entry](https://github.com/nikrishdulal2006/ims/blob/main/signin.php): `signin.php`
- [Login setup](https://github.com/nikrishdulal2006/ims/blob/main/login/bootstrap.php): `login/bootstrap.php`
- [Login and recovery UI](https://github.com/nikrishdulal2006/ims/blob/main/login/views/login_page.php): `login/views/login_page.php`
- [Authentication action](https://github.com/nikrishdulal2006/ims/blob/main/login/actions/authenticate.php): `login/actions/authenticate.php`
- [Registration action](https://github.com/nikrishdulal2006/ims/blob/main/login/actions/register.php): `login/actions/register.php`
- [Password recovery actions](https://github.com/nikrishdulal2006/ims/tree/main/login/actions): `login/actions`

### Administrator

- [Admin dashboard entry](https://github.com/nikrishdulal2006/ims/blob/main/dashboard.php): `dashboard.php`
- [POST dispatch](https://github.com/nikrishdulal2006/ims/blob/main/dashboard/handlers.php): `dashboard/handlers.php`
- [Staff account actions](https://github.com/nikrishdulal2006/ims/blob/main/dashboard/actions/staff.php): `dashboard/actions/staff.php`
- [Report filters](https://github.com/nikrishdulal2006/ims/blob/main/dashboard/filters.php): `dashboard/filters.php`
- [Dashboard statistics](https://github.com/nikrishdulal2006/ims/blob/main/dashboard/stats.php): `dashboard/stats.php`

### Inventory and sales

- [Product and stock actions](https://github.com/nikrishdulal2006/ims/blob/main/dashboard/actions/products.php): `dashboard/actions/products.php`
- [Sales actions](https://github.com/nikrishdulal2006/ims/blob/main/dashboard/actions/sales.php): `dashboard/actions/sales.php`
- [Alert actions](https://github.com/nikrishdulal2006/ims/blob/main/dashboard/actions/notifications.php): `dashboard/actions/notifications.php`
- [Inventory and sales views](https://github.com/nikrishdulal2006/ims/tree/main/views): `views`
- [Staff dashboard](https://github.com/nikrishdulal2006/ims/blob/main/Staff_dashboard.php): `Staff_dashboard.php`
- [Staff sales views](https://github.com/nikrishdulal2006/ims/tree/main/staff/views): `staff/views`

### Shared services

- [Status messages](https://github.com/nikrishdulal2006/ims/blob/main/views/messages.php): `views/messages.php`
- [Session and CSRF](https://github.com/nikrishdulal2006/ims/blob/main/includes/auth.php): `includes/auth.php`
- [Sales and stock rules](https://github.com/nikrishdulal2006/ims/blob/main/includes/functions.php): `includes/functions.php`
- [Bills and invoices](https://github.com/nikrishdulal2006/ims/blob/main/includes/invoice.php): `includes/invoice.php`
- [Email delivery](https://github.com/nikrishdulal2006/ims/blob/main/includes/Mailer.php): `includes/Mailer.php`
- [PDO connection](https://github.com/nikrishdulal2006/ims/blob/main/config/connector.php): `config/connector.php`
- [Schema migration](https://github.com/nikrishdulal2006/ims/blob/main/install/migrations.php): `install/migrations.php`

### Other components

- **Visitor**
- **Administrator**
- **Staff member**
- **IMS database**

## Connections

- Visitor → Product landing: opens
- Product landing → About and contact: links to (evidence: `landing/includes/header.php`)
- Product landing → Sign-in entry: offers sign-in
- Visitor → Sign-in entry: opens (evidence: `README.md`)
- Sign-in entry → Login setup: loads setup (evidence: `signin.php`)
- Sign-in entry → Session and CSRF: loads auth (evidence: `signin.php`)
- Sign-in entry → Login and recovery UI: renders (evidence: `signin.php`)
- Login setup → PDO connection: loads connection (evidence: `login/bootstrap.php`)
- Login setup → Email delivery: loads mailer (evidence: `login/bootstrap.php`)
- Login and recovery UI → Authentication action: submits login
- Login and recovery UI → Registration action: submits registration
- Login and recovery UI → Password recovery actions: submits recovery
- Administrator → Admin dashboard entry: opens (evidence: `README.md`)
- Admin dashboard entry → Session and CSRF: loads auth (evidence: `dashboard.php`)
- Admin dashboard entry → POST dispatch: loads controller (evidence: `dashboard.php`)
- Admin dashboard entry → Report filters: loads filters (evidence: `dashboard.php`)
- Admin dashboard entry → Dashboard statistics: loads statistics (evidence: `dashboard.php`)
- Admin dashboard entry → Status messages: renders messages (evidence: `dashboard.php`)
- Admin dashboard entry → PDO connection: loads connection (evidence: `dashboard.php`)
- POST dispatch → Product and stock actions: dispatches (evidence: `dashboard/handlers.php`)
- POST dispatch → Sales actions: dispatches (evidence: `dashboard/handlers.php`)
- POST dispatch → Alert actions: dispatches (evidence: `dashboard/handlers.php`)
- POST dispatch → Staff account actions: dispatches (evidence: `dashboard/handlers.php`)
- POST dispatch → Sales and stock rules: uses rules (evidence: `dashboard/handlers.php`)
- Admin dashboard entry → Inventory and sales views: selects views (evidence: `dashboard.php`)
- Staff member → Staff dashboard: opens (evidence: `README.md`)
- Staff dashboard → Session and CSRF: checks role (evidence: `Staff_dashboard.php`)
- Staff dashboard → Sales and stock rules: records sale (evidence: `Staff_dashboard.php`)
- Staff dashboard → Bills and invoices: downloads bill (evidence: `Staff_dashboard.php`)
- Staff dashboard → Staff sales views: selects views (evidence: `Staff_dashboard.php`)
- Staff dashboard → Status messages: renders messages (evidence: `Staff_dashboard.php`)
- Sales and stock rules → IMS database: reads and writes (evidence: `includes/functions.php`)
- PDO connection → IMS database: connects (evidence: `config/connector.php`)
- Admin dashboard entry → Schema migration: loads migration
