# razercode-dev/docucount architecture

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

- Interactive diagram: https://gitdiagram.com/razercode-dev/docucount
- Repository: https://github.com/razercode-dev/docucount

## Overview

DocuCount is a browser-based PDF/DOCX analyzer. The user selects or drops a document; the app validates it, extracts text and page information, computes text statistics, and presents the results. The main logic is concentrated in one JavaScript file, so several domain responsibilities share that path. The README documents the major capabilities; the sampled source confirms portions of upload handling, analysis, and extraction, but omitted sections limit certainty about some wiring.

Main entry points: [`js/script.js`](https://github.com/razercode-dev/docucount/blob/main/js/script.js) (Upload handling), [`index.html`](https://github.com/razercode-dev/docucount/blob/main/index.html) (Analyzer interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_app["Analyzer interface<br/>[index.html]"]
  node_results["Analysis results<br/>[index.html]"]
end

subgraph group_processing["Document processing"]
  node_upload["Upload handling<br/>[script.js]"]
  node_validation["File validation<br/>[script.js]"]
  node_pdf["PDF extraction<br/>[script.js]"]
  node_docx["DOCX extraction<br/>[script.js]"]
  node_pdfjs["PDF.js"]
  node_mammoth["Mammoth.js"]
  node_jszip["JSZip"]
end

subgraph group_analysis["Text analysis"]
  node_statistics["Text statistics<br/>[script.js]"]
  node_pagecount["Page counting<br/>[script.js]"]
end

node_user(("Document user"))

node_user -->|"opens and submits"| node_app
node_app -->|"provides controls"| node_upload
node_upload -->|"checks file"| node_validation
node_validation -->|"dispatches PDF"| node_pdf
node_validation -->|"dispatches DOCX"| node_docx
node_pdf -->|"extracts text"| node_pdfjs
node_docx -->|"extracts text"| node_mammoth
node_docx -->|"reads page breaks"| node_jszip
node_upload -->|"analyzes extracted text"| node_statistics
node_upload -->|"sets page count"| node_pagecount
node_statistics -->|"updates counts"| node_results
node_pagecount -->|"updates pages"| node_results

click node_app "https://github.com/razercode-dev/docucount/blob/main/index.html"
click node_upload "https://github.com/razercode-dev/docucount/blob/main/js/script.js"
click node_validation "https://github.com/razercode-dev/docucount/blob/main/js/script.js"
click node_pdf "https://github.com/razercode-dev/docucount/blob/main/js/script.js"
click node_docx "https://github.com/razercode-dev/docucount/blob/main/js/script.js"
click node_statistics "https://github.com/razercode-dev/docucount/blob/main/js/script.js"
click node_pagecount "https://github.com/razercode-dev/docucount/blob/main/js/script.js"
click node_results "https://github.com/razercode-dev/docucount/blob/main/index.html"

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_results,node_user toneBlue
class node_upload,node_validation,node_pdf,node_docx,node_pdfjs,node_mammoth,node_jszip toneAmber
class node_statistics,node_pagecount toneMint
```

## Components

### User interface

- [Analyzer interface](https://github.com/razercode-dev/docucount/blob/main/index.html): `index.html`
- [Analysis results](https://github.com/razercode-dev/docucount/blob/main/index.html): `index.html`

### Document processing

- [Upload handling](https://github.com/razercode-dev/docucount/blob/main/js/script.js): `js/script.js`
- [File validation](https://github.com/razercode-dev/docucount/blob/main/js/script.js): `js/script.js`
- [PDF extraction](https://github.com/razercode-dev/docucount/blob/main/js/script.js): `js/script.js`
- [DOCX extraction](https://github.com/razercode-dev/docucount/blob/main/js/script.js): `js/script.js`
- **PDF.js**
- **Mammoth.js**
- **JSZip**

### Text analysis

- [Text statistics](https://github.com/razercode-dev/docucount/blob/main/js/script.js): `js/script.js`
- [Page counting](https://github.com/razercode-dev/docucount/blob/main/js/script.js): `js/script.js`

### Other components

- **Document user**

## Connections

- Document user → Analyzer interface: opens and submits (evidence: `README.md`)
- Analyzer interface → Upload handling: provides controls (evidence: `README.md`)
- Upload handling → File validation: checks file (evidence: `js/script.js`)
- File validation → PDF extraction: dispatches PDF (evidence: `js/script.js`)
- File validation → DOCX extraction: dispatches DOCX (evidence: `js/script.js`)
- PDF extraction → PDF.js: extracts text (evidence: `js/script.js`)
- DOCX extraction → Mammoth.js: extracts text (evidence: `js/script.js`)
- DOCX extraction → JSZip: reads page breaks (evidence: `js/script.js`)
- Upload handling → Text statistics: analyzes extracted text (evidence: `js/script.js`)
- Upload handling → Page counting: sets page count (evidence: `js/script.js`)
- Text statistics → Analysis results: updates counts (evidence: `js/script.js`)
- Page counting → Analysis results: updates pages (evidence: `js/script.js`)
