# theb0se/medicare-v3-web architecture

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

- Interactive diagram: https://gitdiagram.com/theb0se/medicare-v3-web
- Repository: https://github.com/theb0se/medicare-v3-web

## Overview

1. **What this repo is**
   - A **React + Vite single-page frontend** for a healthcare/medicare platform.
   - The app is organized around patient workflows: **doctors, clinics, labs, appointments, orders, prescriptions, vitals, cart, profile, and payments**.

2. **Application shell**
   - `src/main.jsx` boots the app.
   - `src/App.jsx` is the top-level composition point, with shared layout/styling from `src/App.css` and `src/index.css`.
   - The global shell is split into `src/Global/Main.jsx`, `Topbar`, `Footer`, and language selection components, which likely wrap most pages.

3. **Page-level architecture**
   - `src/Pages` contains the route-backed screens.
   - The page set shows the main domains:
     - **Discovery**: Home, Search, Doctors, Clinics, Labs, Products, Blogs
     - **Transactions**: Cart, PaymentProcess, Orders, Subscriptions
     - **Healthcare flows**: Appointments, Lab test bookings, Prescriptions, Vitals, Profile
     - **Auth/account**: Login, Signup, FamilyMember, Files
   - `src/Pages/WebPages/Webpage.jsx` suggests support for generic CMS/static content pages.

4. **Reusable feature components**
   - `src/Components` holds reusable UI blocks that map to major business features.
   - Examples include:
     - **Booking and patient actions**: `AddDoctorReview`, `AddMoney`, `SubscriptionDetails`, `LoginModal`
     - **Discovery widgets**: `Doctors`, `Clinics`, `Labs`, `Departments`, `FeaturedBlogs`, `Search`
     - **Communication and engagement**: `ChatPopup`, `Notification`, `WhatsappFloatingBtn`
     - **Identity/profile UI**: `ProfilePicture`, `UserProfile`, `FamilyMembers`, `EmailBox`
     - **Location and map helpers**: `Maps`, `LocationSeletor`, `ContactDetails`
   - This layer is the main view composition boundary beneath pages.

5. **Shared state and cross-cutting context**
   - `src/Context` contains app-wide state:
     - `ChatContext` for conversation-related state
     - `SelectedCity` for location-aware browsing and filtering
   - This indicates the UI is not purely local-state driven; several features depend on **shared context** across pages/components.

6. **Custom hooks as the data and UI logic layer**
   - `src/Hooks` centralizes reusable behavior:
     - **Data access/state hooks**: `UserData`, `SettingData`, `WebSettings`, `UseLabData`, `CartData`, `LabCartData`
     - **Payments**: `UsePaymentController`, `Paymntgetways`
     - **Search/UX**: `UseDebounce`, `UseSearchFilter`, `StatusBadge`, `RatingStars`, `UseFormatCurrency`
     - **Localization**: `UseLang`
   - These hooks appear to be the primary bridge between components and the controller/API layer.

7. **Controller layer: API, auth, and business adapters**
   - `src/Controllers` is the main integration boundary.
   - It contains:
     - **API wiring**: `api.js`, `apiAddress.js`, `ApiControllers.js`
     - **Identity/session**: `token.js`, `user.js`, `logout.js`, `updateUserLocalStorage.js`
     - **Domain helpers**: `currentCity.js`, `currency.js`, `defaultISD.js`, `ISDCODES.js`, `PageName.js`, `CurrName.js`
     - **Utility integrations**: `printPDF.js`, `createCalendarUrls.js`, `callBackUrl.js`
   - This layer likely normalizes backend responses and isolates the UI from direct API details.

8. **Payment and external service integration**
   - The repo has explicit support for **Razorpay** and **Stripe** through `RazorpayPaymentController.jsx`, `RazorpaySecret.js`, and `StripePayController.jsx`.
   - `src/lib/addPayment.js` and payment-related hooks imply a dedicated payment flow abstraction.
   - `src/Controllers/firebase.config.js` shows **Firebase** integration.
   - `src/Utils/initOtpless.js` indicates OTP-based login/verification via an external auth provider.
   - These integrations are central architecture boundaries because they drive separate async flows from the core UI.

