# pujari431/find-my-doc-now architecture

> Architecture diagram of the GitHub repository pujari431/find-my-doc-now, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pujari431/find-my-doc-now
- Repository: https://github.com/pujari431/find-my-doc-now

## Overview

##### Project type and purpose
- This is a single-page, full-client React application built with Vite and TypeScript, using shadcn-ui and Tailwind for styling.
- Its purpose is to present a list of doctors and detailed doctor profiles via pages under `src/pages`, powered by a light “doctor-service” client in `src/lib/doctor-service.ts`.

##### File structure
- Top-level files:
- `index.html`, `public/` → static entry point & assets
- Vite config & TS configs → build and type setup
- `src/` → application code
- `src/main.tsx` → SPA bootstrap
- `src/App.tsx` → top-level router and shell
- `src/pages/*` → route components like Home, Doctors, DoctorProfile, NotFound
- `src/components/` → reusable UI slices (Navbar, Hero, Footer, DoctorCard)
- `src/components/ui/` → shadcn-ui primitives (buttons, dialogs, inputs, etc.)
- `src/lib/doctor-service.ts` → API client calling external backend
- `src/hooks/` → custom hooks (mobile detection, toast notifications)

##### README for architectural hints
- Front-end only project, deployed via Lovable.
- No internal backend; all data comes from an external service (endpoint URL hidden in doctor-service).
- Dev server (npm run dev) provided by Vite.

