# esakkimuthu-237/esakki_pr architecture

> Architecture diagram of the GitHub repository esakkimuthu-237/esakki_pr, 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/esakkimuthu-237/esakki_pr
- Repository: https://github.com/esakkimuthu-237/esakki_pr

## Overview

PharmaCare is a browser-based pharmacy management app backed by Supabase. A user signs in, then manages medicine batches and suppliers, creates GST invoices from available stock, and reviews invoices, alerts, dashboard statistics, and reports. The excerpts show the UI-to-database calls and the Supabase auth/profile helpers; README-documented capabilities such as email verification, password reset, and settings are retained, but unsampled wiring is not inferred. The schema and auth-page internals were not excerpted, so those links rely only on documented behavior.

Main entry points: [`db.js`](https://github.com/esakkimuthu-237/esakki_pr/blob/main/db.js) (Database operations), [`app.js`](https://github.com/esakkimuthu-237/esakki_pr/blob/main/app.js) (Inventory and alerts), [`supabase-config.js`](https://github.com/esakkimuthu-237/esakki_pr/blob/main/supabase-config.js) (Auth and pharmacy profile), [`billing.js`](https://github.com/esakkimuthu-237/esakki_pr/blob/main/billing.js) (Billing and invoices)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Application workflows"]
  node_authpage["Sign-in and recovery<br/>[auth.html]"]
  node_dashboard["Dashboard<br/>[app.js]"]
  node_inventory["Inventory and alerts<br/>[app.js]"]
  node_billing["Billing and invoices<br/>[billing.js]"]
  node_suppliers["Supplier management<br/>[suppliers.js]"]
  node_reports["Reports and analytics<br/>[reports.js]"]
  node_settings["Pharmacy settings<br/>[app.js]"]
end

subgraph group_data["Data and access"]
  node_authprofile["Auth and pharmacy profile<br/>[supabase-config.js]"]
  node_dbops["Database operations<br/>[db.js]"]
  node_legacy["Legacy data migration<br/>[db.js]"]
  node_schema[("Relational schema and stock functions<br/>[schema.sql]")]
end

subgraph group_external["External services"]
  node_supabase[("Supabase platform")]
  node_browserstorage[("Browser localStorage")]
end

node_user(("Pharmacy user"))

node_user -->|"signs in"| node_authpage
node_authpage -.->|"authenticates"| node_authprofile
node_authprofile -->|"auth and profile"| node_supabase
node_dashboard -->|"initializes session"| node_authprofile
node_dashboard -.->|"loads dashboard data"| node_dbops
node_inventory -->|"manages medicines"| node_dbops
node_inventory -->|"loads suppliers"| node_dbops
node_suppliers -->|"manages suppliers"| node_dbops
node_suppliers -->|"refreshes dropdown"| node_inventory
node_billing -->|"saves and reads invoices"| node_dbops
node_billing -->|"loads medicines"| node_dbops
node_reports -->|"requests report data"| node_dbops
node_reports -->|"loads medicines"| node_dbops
node_settings -.->|"updates profile"| node_dbops
node_dbops -->|"queries and updates"| node_supabase
node_dbops -->|"uses tables and RPCs"| node_schema
node_dbops -->|"runs migration"| node_legacy
node_legacy -.->|"reads old medicines"| node_browserstorage

click node_authpage "https://github.com/esakkimuthu-237/esakki_pr/blob/main/auth.html"
click node_dashboard "https://github.com/esakkimuthu-237/esakki_pr/blob/main/app.js"
click node_inventory "https://github.com/esakkimuthu-237/esakki_pr/blob/main/app.js"
click node_billing "https://github.com/esakkimuthu-237/esakki_pr/blob/main/billing.js"
click node_suppliers "https://github.com/esakkimuthu-237/esakki_pr/blob/main/suppliers.js"
click node_reports "https://github.com/esakkimuthu-237/esakki_pr/blob/main/reports.js"
click node_settings "https://github.com/esakkimuthu-237/esakki_pr/blob/main/app.js"
click node_authprofile "https://github.com/esakkimuthu-237/esakki_pr/blob/main/supabase-config.js"
click node_dbops "https://github.com/esakkimuthu-237/esakki_pr/blob/main/db.js"
click node_legacy "https://github.com/esakkimuthu-237/esakki_pr/blob/main/db.js"
click node_schema "https://github.com/esakkimuthu-237/esakki_pr/blob/main/schema.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_authpage,node_dashboard,node_inventory,node_billing,node_suppliers,node_reports,node_settings,node_user toneBlue
class node_authprofile,node_dbops,node_legacy,node_schema toneAmber
class node_supabase,node_browserstorage toneMint
```

## Components

### Application workflows

- [Sign-in and recovery](https://github.com/esakkimuthu-237/esakki_pr/blob/main/auth.html): `auth.html`
- [Dashboard](https://github.com/esakkimuthu-237/esakki_pr/blob/main/app.js): `app.js`
- [Inventory and alerts](https://github.com/esakkimuthu-237/esakki_pr/blob/main/app.js): `app.js`
- [Billing and invoices](https://github.com/esakkimuthu-237/esakki_pr/blob/main/billing.js): `billing.js`
- [Supplier management](https://github.com/esakkimuthu-237/esakki_pr/blob/main/suppliers.js): `suppliers.js`
- [Reports and analytics](https://github.com/esakkimuthu-237/esakki_pr/blob/main/reports.js): `reports.js`
- [Pharmacy settings](https://github.com/esakkimuthu-237/esakki_pr/blob/main/app.js): `app.js`

### Data and access

- [Auth and pharmacy profile](https://github.com/esakkimuthu-237/esakki_pr/blob/main/supabase-config.js): `supabase-config.js`
- [Database operations](https://github.com/esakkimuthu-237/esakki_pr/blob/main/db.js): `db.js`
- [Legacy data migration](https://github.com/esakkimuthu-237/esakki_pr/blob/main/db.js): `db.js`
- [Relational schema and stock functions](https://github.com/esakkimuthu-237/esakki_pr/blob/main/schema.sql): `schema.sql`

### External services

- **Supabase platform**
- **Browser localStorage**

### Other components

- **Pharmacy user**

## Connections

- Pharmacy user → Sign-in and recovery: signs in (evidence: `README.md`)
- Sign-in and recovery → Auth and pharmacy profile: authenticates
- Auth and pharmacy profile → Supabase platform: auth and profile (evidence: `supabase-config.js`)
- Dashboard → Auth and pharmacy profile: initializes session (evidence: `app.js`)
- Dashboard → Database operations: loads dashboard data
- Inventory and alerts → Database operations: manages medicines (evidence: `app.js`)
- Inventory and alerts → Database operations: loads suppliers (evidence: `app.js`)
- Supplier management → Database operations: manages suppliers (evidence: `suppliers.js`)
- Supplier management → Inventory and alerts: refreshes dropdown (evidence: `suppliers.js`)
- Billing and invoices → Database operations: saves and reads invoices (evidence: `billing.js`)
- Billing and invoices → Database operations: loads medicines (evidence: `billing.js`)
- Reports and analytics → Database operations: requests report data (evidence: `reports.js`)
- Reports and analytics → Database operations: loads medicines (evidence: `reports.js`)
- Pharmacy settings → Database operations: updates profile
- Database operations → Supabase platform: queries and updates (evidence: `db.js`)
- Database operations → Relational schema and stock functions: uses tables and RPCs (evidence: `db.js`)
- Database operations → Legacy data migration: runs migration (evidence: `db.js`)
- Legacy data migration → Browser localStorage: reads old medicines