9. **Internationalization and locale delivery**
   - Localization is built into the app:
     - `src/i18n/i18n.js` configures runtime translation support.
     - `public/Locales/*` contains translations for multiple languages: Arabic, English, Spanish, French, Hindi, Portuguese, Russian, Turkish, and a PHP locale file.
   - `LanguageSelector` in the global layer likely switches the active language.
   - This suggests the UI is designed for multi-region deployment and user-facing content translation.

10. **Domain structure: healthcare marketplace + patient management**
   - The feature set implies two overlapping product areas:
     - a **marketplace/discovery layer** for doctors, clinics, labs, and products
     - a **patient management layer** for appointments, lab tests, vitals, prescriptions, family members, and profile data
   - Pages such as `AppointmentDetails`, `LabTestBookingDetails`, `OrderDetails`, and `Vitals/*` show that the frontend supports both browsing and post-booking management.

11. **Infrastructure and deployment hints**
   - `public/.htaccess` suggests deployment on an **Apache-compatible host** with SPA routing support.
   - `index.html`, `vite.config.js`, `tailwind.config.js`, `postcss.config.js`, and `theme.js` point to a modern Vite build with **Tailwind-based styling** and custom theme configuration.
   - `components.json` indicates a component tooling convention, likely for generated/shared UI primitives.

12. **Practical architecture diagram takeaway**
   - A useful diagram would show:
     - **Browser/UI shell** at the top
     - **Pages** as route entry points
     - **Shared Components** beneath pages
     - **Context + Hooks** as the client-side state/logic layer
     - **Controllers/Lib/Utils** as the service and integration boundary
     - External systems: **backend API**, **payment gateways**, **Firebase**, **OTP provider**, and **localization assets**
   - The repository is primarily a **frontend orchestration layer**, not a full-stack monolith.

