# shyam20040/certificateextractor architecture

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

- Interactive diagram: https://gitdiagram.com/shyam20040/certificateextractor
- Repository: https://github.com/shyam20040/certificateextractor

## Overview

Certify is a browser-based certificate information extractor and shared library. Users select an image or PDF, run local OCR (PDFs render their first page first), send recognized text to the Express API for Gemini structuring, review/edit the fields, and save the original file and metadata to Supabase. The library supports search, record and file management, and Excel/PDF exports. Excerpts show the primary UI/API/storage/export calls; some library and PDF implementation details are documented only in the README.

Main entry points: [`frontend/src/App.jsx`](https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/App.jsx) (Workflow interface), [`frontend/src/lib/supabase.js`](https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/lib/supabase.js) (Supabase client), [`backend/index.js`](https://github.com/shyam20040/certificateextractor/blob/main/backend/index.js) (Extraction API), [`frontend/src/lib/certificates.js`](https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/lib/certificates.js) (Certificate operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and extraction"]
  node_pdf["PDF page rendering<br/>[App.jsx]"]
  node_ocr["Browser OCR<br/>[App.jsx]"]
  node_api["Extraction API<br/>[index.js]"]
end

subgraph group_library["Certificate library"]
  node_certops["Certificate operations<br/>[certificates.js]"]
  node_supaclient["Supabase client<br/>[supabase.js]"]
  node_exports["Excel workbook export<br/>[exports.js]"]
  node_pdfexport["PDF export<br/>[App.jsx]"]
end

subgraph group_services["External services"]
  node_gemini{{"Gemini extraction"}}
  node_records[("Certificate records")]
  node_files[("Documents bucket")]
end

subgraph group_presentation["Application interface"]
  node_app["Workflow interface<br/>[App.jsx]"]
  node_editor["Certificate editor"]
end

node_user(("Library user"))

node_user -->|"selects and manages"| node_app
node_app -->|"renders first page"| node_pdf
node_app -->|"recognizes text"| node_ocr
node_app -->|"posts OCR text"| node_api
node_api -->|"requests extraction"| node_gemini
node_gemini -->|"returns structured fields"| node_api
node_app -->|"renders and updates"| node_editor
node_app -->|"saves and manages"| node_certops
node_certops -->|"requires client"| node_supaclient
node_supaclient -.->|"reads and writes"| node_records
node_supaclient -.->|"uploads and signs URLs"| node_files
node_app -->|"builds workbook"| node_exports
node_app -.->|"exports records"| node_pdfexport
node_app -.->|"loads and resolves files"| node_certops
node_app -.->|"shows library and downloads"| node_user

click node_app "https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/App.jsx"
click node_editor "https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/components/CertificateEditor.jsx"
click node_pdf "https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/App.jsx"
click node_ocr "https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/App.jsx"
click node_api "https://github.com/shyam20040/certificateextractor/blob/main/backend/index.js"
click node_certops "https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/lib/certificates.js"
click node_supaclient "https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/lib/supabase.js"
click node_exports "https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/lib/exports.js"
click node_pdfexport "https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/App.jsx"

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_pdf,node_ocr,node_api,node_user toneBlue
class node_certops,node_supaclient,node_exports,node_pdfexport toneAmber
class node_gemini,node_records,node_files toneMint
class node_app,node_editor toneRose
```

## Components

### Capture and extraction

- [PDF page rendering](https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Browser OCR](https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Extraction API](https://github.com/shyam20040/certificateextractor/blob/main/backend/index.js): `backend/index.js`

### Certificate library

- [Certificate operations](https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/lib/certificates.js): `frontend/src/lib/certificates.js`
- [Supabase client](https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/lib/supabase.js): `frontend/src/lib/supabase.js`
- [Excel workbook export](https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/lib/exports.js): `frontend/src/lib/exports.js`
- [PDF export](https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`

### External services

- **Gemini extraction**
- **Certificate records**
- **Documents bucket**

### Application interface

- [Workflow interface](https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Certificate editor](https://github.com/shyam20040/certificateextractor/blob/main/frontend/src/components/CertificateEditor.jsx): `frontend/src/components/CertificateEditor.jsx`

### Other components

- **Library user**

## Connections

- Library user → Workflow interface: selects and manages (evidence: `README.md`)
- Workflow interface → PDF page rendering: renders first page (evidence: `README.md`)
- Workflow interface → Browser OCR: recognizes text (evidence: `README.md`)
- Workflow interface → Extraction API: posts OCR text (evidence: `frontend/src/App.jsx`)
- Extraction API → Gemini extraction: requests extraction (evidence: `backend/index.js`)
- Gemini extraction → Extraction API: returns structured fields (evidence: `backend/index.js`)
- Workflow interface → Certificate editor: renders and updates (evidence: `frontend/src/App.jsx`)
- Workflow interface → Certificate operations: saves and manages (evidence: `frontend/src/App.jsx`)
- Certificate operations → Supabase client: requires client (evidence: `frontend/src/lib/certificates.js`)
- Supabase client → Certificate records: reads and writes (evidence: `README.md`)
- Supabase client → Documents bucket: uploads and signs URLs (evidence: `README.md`)
- Workflow interface → Excel workbook export: builds workbook (evidence: `frontend/src/App.jsx`)
- Workflow interface → PDF export: exports records (evidence: `README.md`)
- Workflow interface → Certificate operations: loads and resolves files (evidence: `README.md`)
- Workflow interface → Library user: shows library and downloads (evidence: `README.md`)
