# naga-balaji/dawa-find-frontend architecture

> Architecture diagram of the GitHub repository naga-balaji/dawa-find-frontend, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/naga-balaji/dawa-find-frontend
- Repository: https://github.com/naga-balaji/dawa-find-frontend

## Overview

Dawa-Find is a React frontend for finding nearby pharmacies and medicines, viewing shop inventory, scanning prescriptions for medicine matches, and supporting pharmacy partners and administrators. Users search or browse from the map, refine by radius, and open a pharmacy detail page; prescription scans upload an image and location context for analysis and nearby stock results. Authentication stores a JWT for API requests, while role-gated routes expose pharmacy and admin areas. The README documents these capabilities; partner-page implementation details were not sampled, so their API wiring is not inferred.

Main entry points: [`src/App.jsx`](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/App.jsx) (Routes and navigation), [`src/api/client.js`](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/api/client.js) (HTTP client and JWT), [`src/components/RequireRole.jsx`](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/components/RequireRole.jsx) (Role route gate), [`src/auth.js`](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/auth.js) (Session helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Pharmacy discovery"]
  node_home["Map and medicine search<br/>[Home.jsx]"]
  node_detail["Pharmacy inventory detail<br/>[PharmacyDetail.jsx]"]
end

subgraph group_identity["Identity and access"]
  node_api["HTTP client and JWT<br/>[client.js]"]
  node_auth["Session helpers<br/>[auth.js]"]
  node_role_gate["Role route gate<br/>[RequireRole.jsx]"]
  node_login["Login<br/>[Login.jsx]"]
  node_register["Registration<br/>[Register.jsx]"]
end

subgraph group_prescription["Prescription scan"]
  node_prescription_page["Prescription scan<br/>[Prescription.jsx]"]
end

subgraph group_operations["Pharmacy operations"]
  node_partner_shop["Partner shop<br/>[PartnerShop.jsx]"]
  node_partner_inventory["Partner inventory"]
  node_admin["Pharmacy verification"]
end

node_visitor(("Medicine seeker"))
node_pharmacy_actor(("Pharmacy partner"))
node_admin_actor(("Platform administrator"))
node_main["React entry<br/>[main.jsx]"]
node_app["Routes and navigation<br/>[App.jsx]"]
node_backend["Dawa-Find API"]

node_main -->|"mounts"| node_app
node_app -->|"routes"| node_home
node_app -->|"routes"| node_detail
node_app -->|"routes"| node_prescription_page
node_app -->|"routes"| node_login
node_app -->|"routes"| node_register
node_app -->|"guards routes"| node_role_gate
node_role_gate -->|"allows pharmacy"| node_partner_shop
node_role_gate -->|"allows pharmacy"| node_partner_inventory
node_role_gate -->|"allows admin"| node_admin
node_visitor -->|"searches nearby"| node_home
node_home -->|"requests pharmacies"| node_api
node_detail -->|"loads shop inventory"| node_api
node_prescription_page -->|"submits scan"| node_api
node_admin -->|"loads and updates"| node_api
node_app -->|"logs out"| node_api
node_login -->|"sets session"| node_auth
node_register -->|"sets session"| node_auth
node_app -->|"reads session"| node_auth
node_role_gate -->|"checks role"| node_auth
node_api -->|"clears expired session"| node_auth
node_api -->|"sends API requests"| node_backend
node_backend -->|"returns responses"| node_api
node_pharmacy_actor -->|"manages shop"| node_partner_shop
node_pharmacy_actor -->|"updates stock"| node_partner_inventory
node_admin_actor -->|"reviews pharmacies"| node_admin

click node_main "https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/main.jsx"
click node_app "https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/App.jsx"
click node_home "https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/Home.jsx"
click node_detail "https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/PharmacyDetail.jsx"
click node_api "https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/api/client.js"
click node_auth "https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/auth.js"
click node_role_gate "https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/components/RequireRole.jsx"
click node_login "https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/Login.jsx"
click node_register "https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/Register.jsx"
click node_prescription_page "https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/Prescription.jsx"
click node_partner_shop "https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/PartnerShop.jsx"
click node_partner_inventory "https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/PartnerInventory.jsx"
click node_admin "https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/AdminPharmacies.jsx"

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_home,node_detail toneBlue
class node_api,node_auth,node_role_gate,node_login,node_register toneAmber
class node_prescription_page,node_app,node_backend toneMint
class node_partner_shop,node_partner_inventory,node_admin toneRose
class node_visitor,node_pharmacy_actor,node_admin_actor toneIndigo
class node_main toneTeal
```

## Components

### Pharmacy discovery

- [Map and medicine search](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/Home.jsx): `src/pages/Home.jsx`
- [Pharmacy inventory detail](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/PharmacyDetail.jsx): `src/pages/PharmacyDetail.jsx`

### Identity and access

- [HTTP client and JWT](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/api/client.js): `src/api/client.js`
- [Session helpers](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/auth.js): `src/auth.js`
- [Role route gate](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/components/RequireRole.jsx): `src/components/RequireRole.jsx`
- [Login](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/Login.jsx): `src/pages/Login.jsx`
- [Registration](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/Register.jsx): `src/pages/Register.jsx`

### Prescription scan

- [Prescription scan](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/Prescription.jsx): `src/pages/Prescription.jsx`

### Pharmacy operations

- [Partner shop](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/PartnerShop.jsx): `src/pages/PartnerShop.jsx`
- [Partner inventory](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/PartnerInventory.jsx): `src/pages/PartnerInventory.jsx`
- [Pharmacy verification](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/pages/AdminPharmacies.jsx): `src/pages/AdminPharmacies.jsx`

### Other components

- **Medicine seeker**
- **Pharmacy partner**
- **Platform administrator**
- [React entry](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/main.jsx): `src/main.jsx`
- [Routes and navigation](https://github.com/naga-balaji/dawa-find-frontend/blob/main/src/App.jsx): `src/App.jsx`
- **Dawa-Find API**

## Connections

- React entry → Routes and navigation: mounts
- Routes and navigation → Map and medicine search: routes
- Routes and navigation → Pharmacy inventory detail: routes
- Routes and navigation → Prescription scan: routes
- Routes and navigation → Login: routes
- Routes and navigation → Registration: routes
- Routes and navigation → Role route gate: guards routes
- Role route gate → Partner shop: allows pharmacy
- Role route gate → Partner inventory: allows pharmacy
- Role route gate → Pharmacy verification: allows admin
- Medicine seeker → Map and medicine search: searches nearby
- Map and medicine search → HTTP client and JWT: requests pharmacies
- Pharmacy inventory detail → HTTP client and JWT: loads shop inventory
- Prescription scan → HTTP client and JWT: submits scan
- Pharmacy verification → HTTP client and JWT: loads and updates
- Routes and navigation → HTTP client and JWT: logs out
- Login → Session helpers: sets session
- Registration → Session helpers: sets session
- Routes and navigation → Session helpers: reads session
- Role route gate → Session helpers: checks role
- HTTP client and JWT → Session helpers: clears expired session
- HTTP client and JWT → Dawa-Find API: sends API requests
- Dawa-Find API → HTTP client and JWT: returns responses
- Pharmacy partner → Partner shop: manages shop
- Pharmacy partner → Partner inventory: updates stock
- Platform administrator → Pharmacy verification: reviews pharmacies