Main entry points: [`src/Controllers/ApiControllers.js`](https://github.com/theb0se/medicare-v3-web/blob/main/src/Controllers/ApiControllers.js) (API controllers), [`src/Pages`](https://github.com/theb0se/medicare-v3-web/tree/main/src/Pages) (Pages), [`src/Hooks/UserData.jsx`](https://github.com/theb0se/medicare-v3-web/blob/main/src/Hooks/UserData.jsx) (Data hooks), [`src/App.jsx`](https://github.com/theb0se/medicare-v3-web/blob/main/src/App.jsx) (App root)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g1["App shell"]
  node_n1(("Entry point<br/>bootstrap<br/>[main.jsx]"))
  node_n2["App root<br/>composition<br/>[App.jsx]"]
  node_n3["Global shell<br/>layout<br/>[Main.jsx]"]
end

subgraph group_g2["Feature UI"]
  node_n4["Pages<br/>routes"]
  node_n5["Page flows<br/>domain screens"]
  node_n6["Discovery UI<br/>marketplace views<br/>[Doctors.jsx]"]
  node_n7["Patient UI<br/>patient views<br/>[LoginModal.jsx]"]
end

subgraph group_g3["State & logic"]
  node_n8(("Chat context<br/>shared state<br/>[ChatContext.jsx]"))
  node_n9(("City context<br/>shared state<br/>[SelectedCity.jsx]"))
  node_n10["Data hooks<br/>client logic<br/>[UserData.jsx]"]
  node_n11["Search & UX hooks<br/>client logic"]
  node_n12["Language hook<br/>localization<br/>[UseLang.jsx]"]
end

subgraph group_g4["Integrations"]
  node_n13["API controllers<br/>backend adapter<br/>[ApiControllers.js]"]
  node_n14["Session helpers<br/>auth/session<br/>[token.js]"]
  node_n15["Payments<br/>payment adapters"]
  node_n16["Firebase<br/>backend service<br/>[firebase.config.js]"]
  node_n17["OTP auth<br/>auth provider<br/>[initOtpless.js]"]
  node_n18["Locale assets<br/>translations<br/>[en.json]"]
end

node_n1 -->|"boots"| node_n2
node_n2 -->|"wraps"| node_n3
node_n2 -->|"routes to"| node_n4
node_n3 -->|"switches language"| node_n12
node_n4 -->|"includes"| node_n5
node_n4 -->|"uses"| node_n6
node_n4 -->|"uses"| node_n7
node_n6 -->|"reads state"| node_n10
node_n7 -->|"reads state"| node_n10
node_n7 -->|"shares chat"| node_n8
node_n6 -->|"filters by city"| node_n9
node_n10 -->|"fetches via"| node_n13
node_n10 -->|"uses"| node_n14
node_n11 -->|"supports"| node_n13
node_n13 -->|"invokes"| node_n15
node_n13 -->|"connects"| node_n16
node_n14 -->|"authenticates"| node_n17
node_n12 -->|"loads"| node_n18
node_n15 -->|"depends on"| node_n13

click node_n1 "https://github.com/theb0se/medicare-v3-web/blob/main/src/main.jsx"
click node_n2 "https://github.com/theb0se/medicare-v3-web/blob/main/src/App.jsx"
click node_n3 "https://github.com/theb0se/medicare-v3-web/blob/main/src/Global/Main.jsx"
click node_n4 "https://github.com/theb0se/medicare-v3-web/tree/main/src/Pages"
click node_n5 "https://github.com/theb0se/medicare-v3-web/blob/main/src/Pages/AppointmentDetails.jsx"
click node_n6 "https://github.com/theb0se/medicare-v3-web/blob/main/src/Components/Doctors.jsx"
click node_n7 "https://github.com/theb0se/medicare-v3-web/blob/main/src/Components/LoginModal.jsx"
click node_n8 "https://github.com/theb0se/medicare-v3-web/blob/main/src/Context/ChatContext.jsx"
click node_n9 "https://github.com/theb0se/medicare-v3-web/blob/main/src/Context/SelectedCity.jsx"
click node_n10 "https://github.com/theb0se/medicare-v3-web/blob/main/src/Hooks/UserData.jsx"
click node_n11 "https://github.com/theb0se/medicare-v3-web/blob/main/src/Hooks/UseSearchFilter.jsx"
click node_n12 "https://github.com/theb0se/medicare-v3-web/blob/main/src/Hooks/UseLang.jsx"
click node_n13 "https://github.com/theb0se/medicare-v3-web/blob/main/src/Controllers/ApiControllers.js"
click node_n14 "https://github.com/theb0se/medicare-v3-web/blob/main/src/Controllers/token.js"
click node_n15 "https://github.com/theb0se/medicare-v3-web/blob/main/src/Controllers/RazorpayPaymentController.jsx"
click node_n16 "https://github.com/theb0se/medicare-v3-web/blob/main/src/Controllers/firebase.config.js"
click node_n17 "https://github.com/theb0se/medicare-v3-web/blob/main/src/Utils/initOtpless.js"
click node_n18 "https://github.com/theb0se/medicare-v3-web/blob/main/public/Locales/en.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_n1,node_n2,node_n3 toneBlue
class node_n4,node_n5,node_n6,node_n7 toneAmber
class node_n8,node_n9,node_n10,node_n11,node_n12 toneMint
class node_n13,node_n14,node_n15,node_n16,node_n17,node_n18 toneRose
```

## Components

### App shell

Bootstrapping, global layout, and route composition.

- [Entry point](https://github.com/theb0se/medicare-v3-web/blob/main/src/main.jsx): bootstrap · Starts the Vite app and mounts the React tree. · `src/main.jsx`
- [App root](https://github.com/theb0se/medicare-v3-web/blob/main/src/App.jsx): composition · Top-level composition and app-wide wiring. · `src/App.jsx`
- [Global shell](https://github.com/theb0se/medicare-v3-web/blob/main/src/Global/Main.jsx): layout · Shared chrome such as main frame, top bar, footer, and language switching. · `src/Global/Main.jsx`

### Feature UI

Route-backed screens and reusable business-facing view components.

- [Pages](https://github.com/theb0se/medicare-v3-web/tree/main/src/Pages): routes · Route-backed screens for discovery, patient workflows, and account areas. · `src/Pages`
- [Page flows](https://github.com/theb0se/medicare-v3-web/blob/main/src/Pages/AppointmentDetails.jsx): domain screens · Major journey pages such as appointments, labs, orders, profile, and payments. · `src/Pages/AppointmentDetails.jsx`
- [Discovery UI](https://github.com/theb0se/medicare-v3-web/blob/main/src/Components/Doctors.jsx): marketplace views · Reusable widgets for doctors, clinics, labs, search, blogs, and featured content. · `src/Components/Doctors.jsx`
- [Patient UI](https://github.com/theb0se/medicare-v3-web/blob/main/src/Components/LoginModal.jsx): patient views · Widgets for booking, messaging, identity, wallet, and patient engagement. · `src/Components/LoginModal.jsx`

### State & logic

Shared client state, hooks, and cross-cutting helpers.

- [Chat context](https://github.com/theb0se/medicare-v3-web/blob/main/src/Context/ChatContext.jsx): shared state · App-wide conversation state for chat-driven interactions. · `src/Context/ChatContext.jsx`
- [City context](https://github.com/theb0se/medicare-v3-web/blob/main/src/Context/SelectedCity.jsx): shared state · Selected city state for location-aware browsing and filtering. · `src/Context/SelectedCity.jsx`
- [Data hooks](https://github.com/theb0se/medicare-v3-web/blob/main/src/Hooks/UserData.jsx): client logic · Reusable hooks for user data, settings, web config, carts, and lab data. · `src/Hooks/UserData.jsx`
- [Search & UX hooks](https://github.com/theb0se/medicare-v3-web/blob/main/src/Hooks/UseSearchFilter.jsx): client logic · Debounce, search filtering, currency formatting, rating, and status helpers. · `src/Hooks/UseSearchFilter.jsx`
- [Language hook](https://github.com/theb0se/medicare-v3-web/blob/main/src/Hooks/UseLang.jsx): localization · Connects UI components to the active language. · `src/Hooks/UseLang.jsx`

### Integrations

Backend, payments, auth, localization, and external services.

- [API controllers](https://github.com/theb0se/medicare-v3-web/blob/main/src/Controllers/ApiControllers.js): backend adapter · Central API wiring, addresses, and domain controller surface. · `src/Controllers/ApiControllers.js`
- [Session helpers](https://github.com/theb0se/medicare-v3-web/blob/main/src/Controllers/token.js): auth/session · Token, user, logout, and local storage synchronization helpers. · `src/Controllers/token.js`
- [Payments](https://github.com/theb0se/medicare-v3-web/blob/main/src/Controllers/RazorpayPaymentController.jsx): payment adapters · Razorpay and Stripe payment controllers plus payment orchestration helpers. · `src/Controllers/RazorpayPaymentController.jsx`
- [Firebase](https://github.com/theb0se/medicare-v3-web/blob/main/src/Controllers/firebase.config.js): backend service · Firebase configuration for external service integration. · `src/Controllers/firebase.config.js`
- [OTP auth](https://github.com/theb0se/medicare-v3-web/blob/main/src/Utils/initOtpless.js): auth provider · OTP login and verification bootstrap. · `src/Utils/initOtpless.js`
- [Locale assets](https://github.com/theb0se/medicare-v3-web/blob/main/public/Locales/en.json): translations · Runtime locale bundles for supported languages. · `public/Locales/en.json`

## Connections

- Entry point → App root: boots · Entry point mounts the application root.
- App root → Global shell: wraps · App root composes the shared global shell.
- App root → Pages: routes to · App root exposes route-backed pages.
- Global shell → Language hook: switches language · Global shell surfaces language selection to the active locale hook.
- Pages → Page flows: includes · Pages cover the main patient and marketplace flows.
- Pages → Discovery UI: uses · Pages assemble discovery-oriented reusable UI.
- Pages → Patient UI: uses · Pages assemble patient and account UI.
- Discovery UI → Data hooks: reads state · Discovery widgets consume shared data hooks.
- Patient UI → Data hooks: reads state · Patient widgets consume shared data hooks.
- Patient UI → Chat context: shares chat · Engagement UI depends on chat context.
- Discovery UI → City context: filters by city · Marketplace widgets depend on selected city context.
- Data hooks → API controllers: fetches via · Client hooks bridge to the controller/API layer.
- Data hooks → Session helpers: uses · Data hooks rely on session and identity helpers.
- Search & UX hooks → API controllers: supports · Search and formatting hooks sit above the integration layer.
- API controllers → Payments: invokes · Controllers coordinate payment providers.
- API controllers → Firebase: connects · Controllers integrate with Firebase.
- Session helpers → OTP auth: authenticates · Session management pairs with OTP-based authentication.
- Language hook → Locale assets: loads · Language hook consumes locale bundles.
- Payments → API controllers: depends on · Payment adapters rely on the core API/controller boundary.
