# bcancapar-spec/avukat-dosya-indirici architecture

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

- Interactive diagram: https://gitdiagram.com/bcancapar-spec/avukat-dosya-indirici
- Repository: https://github.com/bcancapar-spec/avukat-dosya-indirici

## Overview

Avukat Dosya İndirici is a Chrome extension that lists and downloads UYAP case documents for the user, with filtering, retry/resume, individual or merged output, and failure reports. The workflow starts in the popup, gathers portal-specific document records, downloads each selected document through the page context, and saves files locally; optional merge and report generation use the background and offscreen contexts. The README documents both portal paths, while source excerpts show the main coordination and output layers. Some manifest wiring and unsampled implementation details are not shown, so uncertain links are omitted.

Main entry points: [`content.js`](https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/content.js) (Download coordinator), [`offscreen.js`](https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/offscreen.js) (PDF processing), [`main-list.js`](https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/main-list.js) (Document listing), [`popup.js`](https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/popup.js) (Popup controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_popup["Popup controls<br/>[popup.js]"]
end

subgraph group_portal["Portal integration"]
  node_interceptor["Request interceptor<br/>[inject.js]"]
  node_list["Document listing<br/>[main-list.js]"]
end

subgraph group_workflow["Download workflow"]
  node_downloader["Download coordinator<br/>[content.js]"]
  node_background["Extension background<br/>[background.js]"]
  node_local_state[("Resume state")]
end

subgraph group_output["Local output"]
  node_chrome_downloads["Chrome downloads"]
  node_offscreen["PDF processing<br/>[offscreen.js]"]
  node_utif["TIFF decoder<br/>[utif.js]"]
end

node_user(("Extension user"))
node_portal_site["UYAP portals"]
node_pdf_library["PDF library"]

node_user -->|"opens"| node_popup
node_popup -->|"requests list"| node_list
node_popup -->|"starts download"| node_downloader
node_portal_site -->|"sends requests"| node_interceptor
node_interceptor -->|"provides captured data"| node_list
node_list -->|"reads lists and documents"| node_portal_site
node_downloader -->|"bridges document fetch"| node_list
node_downloader -->|"requests file output"| node_background
node_downloader -->|"saves resume progress"| node_local_state
node_background -->|"saves files"| node_chrome_downloads
node_background -->|"dispatches PDF work"| node_offscreen
node_offscreen -->|"decodes TIFF"| node_utif
node_offscreen -.->|"uses PDF tools"| node_pdf_library
node_offscreen -->|"returns merged PDF"| node_chrome_downloads

click node_popup "https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/popup.js"
click node_interceptor "https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/inject.js"
click node_list "https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/main-list.js"
click node_downloader "https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/content.js"
click node_background "https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/background.js"
click node_offscreen "https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/offscreen.js"
click node_utif "https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/utif.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_user toneBlue
class node_interceptor,node_list toneAmber
class node_downloader,node_background,node_local_state toneMint
class node_chrome_downloads,node_offscreen,node_utif toneRose
class node_portal_site,node_pdf_library toneIndigo
```

## Components

### User interface

- [Popup controls](https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/popup.js): `popup.js`

### Portal integration

- [Request interceptor](https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/inject.js): `inject.js`
- [Document listing](https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/main-list.js): `main-list.js`

### Download workflow

- [Download coordinator](https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/content.js): `content.js`
- [Extension background](https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/background.js): `background.js`
- **Resume state**

### Local output

- **Chrome downloads**
- [PDF processing](https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/offscreen.js): `offscreen.js`
- [TIFF decoder](https://github.com/bcancapar-spec/avukat-dosya-indirici/blob/main/utif.js): `utif.js`

### Other components

- **Extension user**
- **UYAP portals**
- **PDF library**

## Connections

- Extension user → Popup controls: opens (evidence: `README.md`)
- Popup controls → Document listing: requests list (evidence: `popup.js`)
- Popup controls → Download coordinator: starts download (evidence: `popup.js`)
- UYAP portals → Request interceptor: sends requests (evidence: `README.md`)
- Request interceptor → Document listing: provides captured data (evidence: `inject.js`)
- Document listing → UYAP portals: reads lists and documents (evidence: `README.md`)
- Download coordinator → Document listing: bridges document fetch (evidence: `content.js`)
- Download coordinator → Extension background: requests file output (evidence: `content.js`)
- Download coordinator → Resume state: saves resume progress (evidence: `content.js`)
- Extension background → Chrome downloads: saves files (evidence: `background.js`)
- Extension background → PDF processing: dispatches PDF work (evidence: `background.js`)
- PDF processing → TIFF decoder: decodes TIFF (evidence: `offscreen.js`)
- PDF processing → PDF library: uses PDF tools (evidence: `offscreen.js`)
- PDF processing → Chrome downloads: returns merged PDF
