# rahulr324/medfinder architecture

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

- Interactive diagram: https://gitdiagram.com/rahulr324/medfinder
- Repository: https://github.com/rahulr324/medfinder

## Overview

MedFinder lets users search for medicines by name and locality, then returns matching pharmacies with prices and store details. The backend also exposes a common-medicines catalog and initializes MongoDB from sample data. The README describes price comparison and store-location features; the sampled backend returns price and location fields, but the HTML files were not sampled, so frontend-to-API wiring is unverified.

Main entry points: [`nodejs-backend.js`](https://github.com/rahulr324/medfinder/blob/main/nodejs-backend.js) (Pharmacy search), [`search.html`](https://github.com/rahulr324/medfinder/blob/main/search.html) (Search page), [`results-html.html`](https://github.com/rahulr324/medfinder/blob/main/results-html.html) (Results view), [`sample.json`](https://github.com/rahulr324/medfinder/blob/main/sample.json) (Sample pharmacy data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web interface"]
  node_search_ui["Search page<br/>[search.html]"]
  node_results_ui["Results view<br/>[results-html.html]"]
  node_home_ui["Application page<br/>[index.html]"]
end

subgraph group_backend["Search backend"]
  node_server["HTTP server<br/>[nodejs-backend.js]"]
  node_search_api["Pharmacy search<br/>[nodejs-backend.js]"]
  node_catalog_api["Common medicines API<br/>[nodejs-backend.js]"]
  node_bootstrap["Data initializer<br/>[nodejs-backend.js]"]
end

subgraph group_data["Medicine data"]
  node_sample_data["Sample pharmacy data<br/>[sample.json]"]
  node_store_data[("Pharmacy records")]
  node_medicine_catalog[("Common medicine list")]
end

node_user(("Medicine seeker"))
node_atlas[("MongoDB Atlas")]

node_user -.->|"searches in"| node_search_ui
node_search_ui -.->|"submits query"| node_search_api
node_search_api -->|"queries stores"| node_store_data
node_search_api -.->|"returns matches"| node_results_ui
node_server -->|"routes requests"| node_search_api
node_server -->|"routes requests"| node_catalog_api
node_catalog_api -->|"reads list"| node_medicine_catalog
node_bootstrap -->|"reads records"| node_sample_data
node_bootstrap -->|"seeds stores"| node_store_data
node_bootstrap -->|"seeds medicines"| node_medicine_catalog
node_server -->|"connects to"| node_atlas

click node_search_ui "https://github.com/rahulr324/medfinder/blob/main/search.html"
click node_results_ui "https://github.com/rahulr324/medfinder/blob/main/results-html.html"
click node_home_ui "https://github.com/rahulr324/medfinder/blob/main/index.html"
click node_server "https://github.com/rahulr324/medfinder/blob/main/nodejs-backend.js"
click node_search_api "https://github.com/rahulr324/medfinder/blob/main/nodejs-backend.js"
click node_catalog_api "https://github.com/rahulr324/medfinder/blob/main/nodejs-backend.js"
click node_bootstrap "https://github.com/rahulr324/medfinder/blob/main/nodejs-backend.js"
click node_sample_data "https://github.com/rahulr324/medfinder/blob/main/sample.json"

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_search_ui,node_results_ui,node_home_ui toneBlue
class node_server,node_search_api,node_catalog_api,node_bootstrap,node_atlas toneAmber
class node_sample_data,node_store_data,node_medicine_catalog toneMint
class node_user toneIndigo
```

## Components

### Web interface

- [Search page](https://github.com/rahulr324/medfinder/blob/main/search.html): `search.html`
- [Results view](https://github.com/rahulr324/medfinder/blob/main/results-html.html): `results-html.html`
- [Application page](https://github.com/rahulr324/medfinder/blob/main/index.html): `index.html`

### Search backend

- [HTTP server](https://github.com/rahulr324/medfinder/blob/main/nodejs-backend.js): `nodejs-backend.js`
- [Pharmacy search](https://github.com/rahulr324/medfinder/blob/main/nodejs-backend.js): `nodejs-backend.js`
- [Common medicines API](https://github.com/rahulr324/medfinder/blob/main/nodejs-backend.js): `nodejs-backend.js`
- [Data initializer](https://github.com/rahulr324/medfinder/blob/main/nodejs-backend.js): `nodejs-backend.js`

### Medicine data

- [Sample pharmacy data](https://github.com/rahulr324/medfinder/blob/main/sample.json): `sample.json`
- **Pharmacy records**
- **Common medicine list**

### Other components

- **Medicine seeker**
- **MongoDB Atlas**

## Connections

- Medicine seeker → Search page: searches in (evidence: `README.md`)
- Search page → Pharmacy search: submits query
- Pharmacy search → Pharmacy records: queries stores (evidence: `nodejs-backend.js`)
- Pharmacy search → Results view: returns matches
- HTTP server → Pharmacy search: routes requests (evidence: `nodejs-backend.js`)
- HTTP server → Common medicines API: routes requests (evidence: `nodejs-backend.js`)
- Common medicines API → Common medicine list: reads list (evidence: `nodejs-backend.js`)
- Data initializer → Sample pharmacy data: reads records (evidence: `nodejs-backend.js`)
- Data initializer → Pharmacy records: seeds stores (evidence: `nodejs-backend.js`)
- Data initializer → Common medicine list: seeds medicines (evidence: `nodejs-backend.js`)
- HTTP server → MongoDB Atlas: connects to (evidence: `nodejs-backend.js`)
