# adityasonigrowlity-tech/esg-tech-brsr-report architecture

> Architecture diagram of the GitHub repository adityasonigrowlity-tech/esg-tech-brsr-report, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adityasonigrowlity-tech/esg-tech-brsr-report
- Repository: https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report

## Overview

This is a BRSR reporting web application: users upload a prior-year PDF, enter current-year data, review Principle 3 and 6 indicators, and export a report. The home page coordinates the workflow; a state hook restores and saves year-specific report data. Authentication and persistence are separate supporting layers. PDF parsing delegates text extraction to a worker and uses an external language-model service for extraction. Source excerpts are partial, so links for unsampled component wiring are omitted.

Main entry points: [`src/app/page.tsx`](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/page.tsx) (Report workspace), [`src/app/api/brsr/parse-pdf/route.ts`](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/api/brsr/parse-pdf/route.ts) (PDF parsing API), [`src/auth.ts`](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/auth.ts) (Credentials auth), [`src/app/api/auth/signup/route.ts`](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/api/auth/signup/route.ts) (Signup API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["BRSR workflow"]
  node_home["Report workspace<br/>[page.tsx]"]
  node_dashboard["Dashboard<br/>[BrsrDashboard.tsx]"]
  node_upload["PDF upload<br/>[DataUpload.tsx]"]
  node_wizard["Data entry<br/>[BrsrWizard.tsx]"]
  node_excel["Excel import"]
  node_review["Report review<br/>[BrsrReview.tsx]"]
end

subgraph group_processing["Data processing"]
  node_pdfparse["PDF parsing API<br/>[route.ts]"]
  node_worker["PDF text worker<br/>[pdf-worker.cjs]"]
  node_llm["Language model"]
  node_pdfgen["PDF generation API<br/>[route.tsx]"]
  node_metrics["BRSR metrics<br/>[types.ts]"]
end

subgraph group_identity["Authentication"]
  node_signup["Signup API<br/>[route.ts]"]
  node_auth["Credentials auth<br/>[auth.ts]"]
  node_authroute["Auth route<br/>[route.ts]"]
  node_signinpage["Sign-in page<br/>[page.tsx]"]
  node_signuppage["Sign-up page<br/>[page.tsx]"]
end

subgraph group_persistence["State persistence"]
  node_statehook["Report state hook<br/>[useBrsrState.ts]"]
  node_stateapi["Report state API<br/>[route.ts]"]
  node_db[("Supabase database<br/>[db.ts]")]
end

node_user(("Report user"))

node_user -->|"uses"| node_home
node_home -->|"renders"| node_dashboard
node_home -->|"renders"| node_upload
node_home -->|"renders"| node_wizard
node_home -->|"renders"| node_review
node_home -->|"manages state"| node_statehook
node_home -->|"uploads PDF"| node_pdfparse
node_pdfparse -->|"extracts text"| node_worker
node_pdfparse -->|"extracts fields"| node_llm
node_pdfparse -->|"returns parsed data"| node_home
node_home -->|"calculates metrics"| node_metrics
node_review -->|"requests export"| node_pdfgen
node_pdfgen -->|"returns PDF"| node_review
node_statehook -->|"loads and saves"| node_stateapi
node_stateapi -->|"checks session"| node_auth
node_stateapi -->|"reads and writes"| node_db
node_authroute -->|"dispatches"| node_auth
node_auth -->|"reads users"| node_db
node_signup -->|"creates users"| node_db
node_signinpage -->|"signs in"| node_authroute
node_signuppage -->|"registers"| node_signup
node_signup -->|"hashes password"| node_auth

click node_home "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/page.tsx"
click node_dashboard "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/features/brsr/components/BrsrDashboard.tsx"
click node_upload "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/features/brsr/components/DataUpload.tsx"
click node_wizard "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/features/brsr/components/BrsrWizard.tsx"
click node_excel "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/features/brsr/components/ExcelImportPanel.tsx"
click node_review "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/features/brsr/components/BrsrReview.tsx"
click node_pdfparse "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/api/brsr/parse-pdf/route.ts"
click node_worker "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/pdf-worker.cjs"
click node_pdfgen "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/api/brsr/generate-pdf/route.tsx"
click node_metrics "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/features/brsr/types.ts"
click node_statehook "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/features/brsr/hooks/useBrsrState.ts"
click node_stateapi "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/api/brsr/state/route.ts"
click node_db "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/lib/db.ts"
click node_signup "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/api/auth/signup/route.ts"
click node_auth "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/auth.ts"
click node_authroute "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts"
click node_signinpage "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/auth/signin/page.tsx"
click node_signuppage "https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/auth/signup/page.tsx"

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_home,node_dashboard,node_upload,node_wizard,node_excel,node_review,node_user toneBlue
class node_pdfparse,node_worker,node_llm,node_pdfgen,node_metrics toneAmber
class node_signup,node_auth,node_authroute,node_signinpage,node_signuppage toneMint
class node_statehook,node_stateapi,node_db toneRose
```

## Components

### BRSR workflow

- [Report workspace](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Dashboard](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/features/brsr/components/BrsrDashboard.tsx): `src/features/brsr/components/BrsrDashboard.tsx`
- [PDF upload](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/features/brsr/components/DataUpload.tsx): `src/features/brsr/components/DataUpload.tsx`
- [Data entry](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/features/brsr/components/BrsrWizard.tsx): `src/features/brsr/components/BrsrWizard.tsx`
- [Excel import](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/features/brsr/components/ExcelImportPanel.tsx): `src/features/brsr/components/ExcelImportPanel.tsx`
- [Report review](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/features/brsr/components/BrsrReview.tsx): `src/features/brsr/components/BrsrReview.tsx`

### Data processing

- [PDF parsing API](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/api/brsr/parse-pdf/route.ts): `src/app/api/brsr/parse-pdf/route.ts`
- [PDF text worker](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/pdf-worker.cjs): `pdf-worker.cjs`
- **Language model**
- [PDF generation API](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/api/brsr/generate-pdf/route.tsx): `src/app/api/brsr/generate-pdf/route.tsx`
- [BRSR metrics](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/features/brsr/types.ts): `src/features/brsr/types.ts`

### Authentication

- [Signup API](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/api/auth/signup/route.ts): `src/app/api/auth/signup/route.ts`
- [Credentials auth](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/auth.ts): `src/auth.ts`
- [Auth route](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts): `src/app/api/auth/[...nextauth]/route.ts`
- [Sign-in page](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/auth/signin/page.tsx): `src/app/auth/signin/page.tsx`
- [Sign-up page](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/auth/signup/page.tsx): `src/app/auth/signup/page.tsx`

### State persistence

- [Report state hook](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/features/brsr/hooks/useBrsrState.ts): `src/features/brsr/hooks/useBrsrState.ts`
- [Report state API](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/app/api/brsr/state/route.ts): `src/app/api/brsr/state/route.ts`
- [Supabase database](https://github.com/adityasonigrowlity-tech/esg-tech-brsr-report/blob/main/src/lib/db.ts): `src/lib/db.ts`

### Other components

- **Report user**

## Connections

- Report user → Report workspace: uses
- Report workspace → Dashboard: renders
- Report workspace → PDF upload: renders
- Report workspace → Data entry: renders
- Report workspace → Report review: renders
- Report workspace → Report state hook: manages state
- Report workspace → PDF parsing API: uploads PDF
- PDF parsing API → PDF text worker: extracts text
- PDF parsing API → Language model: extracts fields
- PDF parsing API → Report workspace: returns parsed data
- Report workspace → BRSR metrics: calculates metrics
- Report review → PDF generation API: requests export
- PDF generation API → Report review: returns PDF
- Report state hook → Report state API: loads and saves
- Report state API → Credentials auth: checks session
- Report state API → Supabase database: reads and writes
- Auth route → Credentials auth: dispatches
- Credentials auth → Supabase database: reads users
- Signup API → Supabase database: creates users
- Sign-in page → Auth route: signs in
- Sign-up page → Signup API: registers
- Signup API → Credentials auth: hashes password
