# akshayngupta/pharmacy-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/akshayngupta/pharmacy-management-system
- Repository: https://github.com/akshayngupta/pharmacy-management-system

## Overview

Pharmanage is a single-pharmacy Flask application for customer and category records, medicine and batch lookup, sales billing, and stock reports. A browser request reaches Flask route handlers, which query MySQL and render Jinja pages; billing also invokes a stored procedure, while reports and the dashboard use database views. The README documents the schema and SQL features, but only app.py was sampled, so database relationships beyond its visible queries are limited to documented capabilities.

Main entry points: [`app.py`](https://github.com/akshayngupta/pharmacy-management-system/blob/main/app.py) (Flask routes), [`advanced.sql`](https://github.com/akshayngupta/pharmacy-management-system/blob/main/advanced.sql) (Views and procedure), [`templates/list.html`](https://github.com/akshayngupta/pharmacy-management-system/blob/main/templates/list.html) (List page), [`schema.sql`](https://github.com/akshayngupta/pharmacy-management-system/blob/main/schema.sql) (Core schema)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workflows"]
  node_app["Flask routes<br/>[app.py]"]
  node_dashboard["Dashboard stats<br/>[app.py]"]
  node_customer_category["Customer and categories<br/>[app.py]"]
  node_inventory["Medicine and batches<br/>[app.py]"]
  node_billing["Sale billing<br/>[app.py]"]
  node_reports["Stock reports<br/>[app.py]"]
end

subgraph group_presentation["Page templates"]
  node_index_template["Dashboard page<br/>[index.html]"]
  node_list_template["List page<br/>[list.html]"]
  node_form_template["Entry form<br/>[form.html]"]
  node_sale_template["Sale form<br/>[sale_form.html]"]
  node_reports_template["Reports page<br/>[reports.html]"]
end

subgraph group_database["Database layer"]
  node_mysql[("MySQL database")]
  node_schema[("Core schema<br/>[schema.sql]")]
  node_advanced_sql[("Views and procedure<br/>[advanced.sql]")]
end

node_browser(("Pharmacy user"))

node_browser -->|"requests pages"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_customer_category
node_app -->|"routes to"| node_inventory
node_app -->|"routes to"| node_billing
node_app -->|"routes to"| node_reports
node_dashboard -->|"renders"| node_index_template
node_customer_category -->|"renders"| node_list_template
node_customer_category -->|"renders"| node_form_template
node_inventory -->|"renders"| node_list_template
node_billing -->|"renders"| node_sale_template
node_reports -->|"renders"| node_reports_template
node_app -->|"queries and writes"| node_mysql
node_billing -->|"calls procedure"| node_advanced_sql
node_dashboard -->|"queries view"| node_advanced_sql
node_reports -->|"queries views"| node_advanced_sql
node_schema -->|"defines tables"| node_mysql
node_advanced_sql -->|"defines SQL features"| node_mysql

click node_app "https://github.com/akshayngupta/pharmacy-management-system/blob/main/app.py"
click node_dashboard "https://github.com/akshayngupta/pharmacy-management-system/blob/main/app.py"
click node_customer_category "https://github.com/akshayngupta/pharmacy-management-system/blob/main/app.py"
click node_inventory "https://github.com/akshayngupta/pharmacy-management-system/blob/main/app.py"
click node_billing "https://github.com/akshayngupta/pharmacy-management-system/blob/main/app.py"
click node_reports "https://github.com/akshayngupta/pharmacy-management-system/blob/main/app.py"
click node_index_template "https://github.com/akshayngupta/pharmacy-management-system/blob/main/templates/index.html"
click node_list_template "https://github.com/akshayngupta/pharmacy-management-system/blob/main/templates/list.html"
click node_form_template "https://github.com/akshayngupta/pharmacy-management-system/blob/main/templates/form.html"
click node_sale_template "https://github.com/akshayngupta/pharmacy-management-system/blob/main/templates/sale_form.html"
click node_reports_template "https://github.com/akshayngupta/pharmacy-management-system/blob/main/templates/reports.html"
click node_schema "https://github.com/akshayngupta/pharmacy-management-system/blob/main/schema.sql"
click node_advanced_sql "https://github.com/akshayngupta/pharmacy-management-system/blob/main/advanced.sql"

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_dashboard,node_customer_category,node_inventory,node_billing,node_reports,node_browser toneBlue
class node_index_template,node_list_template,node_form_template,node_sale_template,node_reports_template toneAmber
class node_mysql,node_schema,node_advanced_sql toneMint
```

## Components

### Web workflows

- [Flask routes](https://github.com/akshayngupta/pharmacy-management-system/blob/main/app.py): `app.py`
- [Dashboard stats](https://github.com/akshayngupta/pharmacy-management-system/blob/main/app.py): `app.py`
- [Customer and categories](https://github.com/akshayngupta/pharmacy-management-system/blob/main/app.py): `app.py`
- [Medicine and batches](https://github.com/akshayngupta/pharmacy-management-system/blob/main/app.py): `app.py`
- [Sale billing](https://github.com/akshayngupta/pharmacy-management-system/blob/main/app.py): `app.py`
- [Stock reports](https://github.com/akshayngupta/pharmacy-management-system/blob/main/app.py): `app.py`

### Page templates

- [Dashboard page](https://github.com/akshayngupta/pharmacy-management-system/blob/main/templates/index.html): `templates/index.html`
- [List page](https://github.com/akshayngupta/pharmacy-management-system/blob/main/templates/list.html): `templates/list.html`
- [Entry form](https://github.com/akshayngupta/pharmacy-management-system/blob/main/templates/form.html): `templates/form.html`
- [Sale form](https://github.com/akshayngupta/pharmacy-management-system/blob/main/templates/sale_form.html): `templates/sale_form.html`
- [Reports page](https://github.com/akshayngupta/pharmacy-management-system/blob/main/templates/reports.html): `templates/reports.html`

### Database layer

- **MySQL database**
- [Core schema](https://github.com/akshayngupta/pharmacy-management-system/blob/main/schema.sql): `schema.sql`
- [Views and procedure](https://github.com/akshayngupta/pharmacy-management-system/blob/main/advanced.sql): `advanced.sql`

### Other components

- **Pharmacy user**

## Connections

- Pharmacy user → Flask routes: requests pages (evidence: `README.md`)
- Flask routes → Dashboard stats: routes to (evidence: `app.py`)
- Flask routes → Customer and categories: routes to (evidence: `app.py`)
- Flask routes → Medicine and batches: routes to (evidence: `app.py`)
- Flask routes → Sale billing: routes to (evidence: `app.py`)
- Flask routes → Stock reports: routes to (evidence: `app.py`)
- Dashboard stats → Dashboard page: renders (evidence: `app.py`)
- Customer and categories → List page: renders (evidence: `app.py`)
- Customer and categories → Entry form: renders (evidence: `app.py`)
- Medicine and batches → List page: renders (evidence: `app.py`)
- Sale billing → Sale form: renders (evidence: `app.py`)
- Stock reports → Reports page: renders (evidence: `app.py`)
- Flask routes → MySQL database: queries and writes (evidence: `app.py`)
- Sale billing → Views and procedure: calls procedure (evidence: `app.py`)
- Dashboard stats → Views and procedure: queries view (evidence: `app.py`)
- Stock reports → Views and procedure: queries views (evidence: `app.py`)
- Core schema → MySQL database: defines tables (evidence: `README.md`)
- Views and procedure → MySQL database: defines SQL features (evidence: `README.md`)
