# makhzumbinharun/pharmacy-inventory-system architecture

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

- Interactive diagram: https://gitdiagram.com/makhzumbinharun/pharmacy-inventory-system
- Repository: https://github.com/makhzumbinharun/pharmacy-inventory-system

## Overview

This is a console-based pharmacy management system. A user enters through the main menu, authenticates, and reaches medicine management, sales, reports, or (for Admins) account registration. Medicine records and sales are maintained in binary files; authentication uses a separate user file. The graph covers the documented feature areas, though source excerpts for several modules are partial, so relationships not directly shown or documented are omitted.

Main entry points: [`src/main.c`](https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/main.c) (Main Menu), [`src/medicine.c`](https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/medicine.c) (Medicine Management), [`src/sales.c`](https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/sales.c) (Sales Management), [`src/reports.c`](https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/reports.c) (Reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Console"]
  node_app["Main Menu<br/>[main.c]"]
  node_auth["Authentication<br/>[auth.c]"]
  node_utils["Console Utilities<br/>[utils.c]"]
end

subgraph group_operations["Pharmacy Operations"]
  node_medicine["Medicine Management<br/>[medicine.c]"]
  node_inventory["Inventory Tracking<br/>[inventory.c]"]
  node_sales["Sales Management<br/>[sales.c]"]
  node_reports["Reports<br/>[reports.c]"]
end

subgraph group_storage["Binary File Storage"]
  node_usersfile[("User Records<br/>[.gitkeep]")]
  node_medfile[("Medicine Records<br/>[.gitkeep]")]
  node_salesfile[("Sales Records<br/>[.gitkeep]")]
end

node_user(("Pharmacy User"))

node_user -->|"uses menu"| node_app
node_app -->|"initializes and authenticates"| node_auth
node_app -->|"opens"| node_medicine
node_app -->|"opens"| node_sales
node_app -->|"opens"| node_reports
node_app -->|"registers users"| node_auth
node_app -->|"uses console helpers"| node_utils
node_auth -->|"reads and writes"| node_usersfile
node_medicine -->|"reads and writes"| node_medfile
node_medicine -->|"checks Admin password"| node_auth
node_medicine -->|"shows low stock"| node_inventory
node_inventory -->|"reads"| node_medfile
node_sales -->|"resolves medicine ID"| node_medicine
node_sales -->|"updates stock"| node_medfile
node_sales -->|"appends sale"| node_salesfile
node_sales -->|"checks low stock"| node_inventory
node_reports -->|"reuses medicine listing"| node_medicine
node_reports -->|"reuses low-stock listing"| node_inventory
node_reports -->|"reads inventory"| node_medfile
node_reports -->|"reads sales history"| node_salesfile

click node_app "https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/main.c"
click node_auth "https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/auth.c"
click node_utils "https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/utils.c"
click node_medicine "https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/medicine.c"
click node_inventory "https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/inventory.c"
click node_sales "https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/sales.c"
click node_reports "https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/reports.c"
click node_usersfile "https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/data/.gitkeep"
click node_medfile "https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/data/.gitkeep"
click node_salesfile "https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/data/.gitkeep"

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_app,node_auth,node_utils,node_user toneBlue
class node_medicine,node_inventory,node_sales,node_reports toneAmber
class node_usersfile,node_medfile,node_salesfile toneMint
```

## Components

### Access and Console

- [Main Menu](https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/main.c): `src/main.c`
- [Authentication](https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/auth.c): `src/auth.c`
- [Console Utilities](https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/utils.c): `src/utils.c`

### Pharmacy Operations

- [Medicine Management](https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/medicine.c): `src/medicine.c`
- [Inventory Tracking](https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/inventory.c): `src/inventory.c`
- [Sales Management](https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/sales.c): `src/sales.c`
- [Reports](https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/src/reports.c): `src/reports.c`

### Binary File Storage

- [User Records](https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/data/.gitkeep): `data/.gitkeep`
- [Medicine Records](https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/data/.gitkeep): `data/.gitkeep`
- [Sales Records](https://github.com/makhzumbinharun/pharmacy-inventory-system/blob/master/data/.gitkeep): `data/.gitkeep`

### Other components

- **Pharmacy User**

## Connections

- Pharmacy User → Main Menu: uses menu (evidence: `src/main.c`)
- Main Menu → Authentication: initializes and authenticates (evidence: `src/main.c`)
- Main Menu → Medicine Management: opens (evidence: `src/main.c`)
- Main Menu → Sales Management: opens (evidence: `src/main.c`)
- Main Menu → Reports: opens (evidence: `src/main.c`)
- Main Menu → Authentication: registers users (evidence: `src/main.c`)
- Main Menu → Console Utilities: uses console helpers (evidence: `src/main.c`)
- Authentication → User Records: reads and writes (evidence: `src/auth.c`)
- Medicine Management → Medicine Records: reads and writes (evidence: `src/medicine.c`)
- Medicine Management → Authentication: checks Admin password (evidence: `src/medicine.c`)
- Medicine Management → Inventory Tracking: shows low stock (evidence: `src/medicine.c`)
- Inventory Tracking → Medicine Records: reads (evidence: `src/inventory.c`)
- Sales Management → Medicine Management: resolves medicine ID (evidence: `src/sales.c`)
- Sales Management → Medicine Records: updates stock (evidence: `src/sales.c`)
- Sales Management → Sales Records: appends sale (evidence: `src/sales.c`)
- Sales Management → Inventory Tracking: checks low stock (evidence: `src/sales.c`)
- Reports → Medicine Management: reuses medicine listing (evidence: `src/reports.c`)
- Reports → Inventory Tracking: reuses low-stock listing (evidence: `src/reports.c`)
- Reports → Medicine Records: reads inventory (evidence: `README.md`)
- Reports → Sales Records: reads sales history (evidence: `src/reports.c`)
