# rithishkumar7/food_product_authenticator architecture

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

- Interactive diagram: https://gitdiagram.com/rithishkumar7/food_product_authenticator
- Repository: https://github.com/rithishkumar7/food_product_authenticator

## Overview

This repository is a React application for checking food-product authenticity against FSSAI-related records, not the Supabase CLI described in the supplied README. The main flow is image scanning or manual entry, followed by OCR when applicable, verification, and display of results; users can also browse products and submit reports, while administrators manage records and review reports. Edges reflect sampled calls, routing, or source-index references. Several page and feature implementations were not sampled, so their internal links are omitted.

Main entry points: [`src/pages/VerifyPage.tsx`](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/pages/VerifyPage.tsx) (Verification page), [`src/App.tsx`](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/App.tsx) (App routing), [`src/pages/AdminPage.tsx`](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/pages/AdminPage.tsx) (Admin console), [`src/integrations/supabase/client.ts`](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/integrations/supabase/client.ts) (Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_app["App routing<br/>[App.tsx]"]
  node_home["Home page<br/>[Index.tsx]"]
end

subgraph group_verification["Product verification"]
  node_verify_page["Verification page<br/>[VerifyPage.tsx]"]
  node_image_upload["Image upload<br/>[ImageUpload.tsx]"]
  node_manual_entry["Manual entry"]
  node_ocr["OCR extraction<br/>[ocr.ts]"]
  node_verification_logic["Verification checks<br/>[verification.ts]"]
  node_results["Verification results"]
end

subgraph group_catalog["Catalog and reports"]
  node_products_page["Product catalog<br/>[ProductsPage.tsx]"]
  node_report_page["Report submission<br/>[ReportPage.tsx]"]
  node_report_dialog["Report dialog<br/>[ReportDialog.tsx]"]
end

subgraph group_admin["Administration and data"]
  node_admin_page["Admin console<br/>[AdminPage.tsx]"]
  node_admin_auth["Admin authentication"]
  node_product_hooks["Product data hooks<br/>[useProducts.ts]"]
  node_edit_dialog["Product editor"]
  node_product_types["Product domain types<br/>[product.ts]"]
  node_supabase_client["Supabase client<br/>[client.ts]"]
end

node_user(("User"))
node_supabase[("Supabase backend")]

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_verify_page
node_app -->|"routes to"| node_products_page
node_app -->|"routes to"| node_report_page
node_app -->|"routes to"| node_admin_page
node_verify_page -->|"renders"| node_image_upload
node_verify_page -->|"renders"| node_manual_entry
node_verify_page -->|"calls"| node_ocr
node_verify_page -->|"calls"| node_verification_logic
node_verify_page -->|"renders"| node_results
node_verify_page -->|"renders"| node_report_dialog
node_ocr -->|"uses types"| node_product_types
node_verification_logic -->|"uses types"| node_product_types
node_verification_logic -->|"queries"| node_supabase_client
node_report_page -->|"uses"| node_product_hooks
node_admin_page -->|"uses"| node_admin_auth
node_admin_page -->|"uses"| node_product_hooks
node_admin_page -->|"renders"| node_edit_dialog
node_admin_page -->|"uses types"| node_product_types
node_admin_auth -->|"authenticates via"| node_supabase_client
node_product_hooks -->|"reads and writes"| node_supabase_client
node_supabase_client -->|"connects to"| node_supabase

click node_app "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/App.tsx"
click node_home "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/pages/Index.tsx"
click node_verify_page "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/pages/VerifyPage.tsx"
click node_image_upload "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/components/ImageUpload.tsx"
click node_manual_entry "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/components/ManualEntryForm.tsx"
click node_ocr "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/lib/ocr.ts"
click node_verification_logic "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/lib/verification.ts"
click node_results "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/components/VerificationResults.tsx"
click node_products_page "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/pages/ProductsPage.tsx"
click node_report_page "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/pages/ReportPage.tsx"
click node_report_dialog "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/components/ReportDialog.tsx"
click node_admin_page "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/pages/AdminPage.tsx"
click node_admin_auth "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/contexts/AdminAuthContext.tsx"
click node_product_hooks "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/hooks/useProducts.ts"
click node_edit_dialog "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/components/EditProductDialog.tsx"
click node_product_types "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/types/product.ts"
click node_supabase_client "https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/integrations/supabase/client.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_home,node_user toneBlue
class node_verify_page,node_image_upload,node_manual_entry,node_ocr,node_verification_logic,node_results,node_supabase toneAmber
class node_products_page,node_report_page,node_report_dialog toneMint
class node_admin_page,node_admin_auth,node_product_hooks,node_edit_dialog,node_product_types,node_supabase_client toneRose
```

## Components

### Application shell

- [App routing](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/App.tsx): `src/App.tsx`
- [Home page](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/pages/Index.tsx): `src/pages/Index.tsx`

### Product verification

- [Verification page](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/pages/VerifyPage.tsx): `src/pages/VerifyPage.tsx`
- [Image upload](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/components/ImageUpload.tsx): `src/components/ImageUpload.tsx`
- [Manual entry](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/components/ManualEntryForm.tsx): `src/components/ManualEntryForm.tsx`
- [OCR extraction](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/lib/ocr.ts): `src/lib/ocr.ts`
- [Verification checks](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/lib/verification.ts): `src/lib/verification.ts`
- [Verification results](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/components/VerificationResults.tsx): `src/components/VerificationResults.tsx`

### Catalog and reports

- [Product catalog](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/pages/ProductsPage.tsx): `src/pages/ProductsPage.tsx`
- [Report submission](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/pages/ReportPage.tsx): `src/pages/ReportPage.tsx`
- [Report dialog](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/components/ReportDialog.tsx): `src/components/ReportDialog.tsx`

### Administration and data

- [Admin console](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/pages/AdminPage.tsx): `src/pages/AdminPage.tsx`
- [Admin authentication](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/contexts/AdminAuthContext.tsx): `src/contexts/AdminAuthContext.tsx`
- [Product data hooks](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/hooks/useProducts.ts): `src/hooks/useProducts.ts`
- [Product editor](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/components/EditProductDialog.tsx): `src/components/EditProductDialog.tsx`
- [Product domain types](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/types/product.ts): `src/types/product.ts`
- [Supabase client](https://github.com/rithishkumar7/food_product_authenticator/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`

### Other components

- **User**
- **Supabase backend**

## Connections

- User → App routing: opens (evidence: `src/App.tsx`)
- App routing → Home page: routes to (evidence: `src/App.tsx`)
- App routing → Verification page: routes to (evidence: `src/App.tsx`)
- App routing → Product catalog: routes to (evidence: `src/App.tsx`)
- App routing → Report submission: routes to (evidence: `src/App.tsx`)
- App routing → Admin console: routes to (evidence: `src/App.tsx`)
- Verification page → Image upload: renders (evidence: `src/pages/VerifyPage.tsx`)
- Verification page → Manual entry: renders (evidence: `src/pages/VerifyPage.tsx`)
- Verification page → OCR extraction: calls (evidence: `src/pages/VerifyPage.tsx`)
- Verification page → Verification checks: calls (evidence: `src/pages/VerifyPage.tsx`)
- Verification page → Verification results: renders (evidence: `src/pages/VerifyPage.tsx`)
- Verification page → Report dialog: renders (evidence: `src/pages/VerifyPage.tsx`)
- OCR extraction → Product domain types: uses types (evidence: `src/lib/ocr.ts`)
- Verification checks → Product domain types: uses types (evidence: `src/lib/verification.ts`)
- Verification checks → Supabase client: queries (evidence: `src/lib/verification.ts`)
- Report submission → Product data hooks: uses (evidence: `src/pages/ReportPage.tsx`)
- Admin console → Admin authentication: uses (evidence: `src/pages/AdminPage.tsx`)
- Admin console → Product data hooks: uses (evidence: `src/pages/AdminPage.tsx`)
- Admin console → Product editor: renders (evidence: `src/pages/AdminPage.tsx`)
- Admin console → Product domain types: uses types (evidence: `src/pages/AdminPage.tsx`)
- Admin authentication → Supabase client: authenticates via (evidence: `src/contexts/AdminAuthContext.tsx`)
- Product data hooks → Supabase client: reads and writes (evidence: `src/hooks/useProducts.ts`)
- Supabase client → Supabase backend: connects to (evidence: `src/integrations/supabase/client.ts`)
