How meenushri/vision-enhance-ai works
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: DashboardLayout.tsx Dashboard shell · use-user-data.ts User data hook · UploadPage.tsx Upload and processing · supabase.ts Supabase client
Components 19
React frontend
Vite-served browser application.
- React entry · Mounts providers and routing.
src/main.tsx - App routes · Defines public, auth, and dashboard route families.
src/App.tsx - Auth context · Centralizes session and auth operations.
src/context/AuthContext.tsx - Auth shell
src/components/shared/AuthLayout.tsx - Dashboard shell · Persistent navigation and dashboard context.
src/components/layout/DashboardLayout.tsx - Client enhancement · Canvas gamma, contrast, denoising, and sharpening behind a replaceable boundary.
src/lib/enhance.ts - User data hook · Aggregates user records and dashboard state.
src/hooks/use-user-data.ts - UI foundation · Tailwind and shadcn-style primitives support responsive shared UI.
Dashboard modules
Authenticated product surfaces.
- Dashboard overview · Summarizes account and image metrics.
src/pages/dashboard/DashboardPage.tsx - Upload and processing · Selects images, shows progress, compares results, and saves actions.
src/pages/dashboard/UploadPage.tsx - Processing feedback
src/pages/dashboard/ProcessingPage.tsx - History · Searchable persisted enhancement records and comparisons.
src/pages/dashboard/HistoryPage.tsx - Analytics · Trends and usage metrics from persisted data.
src/pages/dashboard/AnalyticsPage.tsx - Settings and admin · Includes settings, notifications, and cross-user administration.
Supabase backend
Authentication and RLS-protected persistence.
- Supabase client · Uses the configured project URL and anonymous key.
src/lib/supabase.ts - Supabase Auth
- PostgreSQL + RLS · Stores profiles, uploads, enhancement history, reports, downloads, and notifications.
supabase/migrations/20260731112345_create_visionenhance_schema.sql
Other components
- Vercel hosting
vercel.json - Optional AI inference · Can replace the browser enhancement implementation.
Connections 25
- 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