# jibintech/pharmtech architecture

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

- Interactive diagram: https://gitdiagram.com/jibintech/pharmtech
- Repository: https://github.com/jibintech/pharmtech

## Overview

PharmTech is a pharmacy management and point-of-sale system: staff authenticate, manage medicine inventory, and bill customers; the billing flow records items, deducts stock, and calculates GST. The frontend also supports prescription scanning and PDF receipts, while the backend exposes REST endpoints and persists pharmacy data. The README documents OCR.space and MySQL; source excerpts do not show all controller routes or persistence configuration, so some frontend-to-backend links are documented at the system level rather than attributed to individual endpoints.

Main entry points: [`backend/pharmtech/src/main/java/com/pharmtech/controller`](https://github.com/jibintech/pharmtech/tree/main/backend/pharmtech/src/main/java/com/pharmtech/controller) (REST endpoints), [`frontend/PharmTech/src/App.jsx`](https://github.com/jibintech/pharmtech/blob/main/frontend/PharmTech/src/App.jsx) (Routes and roles), [`frontend/PharmTech/src/pages/BillingPage.jsx`](https://github.com/jibintech/pharmtech/blob/main/frontend/PharmTech/src/pages/BillingPage.jsx) (Billing POS), [`backend/pharmtech/src/main/java/com/pharmtech/service/MedicineService.java`](https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/service/MedicineService.java) (Medicine inventory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["Routes and roles<br/>[App.jsx]"]
  node_login["Login screen<br/>[LoginPage.jsx]"]
  node_authstate["Auth state<br/>[AuthContext.jsx]"]
  node_inventoryui["Inventory console<br/>[AdminMedicines.jsx]"]
  node_billingui["Billing POS<br/>[BillingPage.jsx]"]
  node_clientapi["API client<br/>[api.js]"]
end

subgraph group_api["REST API"]
  node_backend["REST endpoints"]
  node_authcontroller["Auth endpoints"]
  node_medicinecontroller["Medicine endpoints"]
  node_billingcontroller["Billing endpoints"]
  node_ocrcontroller["OCR endpoint<br/>[OcrController.java]"]
  node_settingsusers["Admin endpoints"]
end

subgraph group_domain["Pharmacy operations"]
  node_inventory["Medicine inventory"]
  node_billing["Bill processing"]
  node_ocr["Prescription matching<br/>[OcrService.java]"]
  node_records["Domain records"]
  node_repositories["Data repositories"]
end

subgraph group_security["Identity and access"]
  node_authservice["Authentication<br/>[AuthService.java]"]
  node_jwt["JWT tokens<br/>[JwtService.java]"]
  node_securityfilter["JWT filtering"]
end

node_staff(("Pharmacy staff"))
node_database[("MySQL database")]
node_ocrspace["OCR.space"]

node_staff -->|"uses"| node_app
node_app -->|"routes"| node_login
node_app -->|"routes"| node_inventoryui
node_app -->|"routes"| node_billingui
node_app -->|"provides auth"| node_authstate
node_login -->|"authenticates via"| node_clientapi
node_login -->|"sets session"| node_authstate
node_inventoryui -->|"manages stock via"| node_clientapi
node_billingui -->|"bills via"| node_clientapi
node_billingui -.->|"scans prescriptions"| node_ocr
node_billingui -.->|"generates PDF"| node_billingui
node_clientapi -->|"REST requests"| node_backend
node_backend -.->|"dispatches auth"| node_authcontroller
node_backend -.->|"dispatches inventory"| node_medicinecontroller
node_backend -.->|"dispatches billing"| node_billingcontroller
node_backend -.->|"dispatches OCR"| node_ocrcontroller
node_backend -.->|"dispatches admin"| node_settingsusers
node_authcontroller -->|"delegates"| node_authservice
node_medicinecontroller -->|"delegates"| node_inventory
node_billingcontroller -->|"delegates"| node_billing
node_ocrcontroller -->|"delegates"| node_ocr
node_authservice -->|"creates tokens"| node_jwt
node_securityfilter -->|"validates tokens"| node_jwt
node_authservice -->|"stores users"| node_repositories
node_inventory -->|"reads and writes"| node_repositories
node_billing -->|"loads and saves"| node_repositories
node_ocr -->|"matches medicines"| node_inventory
node_ocr -.->|"extracts text"| node_ocrspace
node_repositories -.->|"persists records"| node_database
node_inventory -->|"operates on"| node_records
node_billing -->|"creates bills"| node_records

click node_app "https://github.com/jibintech/pharmtech/blob/main/frontend/PharmTech/src/App.jsx"
click node_login "https://github.com/jibintech/pharmtech/blob/main/frontend/PharmTech/src/pages/LoginPage.jsx"
click node_authstate "https://github.com/jibintech/pharmtech/blob/main/frontend/PharmTech/src/context/AuthContext.jsx"
click node_inventoryui "https://github.com/jibintech/pharmtech/blob/main/frontend/PharmTech/src/pages/AdminMedicines.jsx"
click node_billingui "https://github.com/jibintech/pharmtech/blob/main/frontend/PharmTech/src/pages/BillingPage.jsx"
click node_clientapi "https://github.com/jibintech/pharmtech/blob/main/frontend/PharmTech/src/api/api.js"
click node_backend "https://github.com/jibintech/pharmtech/tree/main/backend/pharmtech/src/main/java/com/pharmtech/controller"
click node_authcontroller "https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/controller/AuthController.java"
click node_medicinecontroller "https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/controller/MedicineController.java"
click node_billingcontroller "https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/controller/BillingController.java"
click node_ocrcontroller "https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/controller/OcrController.java"
click node_settingsusers "https://github.com/jibintech/pharmtech/tree/main/backend/pharmtech/src/main/java/com/pharmtech/controller"
click node_authservice "https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/service/AuthService.java"
click node_jwt "https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/security/JwtService.java"
click node_securityfilter "https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/security/JwtAuthenticationFilter.java"
click node_inventory "https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/service/MedicineService.java"
click node_billing "https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/service/BillingService.java"
click node_ocr "https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/service/OcrService.java"
click node_records "https://github.com/jibintech/pharmtech/tree/main/backend/pharmtech/src/main/java/com/pharmtech/model"
click node_repositories "https://github.com/jibintech/pharmtech/tree/main/backend/pharmtech/src/main/java/com/pharmtech/repository"

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_login,node_authstate,node_inventoryui,node_billingui,node_clientapi toneBlue
class node_backend,node_authcontroller,node_medicinecontroller,node_billingcontroller,node_ocrcontroller,node_settingsusers,node_database toneAmber
class node_inventory,node_billing,node_ocr,node_records,node_repositories toneMint
class node_authservice,node_jwt,node_securityfilter toneRose
class node_staff,node_ocrspace toneIndigo
```

## Components

### Web application

- [Routes and roles](https://github.com/jibintech/pharmtech/blob/main/frontend/PharmTech/src/App.jsx): `frontend/PharmTech/src/App.jsx`
- [Login screen](https://github.com/jibintech/pharmtech/blob/main/frontend/PharmTech/src/pages/LoginPage.jsx): `frontend/PharmTech/src/pages/LoginPage.jsx`
- [Auth state](https://github.com/jibintech/pharmtech/blob/main/frontend/PharmTech/src/context/AuthContext.jsx): `frontend/PharmTech/src/context/AuthContext.jsx`
- [Inventory console](https://github.com/jibintech/pharmtech/blob/main/frontend/PharmTech/src/pages/AdminMedicines.jsx): `frontend/PharmTech/src/pages/AdminMedicines.jsx`
- [Billing POS](https://github.com/jibintech/pharmtech/blob/main/frontend/PharmTech/src/pages/BillingPage.jsx): `frontend/PharmTech/src/pages/BillingPage.jsx`
- [API client](https://github.com/jibintech/pharmtech/blob/main/frontend/PharmTech/src/api/api.js): `frontend/PharmTech/src/api/api.js`

### REST API

- [REST endpoints](https://github.com/jibintech/pharmtech/tree/main/backend/pharmtech/src/main/java/com/pharmtech/controller): `backend/pharmtech/src/main/java/com/pharmtech/controller`
- [Auth endpoints](https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/controller/AuthController.java): `backend/pharmtech/src/main/java/com/pharmtech/controller/AuthController.java`
- [Medicine endpoints](https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/controller/MedicineController.java): `backend/pharmtech/src/main/java/com/pharmtech/controller/MedicineController.java`
- [Billing endpoints](https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/controller/BillingController.java): `backend/pharmtech/src/main/java/com/pharmtech/controller/BillingController.java`
- [OCR endpoint](https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/controller/OcrController.java): `backend/pharmtech/src/main/java/com/pharmtech/controller/OcrController.java`
- [Admin endpoints](https://github.com/jibintech/pharmtech/tree/main/backend/pharmtech/src/main/java/com/pharmtech/controller): `backend/pharmtech/src/main/java/com/pharmtech/controller`

### Pharmacy operations

- [Medicine inventory](https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/service/MedicineService.java): `backend/pharmtech/src/main/java/com/pharmtech/service/MedicineService.java`
- [Bill processing](https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/service/BillingService.java): `backend/pharmtech/src/main/java/com/pharmtech/service/BillingService.java`
- [Prescription matching](https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/service/OcrService.java): `backend/pharmtech/src/main/java/com/pharmtech/service/OcrService.java`
- [Domain records](https://github.com/jibintech/pharmtech/tree/main/backend/pharmtech/src/main/java/com/pharmtech/model): `backend/pharmtech/src/main/java/com/pharmtech/model`
- [Data repositories](https://github.com/jibintech/pharmtech/tree/main/backend/pharmtech/src/main/java/com/pharmtech/repository): `backend/pharmtech/src/main/java/com/pharmtech/repository`

### Identity and access

- [Authentication](https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/service/AuthService.java): `backend/pharmtech/src/main/java/com/pharmtech/service/AuthService.java`
- [JWT tokens](https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/security/JwtService.java): `backend/pharmtech/src/main/java/com/pharmtech/security/JwtService.java`
- [JWT filtering](https://github.com/jibintech/pharmtech/blob/main/backend/pharmtech/src/main/java/com/pharmtech/security/JwtAuthenticationFilter.java): `backend/pharmtech/src/main/java/com/pharmtech/security/JwtAuthenticationFilter.java`

### Other components

- **Pharmacy staff**
- **MySQL database**
- **OCR.space**

## Connections

- Pharmacy staff → Routes and roles: uses
- Routes and roles → Login screen: routes (evidence: `frontend/PharmTech/src/App.jsx`)
- Routes and roles → Inventory console: routes (evidence: `frontend/PharmTech/src/App.jsx`)
- Routes and roles → Billing POS: routes (evidence: `frontend/PharmTech/src/App.jsx`)
- Routes and roles → Auth state: provides auth (evidence: `frontend/PharmTech/src/App.jsx`)
- Login screen → API client: authenticates via (evidence: `frontend/PharmTech/src/pages/LoginPage.jsx`)
- Login screen → Auth state: sets session (evidence: `frontend/PharmTech/src/pages/LoginPage.jsx`)
- Inventory console → API client: manages stock via (evidence: `frontend/PharmTech/src/pages/AdminMedicines.jsx`)
- Billing POS → API client: bills via (evidence: `frontend/PharmTech/src/pages/BillingPage.jsx`)
- Billing POS → Prescription matching: scans prescriptions
- Billing POS → Billing POS: generates PDF (evidence: `frontend/PharmTech/src/pages/BillingPage.jsx`)
- API client → REST endpoints: REST requests
- REST endpoints → Auth endpoints: dispatches auth
- REST endpoints → Medicine endpoints: dispatches inventory
- REST endpoints → Billing endpoints: dispatches billing
- REST endpoints → OCR endpoint: dispatches OCR
- REST endpoints → Admin endpoints: dispatches admin
- Auth endpoints → Authentication: delegates (evidence: `backend/pharmtech/src/main/java/com/pharmtech/controller/AuthController.java`)
- Medicine endpoints → Medicine inventory: delegates (evidence: `backend/pharmtech/src/main/java/com/pharmtech/controller/MedicineController.java`)
- Billing endpoints → Bill processing: delegates (evidence: `backend/pharmtech/src/main/java/com/pharmtech/controller/BillingController.java`)
- OCR endpoint → Prescription matching: delegates (evidence: `backend/pharmtech/src/main/java/com/pharmtech/controller/OcrController.java`)
- Authentication → JWT tokens: creates tokens (evidence: `backend/pharmtech/src/main/java/com/pharmtech/service/AuthService.java`)
- JWT filtering → JWT tokens: validates tokens (evidence: `backend/pharmtech/src/main/java/com/pharmtech/security/JwtAuthenticationFilter.java`)
- Authentication → Data repositories: stores users (evidence: `backend/pharmtech/src/main/java/com/pharmtech/service/AuthService.java`)
- Medicine inventory → Data repositories: reads and writes (evidence: `backend/pharmtech/src/main/java/com/pharmtech/service/MedicineService.java`)
- Bill processing → Data repositories: loads and saves (evidence: `backend/pharmtech/src/main/java/com/pharmtech/service/BillingService.java`)
- Prescription matching → Medicine inventory: matches medicines (evidence: `backend/pharmtech/src/main/java/com/pharmtech/controller/OcrController.java`)
- Prescription matching → OCR.space: extracts text
- Data repositories → MySQL database: persists records
- Medicine inventory → Domain records: operates on (evidence: `backend/pharmtech/src/main/java/com/pharmtech/service/MedicineService.java`)
- Bill processing → Domain records: creates bills (evidence: `backend/pharmtech/src/main/java/com/pharmtech/service/BillingService.java`)
