# meenushri/vision-enhance-ai architecture

> Architecture diagram of the GitHub repository meenushri/vision-enhance-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/meenushri/vision-enhance-ai
- Repository: https://github.com/meenushri/vision-enhance-ai

## Overview

#### Purpose and Runtime
VisionEnhance AI is a Vite-served React/TypeScript SaaS for authenticated low-light image enhancement, quality analysis, user history, and administrative reporting. The browser performs the default enhancement pipeline; Supabase provides authentication and PostgreSQL-backed persistence with RLS. Vercel is the intended frontend host, with an optional external AI inference service.
Paths: `src/main.tsx`, `src/lib/supabase.ts`, `vercel.json`

#### Application Entry and Routing
`main.tsx` bootstraps React providers and routing. `App.tsx` defines public landing/auth/not-found routes and the dashboard route family. Dashboard pages represent the main functional surfaces: overview, upload/processing, historical records, analytics, settings, and admin.
Paths: `src/main.tsx`, `src/App.tsx`, `src/pages/dashboard/`

#### Authentication and Access Boundary
`AuthContext` centralizes Supabase session state and auth operations for registration, sign-in, password recovery, and protected user experiences. Auth pages use a shared authentication shell, while Supabase’s database policies are the server-side boundary for user data access. A migration creates the schema, RLS policies, and profile-creation trigger.
Paths: `src/context/AuthContext.tsx`, `src/components/shared/AuthLayout.tsx`, `supabase/migrations/20260731112345_create_visionenhance_schema.sql`

#### Dashboard Shell and Product Modules
`DashboardLayout` supplies the persistent application frame—navigation/sidebar and top-level dashboard context—around feature pages. `DashboardPage` summarizes account and image metrics; specialized pages expose upload, processing feedback, data history, analytics, settings, and cross-user admin views. Shared headers, stat cards, empty states, and theme control keep these modules consistent.
Paths: `src/components/layout/DashboardLayout.tsx`, `src/pages/dashboard/DashboardPage.tsx`, `src/pages/dashboard/UploadPage.tsx`

#### Image Enhancement Flow
The primary flow is file selection/upload → client-side enhancement → quality metric generation → processing/status UI → result comparison and persistence/history actions. `enhanceImage` is the abstraction boundary: it currently uses a browser canvas pipeline for gamma, contrast, denoising, and sharpening, returning an enhanced data URL/blob, metrics, and elapsed time. It can be replaced with a backend model call without changing consumers.
Paths: `src/lib/enhance.ts`, `src/pages/dashboard/UploadPage.tsx`, `src/pages/dashboard/ProcessingPage.tsx`

#### Data, Reporting, and User State
The Supabase schema models profiles, uploads, enhancement history, reports, downloads, and notifications. `use-user-data` is the frontend data-access aggregation point for user-oriented records and dashboard state. History and analytics consume persisted enhancement data for searchable records, comparisons, trends, and usage metrics; admin consumes cross-user aggregates.
Paths: `src/hooks/use-user-data.ts`, `src/pages/dashboard/HistoryPage.tsx`, `src/pages/dashboard/AnalyticsPage.tsx`

#### UI and External Dependencies
Tailwind and shadcn-style primitives form the UI foundation; shared components add responsive layouts, animation, notifications, and theme behavior. Material client libraries include React Router, React Hook Form, Recharts, and Framer Motion. Required external service configuration is the Supabase URL and anonymous key; an optional Flask/FastAPI, Render, or Supabase Edge endpoint may host a real enhancement model.
Paths: `src/components/ui/`, `src/hooks/use-theme.ts`, `tailwind.config.js`

