# tharunraj-u/email-validator-extension architecture

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

- Interactive diagram: https://gitdiagram.com/tharunraj-u/email-validator-extension
- Repository: https://github.com/tharunraj-u/email-validator-extension

## Overview

This browser extension extracts contact rows from the active page or pasted input, validates email addresses, and presents merged results for preview and export. Its page extraction supports HTML tables, plain text, and Google Sheets; a separate OCR route scans visible sheet regions and parses the captured text. The graph follows documented and excerpted calls where available; popup-to-background and page-content wiring are not fully visible in the supplied excerpts, so those links are marked unverified.

Main entry points: [`popup/popup.js`](https://github.com/tharunraj-u/email-validator-extension/blob/master/popup/popup.js) (Popup workflow), [`scripts/ocr-scan.js`](https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/ocr-scan.js) (OCR scanning), [`scripts/csv.js`](https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/csv.js) (Email and row processing), [`scripts/validator.js`](https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/validator.js) (Email validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Extension interface"]
  node_popup["Popup workflow<br/>[popup.js]"]
  node_settings["Scan settings<br/>[config.js]"]
end

subgraph group_extraction["Page extraction"]
  node_content["Page scanner<br/>[content.js]"]
  node_html["HTML tables<br/>[html-table.js]"]
  node_text["Plain text<br/>[plain-text.js]"]
  node_sheets["Sheets extractor<br/>[google-sheets.js]"]
  node_bootstrap["Sheets bootstrap"]
  node_ocrscan["OCR scanning<br/>[ocr-scan.js]"]
end

subgraph group_processing["Processing"]
  node_ocrparse["OCR parsing<br/>[ocr-parse.js]"]
  node_csv["Email and row processing<br/>[csv.js]"]
  node_background["Validation dispatch<br/>[background.js]"]
  node_validator["Email validation<br/>[validator.js]"]
end

subgraph group_services["External services"]
  node_ocrservice["OCR.space API"]
  node_validationservice["Validator API"]
  node_storage[("Browser storage")]
end

node_user(("User"))
node_page["Active page"]

node_user -->|"opens"| node_popup
node_page -.->|"provides page data"| node_content
node_popup -.->|"requests scan"| node_content
node_popup -->|"starts OCR scan"| node_ocrscan
node_popup -->|"parses and formats"| node_csv
node_popup -.->|"requests validation"| node_background
node_popup -->|"reads and writes settings"| node_storage
node_content -->|"reads page content"| node_page
node_html -->|"normalizes headers"| node_csv
node_text -->|"extracts emails"| node_csv
node_ocrscan -->|"parses OCR text"| node_ocrparse
node_ocrscan -->|"deduplicates and finds emails"| node_csv
node_ocrscan -->|"reads OCR settings"| node_settings
node_ocrscan -->|"sends image for OCR"| node_ocrservice
node_ocrparse -->|"uses email helpers"| node_csv
node_background -->|"dispatches validation"| node_validator
node_validator -->|"reads API configuration"| node_settings
node_validator -->|"posts email"| node_validationservice

click node_popup "https://github.com/tharunraj-u/email-validator-extension/blob/master/popup/popup.js"
click node_settings "https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/config.js"
click node_content "https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/content.js"
click node_html "https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/extractors/html-table.js"
click node_text "https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/extractors/plain-text.js"
click node_sheets "https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/extractors/google-sheets.js"
click node_bootstrap "https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/sheets-bootstrap.js"
click node_ocrscan "https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/ocr-scan.js"
click node_ocrparse "https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/ocr-parse.js"
click node_csv "https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/csv.js"
click node_background "https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/background.js"
click node_validator "https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/validator.js"

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_popup,node_settings,node_user toneBlue
class node_content,node_html,node_text,node_sheets,node_bootstrap,node_ocrscan toneAmber
class node_ocrparse,node_csv,node_background,node_validator toneMint
class node_ocrservice,node_validationservice,node_storage toneRose
class node_page toneIndigo
```

## Components

### Extension interface

- [Popup workflow](https://github.com/tharunraj-u/email-validator-extension/blob/master/popup/popup.js): `popup/popup.js`
- [Scan settings](https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/config.js): `scripts/config.js`

### Page extraction

- [Page scanner](https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/content.js): `scripts/content.js`
- [HTML tables](https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/extractors/html-table.js): `scripts/extractors/html-table.js`
- [Plain text](https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/extractors/plain-text.js): `scripts/extractors/plain-text.js`
- [Sheets extractor](https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/extractors/google-sheets.js): `scripts/extractors/google-sheets.js`
- [Sheets bootstrap](https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/sheets-bootstrap.js): `scripts/sheets-bootstrap.js`
- [OCR scanning](https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/ocr-scan.js): `scripts/ocr-scan.js`

### Processing

- [OCR parsing](https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/ocr-parse.js): `scripts/ocr-parse.js`
- [Email and row processing](https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/csv.js): `scripts/csv.js`
- [Validation dispatch](https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/background.js): `scripts/background.js`
- [Email validation](https://github.com/tharunraj-u/email-validator-extension/blob/master/scripts/validator.js): `scripts/validator.js`

### External services

- **OCR.space API**
- **Validator API**
- **Browser storage**

### Other components

- **User**
- **Active page**

## Connections

- User → Popup workflow: opens
- Active page → Page scanner: provides page data
- Popup workflow → Page scanner: requests scan
- Popup workflow → OCR scanning: starts OCR scan (evidence: `popup/popup.js`)
- Popup workflow → Email and row processing: parses and formats (evidence: `popup/popup.js`)
- Popup workflow → Validation dispatch: requests validation
- Popup workflow → Browser storage: reads and writes settings (evidence: `popup/popup.js`)
- Page scanner → Active page: reads page content (evidence: `scripts/content.js`)
- HTML tables → Email and row processing: normalizes headers (evidence: `scripts/extractors/html-table.js`)
- Plain text → Email and row processing: extracts emails (evidence: `scripts/extractors/plain-text.js`)
- OCR scanning → OCR parsing: parses OCR text (evidence: `scripts/ocr-scan.js`)
- OCR scanning → Email and row processing: deduplicates and finds emails (evidence: `scripts/ocr-scan.js`)
- OCR scanning → Scan settings: reads OCR settings (evidence: `scripts/ocr-scan.js`)
- OCR scanning → OCR.space API: sends image for OCR (evidence: `scripts/ocr-scan.js`)
- OCR parsing → Email and row processing: uses email helpers (evidence: `scripts/ocr-parse.js`)
- Validation dispatch → Email validation: dispatches validation (evidence: `scripts/background.js`)
- Email validation → Scan settings: reads API configuration (evidence: `scripts/validator.js`)
- Email validation → Validator API: posts email (evidence: `scripts/validator.js`)
