# levuhungghub/medistock architecture

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

- Interactive diagram: https://gitdiagram.com/levuhungghub/medistock
- Repository: https://github.com/levuhungghub/medistock

## Overview

1. **Overall shape**
   - MediStock is organized as a **two-tier application**: a backend service in `back_end/` and a set of static frontend screens in `font_end_managements/`.
   - The structure suggests a **pharmacy / medicine inventory management system** with administrative workflows rather than a consumer-facing app.

2. **Backend boundary**
   - `back_end/server.js` is the single visible backend entrypoint.
   - This likely owns **HTTP routing, business logic, authentication/session handling, and data access** for the whole system.
   - No other backend modules are visible, so the server may be a relatively centralized service.

3. **Frontend boundary**
   - The frontend is split into multiple feature folders, each containing paired `.html` and `.css` files.
   - This indicates a **multi-page static UI** approach, with each module represented as a distinct screen rather than a large SPA.
   - There is no visible frontend build tooling, suggesting the pages are likely served directly or linked manually.

4. **Authentication and access entry**
   - `font_end_managements/auth/login.html` is the entry point for user sign-in.
   - This is the first user boundary before accessing operational modules, implying the app is **role- or account-gated**.
   - Authentication likely controls access to staff, inventory, reporting, and settings screens.

5. **Operational dashboard**
   - `font_end_managements/dashboard/dashboard.html` is the main landing area after login.
   - It likely acts as the **navigation hub** into the rest of the system: medicine management, stock operations, reporting, staff, suppliers, and settings.
   - For an architecture diagram, this sits between authentication and the functional subsystems.

6. **Medicine catalog subsystem**
   - `medicine_catalog/` contains `inventory`, `medicine_details`, `add_medicine`, and `edit_medicine`.
   - This cluster represents the **master data and CRUD flow for medicines**:
     - browse inventory
     - inspect a medicine
     - add a new item
     - edit existing records
   - It is one of the core domain subsystems and likely feeds reporting and stock operations.

7. **Stock movement subsystem**
   - `stock_input_output/stock_manager.html` suggests workflows for **stock in / stock out transactions**.
   - This is distinct from the medicine catalog because it likely records **inventory movement events** rather than static product metadata.
   - These transactions are probably a key source for inventory balances and stock reports.

8. **Reporting and analytics subsystem**
   - `report_analytics/` contains:
     - `analytics_main`
     - `financial_transaction_report`
     - `stock_inventory_report`
   - This indicates a **read-only reporting layer** built on top of operational data.
   - The presence of both financial and stock reports suggests the backend aggregates data from sales/transactions and inventory movement.

9. **Staff and role management**
   - `staff_role/` contains `staff_management` and `create_account_staff`.
   - This subsystem handles **internal user administration**, likely including role assignment and account creation.
   - It forms a separate administrative boundary from normal operational screens, implying different permissions for managers/admins.

10. **Supplier management**
   - `suppliers/supplier_management.html` indicates a dedicated screen for **vendor/supplier records**.
   - In the domain model, suppliers are likely linked to purchase/restock workflows and may influence stock input operations.
   - This is a supporting master-data area alongside medicines and staff.

11. **System settings**
   - `system_setting/settings.html` is the configuration boundary for the application.
   - It likely contains **global preferences, operational parameters, or account/system controls**.
   - For a diagram, this is a separate administrative subsystem accessed from the dashboard.

12. **Data flow perspective**
   - Typical flow appears to be: **login → dashboard → module screen → backend/server.js → persisted data**.
   - Write actions likely originate from medicine, stock, staff, or supplier screens and are processed centrally by the backend.
   - Reporting screens likely consume the same backend data but in **query/aggregation-only** mode.

13. **Technology signals**
   - The presence of `server.js` strongly suggests a **JavaScript/Node.js backend**.
   - The frontend is plain **HTML/CSS**, with no visible framework or component build pipeline in the tree.
   - No database, messaging, or external service directories are visible, so those dependencies are not explicit in the repository structure.

14. **What to reflect in an architecture diagram**
   - Show one backend service with the frontend split into these feature areas:
     - Auth
     - Dashboard
     - Medicine Catalog
     - Stock Input/Output
     - Reports/Analytics
     - Staff & Roles
     - Suppliers
     - System Settings
   - Emphasize that the feature folders are **separate UI screens** rather than separate services.
   - The main architectural boundaries are **authentication**, **operational CRUD**, **transactional stock handling**, and **reporting**.

