# subhashdoc234xyz/retinalens architecture

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

- Interactive diagram: https://gitdiagram.com/subhashdoc234xyz/retinalens
- Repository: https://github.com/subhashdoc234xyz/retinalens

## Overview

RetinaLens is a clinical web app for diabetic-retinopathy screening: clinicians enter through the landing and authentication views, submit fundus scans, review grading and explainability, and manage screening history and reports. Its React client is served alongside an Express API; the API can delegate inference to a configured edge model or AI providers, while client storage supports Supabase and local fallback behavior. The excerpts show the API integrations and several client-to-storage calls, but not the Dashboard’s full submission request path, so that link is marked unverified.

Main entry points: [`src/App.tsx`](https://github.com/subhashdoc234xyz/retinalens/blob/main/src/App.tsx) (App shell), [`server.ts`](https://github.com/subhashdoc234xyz/retinalens/blob/main/server.ts) (Clinical API), [`src/lib/storage.ts`](https://github.com/subhashdoc234xyz/retinalens/blob/main/src/lib/storage.ts) (Scan storage adapter), [`src/lib/supabase.ts`](https://github.com/subhashdoc234xyz/retinalens/blob/main/src/lib/supabase.ts) (Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Clinical client"]
  node_app["App shell<br/>[App.tsx]"]
  node_landing["Landing view<br/>[LandingHero.tsx]"]
  node_authview["Authentication view<br/>[AuthView.tsx]"]
  node_sidebar["Clinical navigation<br/>[Sidebar.tsx]"]
  node_navbar["Brand navigation<br/>[Navbar.tsx]"]
  node_logo["RetinaLens logo<br/>[RetinaLensLogo.tsx]"]
end

subgraph group_clinical["Screening workflow"]
  node_dashboard["Scan dashboard<br/>[Dashboard.tsx]"]
  node_results["Scan results and XAI<br/>[ResultsView.tsx]"]
  node_history["Screening history<br/>[HistoryView.tsx]"]
  node_report["Clinical report<br/>[ReportModal.tsx]"]
end

subgraph group_backend["Inference service"]
  node_api["Clinical API<br/>[server.ts]"]
end

subgraph group_persistence["Identity and records"]
  node_storage["Scan storage adapter<br/>[storage.ts]"]
  node_supabase_client["Supabase client<br/>[supabase.ts]"]
end

node_clinician(("Clinician"))
node_edge_model{{"Edge inference endpoint"}}
node_groq{{"Groq vision"}}
node_gemini{{"Gemini vision"}}
node_supabase[("Supabase Auth and database")]
node_browser_cache[("Browser cache")]

node_clinician -->|"opens"| node_landing
node_app -->|"renders"| node_landing
node_app -->|"renders"| node_authview
node_app -->|"renders"| node_sidebar
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_results
node_app -->|"renders"| node_history
node_app -->|"renders"| node_report
node_clinician -->|"signs in"| node_authview
node_authview -->|"starts OAuth"| node_supabase_client
node_navbar -->|"renders"| node_logo
node_dashboard -->|"saves scan"| node_storage
node_dashboard -.->|"submits scan"| node_api
node_api -->|"forwards image"| node_edge_model
node_api -->|"requests analysis"| node_groq
node_api -->|"requests analysis"| node_gemini
node_storage -->|"uses client"| node_supabase_client
node_supabase_client -->|"auth and data"| node_supabase
node_supabase_client -->|"fetches auth config"| node_api
node_api -->|"provides config"| node_supabase_client
node_storage -->|"caches scans"| node_browser_cache
node_app -->|"loads scans"| node_storage
node_app -->|"deletes scan"| node_storage
node_history -->|"stores searches"| node_storage

click node_app "https://github.com/subhashdoc234xyz/retinalens/blob/main/src/App.tsx"
click node_landing "https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/LandingHero.tsx"
click node_authview "https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/AuthView.tsx"
click node_sidebar "https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/Sidebar.tsx"
click node_navbar "https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/Navbar.tsx"
click node_logo "https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/RetinaLensLogo.tsx"
click node_dashboard "https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/Dashboard.tsx"
click node_results "https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/ResultsView.tsx"
click node_history "https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/HistoryView.tsx"
click node_report "https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/ReportModal.tsx"
click node_api "https://github.com/subhashdoc234xyz/retinalens/blob/main/server.ts"
click node_storage "https://github.com/subhashdoc234xyz/retinalens/blob/main/src/lib/storage.ts"
click node_supabase_client "https://github.com/subhashdoc234xyz/retinalens/blob/main/src/lib/supabase.ts"

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_authview,node_sidebar,node_navbar,node_logo toneBlue
class node_dashboard,node_results,node_history,node_report,node_supabase,node_browser_cache toneAmber
class node_api toneMint
class node_storage,node_supabase_client toneRose
class node_clinician,node_edge_model,node_groq,node_gemini toneIndigo
```

## Components

### Clinical client

- [App shell](https://github.com/subhashdoc234xyz/retinalens/blob/main/src/App.tsx): `src/App.tsx`
- [Landing view](https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/LandingHero.tsx): `src/components/LandingHero.tsx`
- [Authentication view](https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/AuthView.tsx): `src/components/AuthView.tsx`
- [Clinical navigation](https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/Sidebar.tsx): `src/components/Sidebar.tsx`
- [Brand navigation](https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/Navbar.tsx): `src/components/Navbar.tsx`
- [RetinaLens logo](https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/RetinaLensLogo.tsx): `src/components/RetinaLensLogo.tsx`

### Screening workflow

- [Scan dashboard](https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/Dashboard.tsx): `src/components/Dashboard.tsx`
- [Scan results and XAI](https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/ResultsView.tsx): `src/components/ResultsView.tsx`
- [Screening history](https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/HistoryView.tsx): `src/components/HistoryView.tsx`
- [Clinical report](https://github.com/subhashdoc234xyz/retinalens/blob/main/src/components/ReportModal.tsx): `src/components/ReportModal.tsx`

### Inference service

- [Clinical API](https://github.com/subhashdoc234xyz/retinalens/blob/main/server.ts): `server.ts`

### Identity and records

- [Scan storage adapter](https://github.com/subhashdoc234xyz/retinalens/blob/main/src/lib/storage.ts): `src/lib/storage.ts`
- [Supabase client](https://github.com/subhashdoc234xyz/retinalens/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`

### Other components

- **Clinician**
- **Edge inference endpoint**
- **Groq vision**
- **Gemini vision**
- **Supabase Auth and database**
- **Browser cache**

## Connections

- Clinician → Landing view: opens (evidence: `README.md`)
- App shell → Landing view: renders (evidence: `src/App.tsx`)
- App shell → Authentication view: renders (evidence: `src/App.tsx`)
- App shell → Clinical navigation: renders (evidence: `src/App.tsx`)
- App shell → Scan dashboard: renders (evidence: `src/App.tsx`)
- App shell → Scan results and XAI: renders (evidence: `src/App.tsx`)
- App shell → Screening history: renders (evidence: `src/App.tsx`)
- App shell → Clinical report: renders (evidence: `src/App.tsx`)
- Clinician → Authentication view: signs in (evidence: `src/components/AuthView.tsx`)
- Authentication view → Supabase client: starts OAuth (evidence: `src/components/AuthView.tsx`)
- Brand navigation → RetinaLens logo: renders (evidence: `src/components/Navbar.tsx`)
- Scan dashboard → Scan storage adapter: saves scan (evidence: `src/components/Dashboard.tsx`)
- Scan dashboard → Clinical API: submits scan
- Clinical API → Edge inference endpoint: forwards image (evidence: `server.ts`)
- Clinical API → Groq vision: requests analysis (evidence: `server.ts`)
- Clinical API → Gemini vision: requests analysis (evidence: `server.ts`)
- Scan storage adapter → Supabase client: uses client (evidence: `src/lib/storage.ts`)
- Supabase client → Supabase Auth and database: auth and data (evidence: `src/lib/supabase.ts`)
- Supabase client → Clinical API: fetches auth config (evidence: `src/lib/supabase.ts`)
- Clinical API → Supabase client: provides config (evidence: `server.ts`)
- Scan storage adapter → Browser cache: caches scans (evidence: `src/lib/storage.ts`)
- App shell → Scan storage adapter: loads scans (evidence: `src/App.tsx`)
- App shell → Scan storage adapter: deletes scan (evidence: `src/App.tsx`)
- Screening history → Scan storage adapter: stores searches (evidence: `src/components/HistoryView.tsx`)