Main entry points: [`src/components/layout/DashboardLayout.tsx`](https://github.com/meenushri/vision-enhance-ai/blob/main/src/components/layout/DashboardLayout.tsx) (Dashboard shell), [`src/hooks/use-user-data.ts`](https://github.com/meenushri/vision-enhance-ai/blob/main/src/hooks/use-user-data.ts) (User data hook), [`src/pages/dashboard/UploadPage.tsx`](https://github.com/meenushri/vision-enhance-ai/blob/main/src/pages/dashboard/UploadPage.tsx) (Upload and processing), [`src/lib/supabase.ts`](https://github.com/meenushri/vision-enhance-ai/blob/main/src/lib/supabase.ts) (Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React frontend"]
  node_entry["React entry<br/>bootstrap<br/>[main.tsx]"]
  node_router["App routes<br/>routing<br/>[App.tsx]"]
  node_auth_context["Auth context<br/>session state<br/>[AuthContext.tsx]"]
  node_auth_shell["Auth shell<br/>shared UI<br/>[AuthLayout.tsx]"]
  node_dashboard_shell["Dashboard shell<br/>application frame"]
  node_enhancement{{"Client enhancement<br/>image pipeline<br/>[enhance.ts]"}}
  node_user_data["User data hook<br/>data access<br/>[use-user-data.ts]"]
  node_ui_foundation["UI foundation<br/>design system"]
end

subgraph group_product["Dashboard modules"]
  node_dashboard_overview["Dashboard overview<br/>product page<br/>[DashboardPage.tsx]"]
  node_upload["Upload and processing<br/>product flow<br/>[UploadPage.tsx]"]
  node_processing["Processing feedback<br/>product page<br/>[ProcessingPage.tsx]"]
  node_history["History<br/>product page<br/>[HistoryPage.tsx]"]
  node_analytics["Analytics<br/>product page<br/>[AnalyticsPage.tsx]"]
  node_dashboard_family["Settings and admin<br/>dashboard pages"]
end

subgraph group_supabase["Supabase backend"]
  node_supabase_client["Supabase client<br/>backend client<br/>[supabase.ts]"]
  node_auth(("Supabase Auth<br/>identity service"))
  node_database[("PostgreSQL + RLS<br/>persistent data")]
end

node_deployment["Vercel hosting<br/>frontend host<br/>[vercel.json]"]
node_ai_endpoint{{"Optional AI inference<br/>external model service"}}

node_entry -->|"boots"| node_router
node_entry -->|"provides"| node_auth_context
node_router -->|"renders auth routes"| node_auth_shell
node_router -->|"protects dashboard routes"| node_dashboard_shell
node_auth_context -->|"auth calls"| node_supabase_client
node_supabase_client -->|"session API"| node_auth
node_supabase_client -->|"data API"| node_database
node_auth -->|"identity enforces RLS"| node_database
node_dashboard_shell -->|"frames"| node_dashboard_overview
node_dashboard_shell -->|"frames"| node_upload
node_dashboard_shell -->|"frames"| node_history
node_dashboard_shell -->|"frames"| node_analytics
node_dashboard_shell -->|"frames"| node_dashboard_family
node_upload -->|"enhances image"| node_enhancement
node_upload -->|"shows status"| node_processing
node_enhancement -.->|"replaceable with"| node_ai_endpoint
node_upload -->|"persists result"| node_user_data
node_user_data -->|"queries and writes"| node_supabase_client
node_user_data -->|"supplies metrics"| node_dashboard_overview
node_user_data -->|"supplies records"| node_history
node_user_data -->|"supplies trends"| node_analytics
node_user_data -->|"supplies user and admin data"| node_dashboard_family
node_ui_foundation -->|"composes"| node_auth_shell
node_ui_foundation -->|"composes"| node_dashboard_shell
node_deployment -->|"serves"| node_entry

click node_entry "https://github.com/meenushri/vision-enhance-ai/blob/main/src/main.tsx"
click node_router "https://github.com/meenushri/vision-enhance-ai/blob/main/src/App.tsx"
click node_auth_context "https://github.com/meenushri/vision-enhance-ai/blob/main/src/context/AuthContext.tsx"
click node_auth_shell "https://github.com/meenushri/vision-enhance-ai/blob/main/src/components/shared/AuthLayout.tsx"
click node_dashboard_shell "https://github.com/meenushri/vision-enhance-ai/blob/main/src/components/layout/DashboardLayout.tsx"
click node_dashboard_overview "https://github.com/meenushri/vision-enhance-ai/blob/main/src/pages/dashboard/DashboardPage.tsx"
click node_upload "https://github.com/meenushri/vision-enhance-ai/blob/main/src/pages/dashboard/UploadPage.tsx"
click node_processing "https://github.com/meenushri/vision-enhance-ai/blob/main/src/pages/dashboard/ProcessingPage.tsx"
click node_enhancement "https://github.com/meenushri/vision-enhance-ai/blob/main/src/lib/enhance.ts"
click node_user_data "https://github.com/meenushri/vision-enhance-ai/blob/main/src/hooks/use-user-data.ts"
click node_history "https://github.com/meenushri/vision-enhance-ai/blob/main/src/pages/dashboard/HistoryPage.tsx"
click node_analytics "https://github.com/meenushri/vision-enhance-ai/blob/main/src/pages/dashboard/AnalyticsPage.tsx"
click node_supabase_client "https://github.com/meenushri/vision-enhance-ai/blob/main/src/lib/supabase.ts"
click node_database "https://github.com/meenushri/vision-enhance-ai/blob/main/supabase/migrations/20260731112345_create_visionenhance_schema.sql"
click node_deployment "https://github.com/meenushri/vision-enhance-ai/blob/main/vercel.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_entry,node_router,node_auth_context,node_auth_shell,node_dashboard_shell,node_enhancement,node_user_data,node_ui_foundation toneBlue
class node_dashboard_overview,node_upload,node_processing,node_history,node_analytics,node_dashboard_family toneAmber
class node_supabase_client,node_auth,node_database toneMint
class node_deployment,node_ai_endpoint toneNeutral
```

## Components

### React frontend

Vite-served browser application.

- [React entry](https://github.com/meenushri/vision-enhance-ai/blob/main/src/main.tsx): bootstrap · Mounts providers and routing. · `src/main.tsx`
- [App routes](https://github.com/meenushri/vision-enhance-ai/blob/main/src/App.tsx): routing · Defines public, auth, and dashboard route families. · `src/App.tsx`
- [Auth context](https://github.com/meenushri/vision-enhance-ai/blob/main/src/context/AuthContext.tsx): session state · Centralizes session and auth operations. · `src/context/AuthContext.tsx`
- [Auth shell](https://github.com/meenushri/vision-enhance-ai/blob/main/src/components/shared/AuthLayout.tsx): shared UI · `src/components/shared/AuthLayout.tsx`
- [Dashboard shell](https://github.com/meenushri/vision-enhance-ai/blob/main/src/components/layout/DashboardLayout.tsx): application frame · Persistent navigation and dashboard context. · `src/components/layout/DashboardLayout.tsx`
- [Client enhancement](https://github.com/meenushri/vision-enhance-ai/blob/main/src/lib/enhance.ts): image pipeline · Canvas gamma, contrast, denoising, and sharpening behind a replaceable boundary. · `src/lib/enhance.ts`
- [User data hook](https://github.com/meenushri/vision-enhance-ai/blob/main/src/hooks/use-user-data.ts): data access · Aggregates user records and dashboard state. · `src/hooks/use-user-data.ts`
- **UI foundation**: design system · Tailwind and shadcn-style primitives support responsive shared UI.

### Dashboard modules

Authenticated product surfaces.

- [Dashboard overview](https://github.com/meenushri/vision-enhance-ai/blob/main/src/pages/dashboard/DashboardPage.tsx): product page · Summarizes account and image metrics. · `src/pages/dashboard/DashboardPage.tsx`
- [Upload and processing](https://github.com/meenushri/vision-enhance-ai/blob/main/src/pages/dashboard/UploadPage.tsx): product flow · Selects images, shows progress, compares results, and saves actions. · `src/pages/dashboard/UploadPage.tsx`
- [Processing feedback](https://github.com/meenushri/vision-enhance-ai/blob/main/src/pages/dashboard/ProcessingPage.tsx): product page · `src/pages/dashboard/ProcessingPage.tsx`
- [History](https://github.com/meenushri/vision-enhance-ai/blob/main/src/pages/dashboard/HistoryPage.tsx): product page · Searchable persisted enhancement records and comparisons. · `src/pages/dashboard/HistoryPage.tsx`
- [Analytics](https://github.com/meenushri/vision-enhance-ai/blob/main/src/pages/dashboard/AnalyticsPage.tsx): product page · Trends and usage metrics from persisted data. · `src/pages/dashboard/AnalyticsPage.tsx`
- **Settings and admin**: dashboard pages · Includes settings, notifications, and cross-user administration.

### Supabase backend

Authentication and RLS-protected persistence.

- [Supabase client](https://github.com/meenushri/vision-enhance-ai/blob/main/src/lib/supabase.ts): backend client · Uses the configured project URL and anonymous key. · `src/lib/supabase.ts`
- **Supabase Auth**: identity service
- [PostgreSQL + RLS](https://github.com/meenushri/vision-enhance-ai/blob/main/supabase/migrations/20260731112345_create_visionenhance_schema.sql): persistent data · Stores profiles, uploads, enhancement history, reports, downloads, and notifications. · `supabase/migrations/20260731112345_create_visionenhance_schema.sql`

### Other components

- [Vercel hosting](https://github.com/meenushri/vision-enhance-ai/blob/main/vercel.json): frontend host · `vercel.json`
- **Optional AI inference**: external model service · Can replace the browser enhancement implementation.

## Connections

- React entry → App routes: boots
- React entry → Auth context: provides
- App routes → Auth shell: renders auth routes
- App routes → Dashboard shell: protects dashboard routes
- Auth context → Supabase client: auth calls
- Supabase client → Supabase Auth: session API
- Supabase client → PostgreSQL + RLS: data API
- Supabase Auth → PostgreSQL + RLS: identity enforces RLS
- Dashboard shell → Dashboard overview: frames
- Dashboard shell → Upload and processing: frames
- Dashboard shell → History: frames
- Dashboard shell → Analytics: frames
- Dashboard shell → Settings and admin: frames
- Upload and processing → Client enhancement: enhances image
- Upload and processing → Processing feedback: shows status
- Client enhancement → Optional AI inference: replaceable with
- Upload and processing → User data hook: persists result
- User data hook → Supabase client: queries and writes
- User data hook → Dashboard overview: supplies metrics
- User data hook → History: supplies records
- User data hook → Analytics: supplies trends
- User data hook → Settings and admin: supplies user and admin data
- UI foundation → Auth shell: composes
- UI foundation → Dashboard shell: composes
- Vercel hosting → React entry: serves