##### Diagramming the system
a. Main components:
- Browser / User Agent
- React SPA (split into UI layer, routing layer, data layer)
- External Doctor API service
- Build & Deployment (Vite dev server / Lovable hosting)
b. Relationships & interactions:
- User → Browser → React SPA
- SPA → calls doctor-service → External API → returns JSON → SPA
- During development: Vite Dev Server serves assets and enables HMR
- On publish: Lovable CI/CD takes build output → static hosting with optional custom domain
c. Architectural patterns & principles:
- Component-based UI (Atomic + composite components in `src/components`)
- Unidirectional data flow: page → component → hook → service → API
- Separation of concerns:
- UI primitives (`src/components/ui`)
- Feature components (`src/components/DoctorCard.tsx`, etc.)
- Routing (`App.tsx` + `src/pages`)
- Data fetching (`src/lib/doctor-service.ts`)
d. Key technologies & libraries:
- React + React Router (via `App.tsx` for routing)
- Vite (fast dev server + build)
- TypeScript (typesafety)
- Tailwind CSS + shadcn-ui (design system)
- Lovable (CI/CD & hosting)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Layer
    Browser["Browser / User Agent"]:::external

    %% SPA Layer
    subgraph "SPA (React Application)"
        subgraph "Bootstrap & Router"
            Main["main.tsx\n(SPA Bootstrap)"]:::core
            App["App.tsx\n(Router & Shell)"]:::core
        end
        subgraph "Pages (src/pages)" 
            Home["Home.tsx"]:::pages
            Doctors["Doctors.tsx"]:::pages
            DoctorProfile["DoctorProfile.tsx"]:::pages
            IndexPage["Index.tsx"]:::pages
            NotFound["NotFound.tsx"]:::pages
        end
        subgraph "UI Components (src/components)"
            DoctorCard["DoctorCard.tsx"]:::ui
            Navbar["Navbar.tsx"]:::ui
            Hero["Hero.tsx"]:::ui
            Footer["Footer.tsx"]:::ui
        end
        subgraph "UI Primitives (src/components/ui)"
            UIPrims["shadcn-ui Primitives"]:::ui
        end
        subgraph "Hooks & Services"
            DoctorService["doctor-service.ts\n(API Client)"]:::service
            Utils["utils.ts"]:::service
            UseMobile["use-mobile.tsx"]:::service
            UseToast["use-toast.ts"]:::service
        end
    end

    %% External Systems
    ExternalAPI["External Doctor API"]:::external

    %% Dev & Deployment
    ViteDev["Vite Dev Server"]:::infra
    Lovable["Lovable Hosting (CI/CD)"]:::infra

    %% Flows
    Browser --> Main
    Main --> App
    App --> Home
    App --> Doctors
    App --> DoctorProfile
    App --> IndexPage
    App --> NotFound

    Doctors --> DoctorService
    DoctorProfile --> DoctorService
    Home --> DoctorService

    DoctorService --> ExternalAPI
    ExternalAPI --> DoctorService

    DoctorService --> Utils
    Home --> UseMobile
    Doctors --> UseToast

    DoctorCard --> UIPrims
    Navbar --> UIPrims
    Hero --> UIPrims
    Footer --> UIPrims

    ViteDev --> Browser
    Lovable --> Browser

    %% Click Events
    click Main "https://github.com/pujari431/find-my-doc-now/blob/main/src/main.tsx"
    click App "https://github.com/pujari431/find-my-doc-now/blob/main/src/App.tsx"
    click Home "https://github.com/pujari431/find-my-doc-now/blob/main/src/pages/Home.tsx"
    click Doctors "https://github.com/pujari431/find-my-doc-now/blob/main/src/pages/Doctors.tsx"
    click DoctorProfile "https://github.com/pujari431/find-my-doc-now/blob/main/src/pages/DoctorProfile.tsx"
    click IndexPage "https://github.com/pujari431/find-my-doc-now/blob/main/src/pages/Index.tsx"
    click NotFound "https://github.com/pujari431/find-my-doc-now/blob/main/src/pages/NotFound.tsx"
    click DoctorCard "https://github.com/pujari431/find-my-doc-now/blob/main/src/components/DoctorCard.tsx"
    click Navbar "https://github.com/pujari431/find-my-doc-now/blob/main/src/components/Navbar.tsx"
    click Hero "https://github.com/pujari431/find-my-doc-now/blob/main/src/components/Hero.tsx"
    click Footer "https://github.com/pujari431/find-my-doc-now/blob/main/src/components/Footer.tsx"
    click UIPrims "https://github.com/pujari431/find-my-doc-now/tree/main/src/components/ui/"
    click DoctorService "https://github.com/pujari431/find-my-doc-now/blob/main/src/lib/doctor-service.ts"
    click Utils "https://github.com/pujari431/find-my-doc-now/blob/main/src/lib/utils.ts"
    click UseMobile "https://github.com/pujari431/find-my-doc-now/blob/main/src/hooks/use-mobile.tsx"
    click UseToast "https://github.com/pujari431/find-my-doc-now/blob/main/src/hooks/use-toast.ts"
    click ViteDev "https://github.com/pujari431/find-my-doc-now/blob/main/vite.config.ts"
    click ViteDev "https://github.com/pujari431/find-my-doc-now/blob/main/tailwind.config.ts"
    click ViteDev "https://github.com/pujari431/find-my-doc-now/blob/main/postcss.config.js"
    click ViteDev "https://github.com/pujari431/find-my-doc-now/blob/main/tsconfig.json"
    click ViteDev "https://github.com/pujari431/find-my-doc-now/blob/main/tsconfig.app.json"
    click ViteDev "https://github.com/pujari431/find-my-doc-now/blob/main/tsconfig.node.json"
    click ViteDev "https://github.com/pujari431/find-my-doc-now/blob/main/vite-env.d.ts"
    click ViteDev "https://github.com/pujari431/find-my-doc-now/blob/main/eslint.config.js"
    click Lovable "https://github.com/pujari431/find-my-doc-now/blob/main/README.md"

    %% Styles
    classDef ui fill:#aedcff,stroke:#0366d6,color:#000
    classDef pages fill:#c6f6d5,stroke:#2f855a,color:#000
    classDef core fill:#faf089,stroke:#d69e2e,color:#000
    classDef service fill:#fed7aa,stroke:#dd6b20,color:#000
    classDef external fill:#e2e8f0,stroke:#4a5568,color:#000
    classDef infra fill:#e9d8fd,stroke:#805ad5,color:#000
```
