# swastikaroy336-lab/rx-reader-ai-05587 architecture

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

- Interactive diagram: https://gitdiagram.com/swastikaroy336-lab/rx-reader-ai-05587
- Repository: https://github.com/swastikaroy336-lab/rx-reader-ai-05587

## Overview

This is a prescription-management web app. Users can sign in, upload prescriptions for analysis, review extracted prescription and medicine details, and search for medicine information. The dashboard and prescription-detail pages provide the main follow-up workflow. Supabase supplies authentication, storage, and data access; edge functions handle medicine search and prescription analysis. The upload component and analysis function were not excerpted, so their connection is shown as unverified.

Main entry points: [`src/integrations/supabase/client.ts`](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/integrations/supabase/client.ts) (Supabase client), [`src/components/ProtectedRoute.tsx`](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/components/ProtectedRoute.tsx) (Route guard), [`src/App.tsx`](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/App.tsx) (App routes), [`src/pages/Index.tsx`](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/pages/Index.tsx) (Landing page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application routing"]
  node_app["App routes<br/>[App.tsx]"]
  node_landing["Landing page<br/>[Index.tsx]"]
end

subgraph group_identity["Identity and access"]
  node_authmodal["Sign-in modal<br/>[AuthModal.tsx]"]
  node_authstate["Auth state<br/>[useAuth.tsx]"]
  node_guard["Route guard<br/>[ProtectedRoute.tsx]"]
  node_supabase["Supabase client<br/>[client.ts]"]
  node_authmodalcomponent["Landing auth entry<br/>[Header.tsx]"]
end

subgraph group_prescriptions["Prescription workflow"]
  node_upload["Prescription upload<br/>[UploadSection.tsx]"]
  node_analysis["Prescription analysis<br/>[index.ts]"]
  node_dashboard["Prescription dashboard<br/>[Dashboard.tsx]"]
  node_detail["Prescription detail"]
end

subgraph group_medicines["Medicine information"]
  node_search["Medicine search<br/>[SearchMedicine.tsx]"]
  node_searchfn["Medicine lookup<br/>[index.ts]"]
end

node_user(("User"))
node_backend[("Supabase services")]

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_landing
node_app -->|"protects routes"| node_guard
node_guard -->|"renders"| node_dashboard
node_guard -->|"renders"| node_detail
node_landing -->|"renders"| node_authmodalcomponent
node_landing -->|"renders"| node_upload
node_authmodalcomponent -->|"opens"| node_authmodal
node_authmodal -->|"authenticates"| node_supabase
node_authstate -->|"reads auth state"| node_supabase
node_guard -->|"checks session"| node_authstate
node_upload -->|"uses client"| node_supabase
node_upload -.->|"submits for analysis"| node_analysis
node_analysis -.->|"processes prescription"| node_backend
node_dashboard -->|"loads prescriptions"| node_supabase
node_detail -->|"loads prescription data"| node_supabase
node_dashboard -->|"renders"| node_search
node_search -->|"invokes function"| node_supabase
node_search -->|"requests lookup"| node_searchfn

click node_app "https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/App.tsx"
click node_landing "https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/pages/Index.tsx"
click node_authmodal "https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/components/AuthModal.tsx"
click node_authstate "https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/hooks/useAuth.tsx"
click node_guard "https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/components/ProtectedRoute.tsx"
click node_supabase "https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/integrations/supabase/client.ts"
click node_upload "https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/components/UploadSection.tsx"
click node_analysis "https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/supabase/functions/analyze-prescription/index.ts"
click node_dashboard "https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/pages/Dashboard.tsx"
click node_detail "https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/pages/PrescriptionDetail.tsx"
click node_search "https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/components/SearchMedicine.tsx"
click node_searchfn "https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/supabase/functions/search-medicine/index.ts"
click node_authmodalcomponent "https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/components/Header.tsx"

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_app,node_landing,node_user toneBlue
class node_authmodal,node_authstate,node_guard,node_supabase,node_authmodalcomponent,node_backend toneAmber
class node_upload,node_analysis,node_dashboard,node_detail toneMint
class node_search,node_searchfn toneRose
```

## Components

### Application routing

- [App routes](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/App.tsx): `src/App.tsx`
- [Landing page](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/pages/Index.tsx): `src/pages/Index.tsx`

### Identity and access

- [Sign-in modal](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/components/AuthModal.tsx): `src/components/AuthModal.tsx`
- [Auth state](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/hooks/useAuth.tsx): `src/hooks/useAuth.tsx`
- [Route guard](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/components/ProtectedRoute.tsx): `src/components/ProtectedRoute.tsx`
- [Supabase client](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- [Landing auth entry](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/components/Header.tsx): `src/components/Header.tsx`

### Prescription workflow

- [Prescription upload](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/components/UploadSection.tsx): `src/components/UploadSection.tsx`
- [Prescription analysis](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/supabase/functions/analyze-prescription/index.ts): `supabase/functions/analyze-prescription/index.ts`
- [Prescription dashboard](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/pages/Dashboard.tsx): `src/pages/Dashboard.tsx`
- [Prescription detail](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/pages/PrescriptionDetail.tsx): `src/pages/PrescriptionDetail.tsx`

### Medicine information

- [Medicine search](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/src/components/SearchMedicine.tsx): `src/components/SearchMedicine.tsx`
- [Medicine lookup](https://github.com/swastikaroy336-lab/rx-reader-ai-05587/blob/main/supabase/functions/search-medicine/index.ts): `supabase/functions/search-medicine/index.ts`

### Other components

- **User**
- **Supabase services**

## Connections

- User → App routes: opens
- App routes → Landing page: routes to (evidence: `src/App.tsx`)
- App routes → Route guard: protects routes (evidence: `src/App.tsx`)
- Route guard → Prescription dashboard: renders (evidence: `src/App.tsx`)
- Route guard → Prescription detail: renders (evidence: `src/App.tsx`)
- Landing page → Landing auth entry: renders (evidence: `src/pages/Index.tsx`)
- Landing page → Prescription upload: renders (evidence: `src/pages/Index.tsx`)
- Landing auth entry → Sign-in modal: opens (evidence: `src/components/Header.tsx`)
- Sign-in modal → Supabase client: authenticates (evidence: `src/components/AuthModal.tsx`)
- Auth state → Supabase client: reads auth state (evidence: `src/hooks/useAuth.tsx`)
- Route guard → Auth state: checks session (evidence: `src/components/ProtectedRoute.tsx`)
- Prescription upload → Supabase client: uses client (evidence: `src/components/UploadSection.tsx`)
- Prescription upload → Prescription analysis: submits for analysis
- Prescription analysis → Supabase services: processes prescription
- Prescription dashboard → Supabase client: loads prescriptions (evidence: `src/pages/Dashboard.tsx`)
- Prescription detail → Supabase client: loads prescription data (evidence: `src/pages/PrescriptionDetail.tsx`)
- Prescription dashboard → Medicine search: renders (evidence: `src/pages/Dashboard.tsx`)
- Medicine search → Supabase client: invokes function (evidence: `src/components/SearchMedicine.tsx`)
- Medicine search → Medicine lookup: requests lookup (evidence: `src/components/SearchMedicine.tsx`)
