# mohdabdulrah/jaruratcare architecture

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

- Interactive diagram: https://gitdiagram.com/mohdabdulrah/jaruratcare
- Repository: https://github.com/mohdabdulrah/jaruratcare

## Overview

##### Project type and purpose
- This is a client-side single-page React application (“Patient Records Dashboard”) built with Vite and styled via Tailwind CSS.
- It fetches patient data from an external mock API and manages state locally (no custom backend).

##### File structure
- Top-level files:
- index.html: SPA shell
- package.json / vite.config.js: build & dev server config
- README.md, .gitignore, eslint.config.js
- public/: static assets served “as is”
- src/: source code
- main.jsx: React entry point (mounts App)
- App.jsx + App.css: root component & styling
- pages/: route‐level components (Home.jsx, Patients.jsx, About.jsx)
- index.css: global styles (including Tailwind directives)

##### README for additional insights
- Tech stack: React 18, Vite, Tailwind CSS, ES6+
- Runtime behavior:
- Landing page with nav
- Patients page: fetch `https://jsonplaceholder.typicode.com/users` → show cards/grid
- Search/filter & modal flows (view details, add record)
- No persistent backend; adds only update in-memory state
- Deployment: Vercel or Netlify from `dist/`

##### Main components of the system
a. Browser / User Agent
b. React SPA
– Vite Dev Server (dev) / Bundler → generates JS/CSS assets
– index.html → mounts React into `
`
– React Component Tree:
- App → NavBar, Router Outlet
- Pages: Home, Patients, About
- Patients subcomponents:
– PatientCardGrid
– SearchBar
– PatientDetailModal
– AddPatientModal
- Tailwind CSS classes for styling
c. External Service
– JSONPlaceholder REST API (`/users`)
d. Local State Store
– React useState/useEffect hooks for fetched data and form state

##### Relationships and interactions
- User clicks nav → React Router updates “page”
- Patients.jsx mounts → useEffect triggers GET request → external API → JSON data
- Data stored in component state → passed to PatientCardGrid
- SearchBar emits filter criteria → Patients component filters list
- Click card → open PatientDetailModal (reads state)
- Button → opens AddPatientModal → on submit → update state array (no API)
- Build process: source (src/) → Vite bundles → dist/ → deploy on Netlify/Vercel

##### Architectural patterns & design principles
- Component-based architecture (separation of concerns):
- Pages vs UI widgets vs modals
- Presentational vs container components
- Single source of truth for patient list in top-level Patients component
- Stateless vs stateful components
- Unidirectional data flow (props down, callbacks up)

- Arrowheads on each connector to show request/response or event flow
- Notes on important frameworks (React, Vite, Tailwind CSS)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Environment"
        Browser["User Browser"]:::external
    end

    subgraph "React SPA (Vite + React + Tailwind)" 
        Shell["SPA Shell\nindex.html"]:::frontend
        Entry["React Entry Point\nmain.jsx"]:::frontend
        AppComp["Root Component\nApp.jsx"]:::frontend
        AppCSS["Styling\nApp.css"]:::frontend
        GlobalCSS["Global Styles\nindex.css"]:::frontend
        subgraph "Pages"
            Home["Home Page\nHome.jsx"]:::frontend
            Patients["Patients Page\nPatients.jsx"]:::frontend
            About["About Page\nAbout.jsx"]:::frontend
        end
        Assets["Static Assets\nsrc/assets/"]:::frontend
        Public["Public Files\npublic/"]:::frontend
        State[(In-memory State)]:::state
        PatientGrid["PatientCardGrid"]:::frontend
        SearchBar["SearchBar"]:::frontend
        ModalDetail["PatientDetailModal"]:::frontend
        ModalAdd["AddPatientModal"]:::frontend
    end

    API["JSONPlaceholder API\n(GET /users)"]:::external
    subgraph "Build & Deploy Pipeline"
        Src["Source Code\nsrc/"]:::pipeline
        Vite["Vite Build\n(vite.config.js)"]:::pipeline
        Dist["Bundled Assets\ndist/"]:::pipeline
        Deploy["Deployment\nVercel/Netlify"]:::hosting
    end

    Browser -->|"HTTP GET index.html & bundle.js"| Shell
    Shell --> Entry
    Entry --> AppComp
    AppComp --> Home
    AppComp --> Patients
    AppComp --> About
    AppComp --> AppCSS
    AppComp --> GlobalCSS
    AppComp --> Assets
    AppComp --> Public

    Patients --> PatientGrid
    Patients --> SearchBar
    Patients --> ModalDetail
    Patients --> ModalAdd
    Patients --> State

    SearchBar --> State
    PatientGrid --> State
    ModalDetail --> State
    ModalAdd --> State

    Patients -->|"fetch /users"| API
    API -->|"JSON Data"| Patients

    Browser -->|"User Events & UI Render"| AppComp

    Src --> Vite --> Dist --> Deploy

    %% Click Events
    click Shell "https://github.com/mohdabdulrah/jaruratcare/blob/main/index.html"
    click Vite "https://github.com/mohdabdulrah/jaruratcare/blob/main/vite.config.js"
    click Vite "https://github.com/mohdabdulrah/jaruratcare/blob/main/package.json"
    click Entry "https://github.com/mohdabdulrah/jaruratcare/blob/main/src/main.jsx"
    click AppComp "https://github.com/mohdabdulrah/jaruratcare/blob/main/src/App.jsx"
    click AppCSS "https://github.com/mohdabdulrah/jaruratcare/blob/main/src/App.css"
    click GlobalCSS "https://github.com/mohdabdulrah/jaruratcare/blob/main/src/index.css"
    click Home "https://github.com/mohdabdulrah/jaruratcare/blob/main/src/pages/Home.jsx"
    click Patients "https://github.com/mohdabdulrah/jaruratcare/blob/main/src/pages/Patients.jsx"
    click About "https://github.com/mohdabdulrah/jaruratcare/blob/main/src/pages/About.jsx"
    click Assets "https://github.com/mohdabdulrah/jaruratcare/tree/main/src/assets/"
    click Public "https://github.com/mohdabdulrah/jaruratcare/tree/main/public/"
    click README "https://github.com/mohdabdulrah/jaruratcare/blob/main/README.md"
    click ESLint "https://github.com/mohdabdulrah/jaruratcare/blob/main/eslint.config.js"
    click GitIgnore "https://github.com/mohdabdulrah/jaruratcare/blob/main/.gitignore"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#005B96,stroke-width:1px
    classDef external fill:#DFF2BF,stroke:#4F8A10,stroke-width:1px
    classDef pipeline fill:#F0F0F0,stroke:#A0A0A0,stroke-width:1px
    classDef hosting fill:#FFE0B2,stroke:#FF9800,stroke-width:1px
    classDef state fill:#FFFFFF,stroke:#000000,stroke-dasharray: 5 5
```