Main entry points: [`font_end_managements/dashboard/dashboard.html`](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/dashboard/dashboard.html) (Dashboard), [`back_end/server.js`](https://github.com/levuhungghub/medistock/blob/main/back_end/server.js) (Server), [`font_end_managements/medicine_catalog/inventory.html`](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/medicine_catalog/inventory.html) (Inventory), [`font_end_managements/report_analytics/analytics_main.html`](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/report_analytics/analytics_main.html) (Analytics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Backend"]
  node_back_end_server_js["Server<br/>Node.js app<br/>[server.js]"]
end

subgraph group_frontend["Frontend Screens"]
  node_auth_login["Login<br/>auth screen<br/>[login.html]"]
  node_dashboard_dashboard["Dashboard<br/>navigation hub<br/>[dashboard.html]"]
  node_medicine_inventory["Inventory<br/>medicine catalog<br/>[inventory.html]"]
  node_medicine_details["Medicine Details<br/>medicine catalog"]
  node_medicine_add["Add Medicine<br/>medicine catalog<br/>[add_medicine.html]"]
  node_medicine_edit["Edit Medicine<br/>medicine catalog<br/>[edit_medicine.html]"]
  node_stock_manager["Stock Manager<br/>stock workflow<br/>[stock_manager.html]"]
  node_analytics_main["Analytics<br/>reporting hub"]
  node_financial_report["Financial Report"]
  node_stock_report["Stock Report"]
  node_staff_management["Staff Management<br/>admin screen"]
  node_create_staff["Create Account<br/>admin screen"]
  node_supplier_management["Suppliers<br/>supplier screen"]
  node_settings["Settings<br/>config screen<br/>[settings.html]"]
end

node_auth_login -->|"sign in"| node_dashboard_dashboard
node_dashboard_dashboard -->|"navigate"| node_medicine_inventory
node_medicine_inventory -->|"view"| node_medicine_details
node_medicine_inventory -->|"create"| node_medicine_add
node_medicine_inventory -->|"edit"| node_medicine_edit
node_dashboard_dashboard -->|"navigate"| node_stock_manager
node_dashboard_dashboard -->|"navigate"| node_analytics_main
node_analytics_main -->|"open"| node_financial_report
node_analytics_main -->|"open"| node_stock_report
node_dashboard_dashboard -->|"navigate"| node_staff_management
node_staff_management -->|"create account"| node_create_staff
node_dashboard_dashboard -->|"navigate"| node_supplier_management
node_dashboard_dashboard -->|"navigate"| node_settings
node_auth_login -->|"authenticate"| node_back_end_server_js
node_dashboard_dashboard -->|"data ops"| node_back_end_server_js
node_medicine_inventory -->|"crud"| node_back_end_server_js
node_stock_manager -->|"transactions"| node_back_end_server_js
node_analytics_main -->|"queries"| node_back_end_server_js
node_staff_management -->|"admin ops"| node_back_end_server_js
node_supplier_management -->|"master data"| node_back_end_server_js
node_settings -->|"config"| node_back_end_server_js

click node_back_end_server_js "https://github.com/levuhungghub/medistock/blob/main/back_end/server.js"
click node_auth_login "https://github.com/levuhungghub/medistock/blob/main/font_end_managements/auth/login.html"
click node_dashboard_dashboard "https://github.com/levuhungghub/medistock/blob/main/font_end_managements/dashboard/dashboard.html"
click node_medicine_inventory "https://github.com/levuhungghub/medistock/blob/main/font_end_managements/medicine_catalog/inventory.html"
click node_medicine_details "https://github.com/levuhungghub/medistock/blob/main/font_end_managements/medicine_catalog/medicine_details.html"
click node_medicine_add "https://github.com/levuhungghub/medistock/blob/main/font_end_managements/medicine_catalog/add_medicine.html"
click node_medicine_edit "https://github.com/levuhungghub/medistock/blob/main/font_end_managements/medicine_catalog/edit_medicine.html"
click node_stock_manager "https://github.com/levuhungghub/medistock/blob/main/font_end_managements/stock_input_output/stock_manager.html"
click node_analytics_main "https://github.com/levuhungghub/medistock/blob/main/font_end_managements/report_analytics/analytics_main.html"
click node_financial_report "https://github.com/levuhungghub/medistock/blob/main/font_end_managements/report_analytics/financial_transaction_report.html"
click node_stock_report "https://github.com/levuhungghub/medistock/blob/main/font_end_managements/report_analytics/stock_inventory_report.html"
click node_staff_management "https://github.com/levuhungghub/medistock/blob/main/font_end_managements/staff_role/staff_management.html"
click node_create_staff "https://github.com/levuhungghub/medistock/blob/main/font_end_managements/staff_role/create_account_staff.html"
click node_supplier_management "https://github.com/levuhungghub/medistock/blob/main/font_end_managements/suppliers/supplier_management.html"
click node_settings "https://github.com/levuhungghub/medistock/blob/main/font_end_managements/system_setting/settings.html"

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_back_end_server_js toneBlue
class node_auth_login,node_dashboard_dashboard,node_medicine_inventory,node_medicine_details,node_medicine_add,node_medicine_edit,node_stock_manager,node_analytics_main,node_financial_report,node_stock_report,node_staff_management,node_create_staff,node_supplier_management,node_settings toneAmber
```

## Components

### Backend

Central Node.js service

- [Server](https://github.com/levuhungghub/medistock/blob/main/back_end/server.js): Node.js app · Single backend entrypoint for routing, business logic, auth, and data access · `back_end/server.js`

### Frontend Screens

Static multi-page UI areas

- [Login](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/auth/login.html): auth screen · User sign-in and access gate · `font_end_managements/auth/login.html`
- [Dashboard](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/dashboard/dashboard.html): navigation hub · Main landing screen after login · `font_end_managements/dashboard/dashboard.html`
- [Inventory](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/medicine_catalog/inventory.html): medicine catalog · Browse medicine stock records · `font_end_managements/medicine_catalog/inventory.html`
- [Medicine Details](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/medicine_catalog/medicine_details.html): medicine catalog · View a single medicine record · `font_end_managements/medicine_catalog/medicine_details.html`
- [Add Medicine](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/medicine_catalog/add_medicine.html): medicine catalog · Create new medicine records · `font_end_managements/medicine_catalog/add_medicine.html`
- [Edit Medicine](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/medicine_catalog/edit_medicine.html): medicine catalog · Update existing medicine records · `font_end_managements/medicine_catalog/edit_medicine.html`
- [Stock Manager](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/stock_input_output/stock_manager.html): stock workflow · Stock in and stock out operations · `font_end_managements/stock_input_output/stock_manager.html`
- [Analytics](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/report_analytics/analytics_main.html): reporting hub · Entry point for reports and analytics · `font_end_managements/report_analytics/analytics_main.html`
- [Financial Report](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/report_analytics/financial_transaction_report.html): report · Financial transaction reporting · `font_end_managements/report_analytics/financial_transaction_report.html`
- [Stock Report](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/report_analytics/stock_inventory_report.html): report · Inventory and stock reporting · `font_end_managements/report_analytics/stock_inventory_report.html`
- [Staff Management](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/staff_role/staff_management.html): admin screen · Manage staff records and roles · `font_end_managements/staff_role/staff_management.html`
- [Create Account](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/staff_role/create_account_staff.html): admin screen · Create staff user accounts · `font_end_managements/staff_role/create_account_staff.html`
- [Suppliers](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/suppliers/supplier_management.html): supplier screen · Manage vendor and supplier records · `font_end_managements/suppliers/supplier_management.html`
- [Settings](https://github.com/levuhungghub/medistock/blob/main/font_end_managements/system_setting/settings.html): config screen · System preferences and administrative configuration · `font_end_managements/system_setting/settings.html`

## Connections

- Login → Dashboard: sign in · Successful authentication leads to the dashboard
- Dashboard → Inventory: navigate · Dashboard routes to medicine catalog
- Inventory → Medicine Details: view · Open a selected medicine record
- Inventory → Add Medicine: create · Add a new medicine item
- Inventory → Edit Medicine: edit · Modify an existing medicine item
- Dashboard → Stock Manager: navigate · Dashboard routes to stock movement workflows
- Dashboard → Analytics: navigate · Dashboard routes to reporting hub
- Analytics → Financial Report: open · Access financial transaction report
- Analytics → Stock Report: open · Access stock inventory report
- Dashboard → Staff Management: navigate · Dashboard routes to staff administration
- Staff Management → Create Account: create account · Create a staff user account
- Dashboard → Suppliers: navigate · Dashboard routes to supplier management
- Dashboard → Settings: navigate · Dashboard routes to system configuration
- Login → Server: authenticate · Login requests are handled by the backend service
- Dashboard → Server: data ops · Operational screens exchange data with the backend
- Inventory → Server: crud · Medicine catalog reads and writes through the backend
- Stock Manager → Server: transactions · Stock movements are processed centrally
- Analytics → Server: queries · Reports consume aggregated backend data
- Staff Management → Server: admin ops · Staff and role management is handled by the backend
- Suppliers → Server: master data · Supplier records are managed through the backend
- Settings → Server: config · Settings are persisted and enforced by the backend
