# mithun-srinivas/doxdock architecture

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

- Interactive diagram: https://gitdiagram.com/mithun-srinivas/doxdock
- Repository: https://github.com/mithun-srinivas/doxdock

## Overview

#### Purpose and Runtime
DoxDock is an offline-first, browser-only PDF and image utility suite. It is a static React/Vite application: files are processed locally in browser memory/workers, never sent to a backend. Production deployment is static assets served by nginx; Node is build-time only. Key boundaries: `index.html`, `Dockerfile`, `nginx.conf`.

#### Application Entry and Shell
`src/main.jsx` mounts the React application; `src/App.jsx` owns the primary shell and tool routing/selection. The shell combines navigation, command discovery, theme state, and the active operation UI. `src/components/Sidebar.jsx` and `src/components/CommandPalette.jsx` are the main operation-selection surfaces.

#### Registry-Based Operation Plugins
Tools are self-contained operation folders containing metadata, a UI component, and processing helpers. `src/registry/registry.js` auto-discovers operation modules, creating the categorized/searchable tool catalog rather than requiring central per-tool wiring. Representative plugins: `src/operations/merge-pdfs/index.jsx`, `src/operations/compress-image/index.jsx`, `src/operations/edit-pdf/index.jsx`. This is the principal extension boundary for new tools.

#### Job, File, and Result Flow
Users provide local files through reusable intake and list components, then an operation executes its helpers and exposes progress/results for download. `src/components/Dropzone.jsx`, `src/components/FileList.jsx`, and `src/hooks/useJob.js` define the common interaction/control-flow layer. Outputs are displayed/downloaded via `src/components/ResultGallery.jsx`, `src/components/ImageResult.jsx`, and `src/lib/download.js`; multi-file outputs can be packaged through `src/lib/zip.js`.

#### Document Processing Boundary
PDF-oriented plugins implement merge/split/rotate/organize/edit/form-fill/watermark/extraction and conversion flows on the client. Shared PDF primitives and rendering boundaries reside in `src/lib/pdfjs.js`, `src/lib/pdfLayout.js`, and `src/lib/extractText.js`. The bundled pdf.js worker and browser-side PDF libraries perform heavy parsing/rendering locally, separating UI orchestration from document transformations.

#### Image and Content Conversion Pipeline
Image tools share browser Canvas-based transforms and format handling, while conversion tools turn structured local content into generated documents. Core shared primitives are `src/lib/imageCanvas.js`, `src/lib/imageFormat.js`, and `src/lib/markdown.js`. Examples of consumers include `src/operations/crop-image/Cropper.jsx`, `src/operations/images-to-pdf/helpers.js`, and `src/operations/html-to-pdf/helpers.js`.

#### Privacy, Persistence, and Deployment
A CSP in `index.html` restricts connections to the same origin; the architectural rule is no runtime network access. Only non-sensitive UI preferences are retained locally through `src/hooks/useLocalStorage.js` and `src/hooks/useTheme.js`; file contents are not persisted. The PWA/service-worker build provides offline use, while `docker-compose.yml` deploys the final static site behind nginx without an application server or external services.

Main entry points: [`src/registry/registry.js`](https://github.com/mithun-srinivas/doxdock/blob/main/src/registry/registry.js) (Operation registry), [`src/App.jsx`](https://github.com/mithun-srinivas/doxdock/blob/main/src/App.jsx) (Application shell), [`src/hooks/useJob.js`](https://github.com/mithun-srinivas/doxdock/blob/main/src/hooks/useJob.js) (Job controller), [`src/operations/merge-pdfs/index.jsx`](https://github.com/mithun-srinivas/doxdock/blob/main/src/operations/merge-pdfs/index.jsx) (PDF operation plugins)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Browser application"]
  node_entry["React entry<br/>bootstrap<br/>[main.jsx]"]
  node_shell["Application shell<br/>React router shell<br/>[App.jsx]"]
  node_sidebar["Sidebar<br/>tool navigation<br/>[Sidebar.jsx]"]
  node_palette["Command palette<br/>tool search<br/>[CommandPalette.jsx]"]
  node_registry{{"Operation registry<br/>plugin discovery<br/>[registry.js]"}}
  node_preferences["Local preferences<br/>browser storage hooks<br/>[useLocalStorage.js]"]
end

subgraph group_processing["Local processing"]
  node_pdf_plugin["PDF operation plugins<br/>operation modules<br/>[index.jsx]"]
  node_image_plugin["Image operation plugins<br/>operation modules<br/>[index.jsx]"]
  node_edit_plugin["PDF editor plugin<br/>operation module<br/>[index.jsx]"]
  node_intake["File intake<br/>dropzone<br/>[Dropzone.jsx]"]
  node_file_list["File list<br/>input management<br/>[FileList.jsx]"]
  node_job["Job controller<br/>React hook<br/>[useJob.js]"]
  node_pdf_runtime{{"PDF primitives<br/>browser PDF runtime<br/>[pdfjs.js]"}}
  node_image_runtime{{"Image primitives<br/>Canvas runtime<br/>[imageCanvas.js]"}}
  node_content_runtime{{"Content conversion<br/>document generation<br/>[markdown.js]"}}
  node_results["Result gallery<br/>output UI<br/>[ResultGallery.jsx]"]
  node_download["Download and ZIP<br/>output delivery<br/>[download.js]"]
end

subgraph group_delivery["Offline delivery"]
  node_html_boundary["CSP document boundary<br/>static HTML<br/>[index.html]"]
  node_static_build["Static image build<br/>Docker build"]
  node_nginx["nginx static host<br/>production server<br/>[nginx.conf]"]
  node_offline["Offline PWA delivery<br/>service-worker build<br/>[docker-compose.yml]"]
end

node_html_boundary -->|"loads"| node_entry
node_entry -->|"mounts"| node_shell
node_shell -->|"renders"| node_sidebar
node_shell -->|"renders"| node_palette
node_sidebar -->|"lists tools from"| node_registry
node_palette -->|"searches"| node_registry
node_shell -->|"selects operation"| node_registry
node_registry -->|"discovers"| node_pdf_plugin
node_registry -->|"discovers"| node_image_plugin
node_registry -->|"discovers"| node_edit_plugin
node_intake -->|"adds local files"| node_file_list
node_file_list -->|"supplies inputs"| node_job
node_pdf_plugin -->|"executes through"| node_job
node_image_plugin -->|"executes through"| node_job
node_edit_plugin -->|"executes through"| node_job
node_pdf_plugin -->|"uses"| node_pdf_runtime
node_edit_plugin -->|"uses"| node_pdf_runtime
node_image_plugin -->|"uses"| node_image_runtime
node_job -->|"publishes outputs"| node_results
node_results -->|"downloads via"| node_download
node_shell -->|"persists UI state"| node_preferences
node_static_build -->|"produces static assets for"| node_nginx
node_nginx -->|"serves"| node_html_boundary
node_offline -.->|"supports offline use"| node_html_boundary

click node_entry "https://github.com/mithun-srinivas/doxdock/blob/main/src/main.jsx"
click node_shell "https://github.com/mithun-srinivas/doxdock/blob/main/src/App.jsx"
click node_sidebar "https://github.com/mithun-srinivas/doxdock/blob/main/src/components/Sidebar.jsx"
click node_palette "https://github.com/mithun-srinivas/doxdock/blob/main/src/components/CommandPalette.jsx"
click node_registry "https://github.com/mithun-srinivas/doxdock/blob/main/src/registry/registry.js"
click node_pdf_plugin "https://github.com/mithun-srinivas/doxdock/blob/main/src/operations/merge-pdfs/index.jsx"
click node_image_plugin "https://github.com/mithun-srinivas/doxdock/blob/main/src/operations/compress-image/index.jsx"
click node_edit_plugin "https://github.com/mithun-srinivas/doxdock/blob/main/src/operations/edit-pdf/index.jsx"
click node_intake "https://github.com/mithun-srinivas/doxdock/blob/main/src/components/Dropzone.jsx"
click node_file_list "https://github.com/mithun-srinivas/doxdock/blob/main/src/components/FileList.jsx"
click node_job "https://github.com/mithun-srinivas/doxdock/blob/main/src/hooks/useJob.js"
click node_pdf_runtime "https://github.com/mithun-srinivas/doxdock/blob/main/src/lib/pdfjs.js"
click node_image_runtime "https://github.com/mithun-srinivas/doxdock/blob/main/src/lib/imageCanvas.js"
click node_content_runtime "https://github.com/mithun-srinivas/doxdock/blob/main/src/lib/markdown.js"
click node_results "https://github.com/mithun-srinivas/doxdock/blob/main/src/components/ResultGallery.jsx"
click node_download "https://github.com/mithun-srinivas/doxdock/blob/main/src/lib/download.js"
click node_preferences "https://github.com/mithun-srinivas/doxdock/blob/main/src/hooks/useLocalStorage.js"
click node_html_boundary "https://github.com/mithun-srinivas/doxdock/blob/main/index.html"
click node_static_build "https://github.com/mithun-srinivas/doxdock/tree/main/Dockerfile"
click node_nginx "https://github.com/mithun-srinivas/doxdock/blob/main/nginx.conf"
click node_offline "https://github.com/mithun-srinivas/doxdock/blob/main/docker-compose.yml"

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_entry,node_shell,node_sidebar,node_palette,node_registry,node_preferences toneBlue
class node_pdf_plugin,node_image_plugin,node_edit_plugin,node_intake,node_file_list,node_job,node_pdf_runtime,node_image_runtime,node_content_runtime,node_results,node_download toneAmber
class node_html_boundary,node_static_build,node_nginx,node_offline toneMint
```

## Components

### Browser application

React shell and operation discovery.

- [React entry](https://github.com/mithun-srinivas/doxdock/blob/main/src/main.jsx): bootstrap · `src/main.jsx`
- [Application shell](https://github.com/mithun-srinivas/doxdock/blob/main/src/App.jsx): React router shell · Owns active tool selection, navigation, and theme state. · `src/App.jsx`
- [Sidebar](https://github.com/mithun-srinivas/doxdock/blob/main/src/components/Sidebar.jsx): tool navigation · `src/components/Sidebar.jsx`
- [Command palette](https://github.com/mithun-srinivas/doxdock/blob/main/src/components/CommandPalette.jsx): tool search · `src/components/CommandPalette.jsx`
- [Operation registry](https://github.com/mithun-srinivas/doxdock/blob/main/src/registry/registry.js): plugin discovery · Auto-discovers categorized, searchable operation modules. · `src/registry/registry.js`
- [Local preferences](https://github.com/mithun-srinivas/doxdock/blob/main/src/hooks/useLocalStorage.js): browser storage hooks · Only non-sensitive UI preferences are retained. · `src/hooks/useLocalStorage.js`

### Local processing

All file work remains in browser memory and workers.

- [PDF operation plugins](https://github.com/mithun-srinivas/doxdock/blob/main/src/operations/merge-pdfs/index.jsx): operation modules · Merge, edit, and other PDF tools are self-contained plugins. · `src/operations/merge-pdfs/index.jsx`
- [Image operation plugins](https://github.com/mithun-srinivas/doxdock/blob/main/src/operations/compress-image/index.jsx): operation modules · Image tools combine UI with local transform helpers. · `src/operations/compress-image/index.jsx`
- [PDF editor plugin](https://github.com/mithun-srinivas/doxdock/blob/main/src/operations/edit-pdf/index.jsx): operation module · `src/operations/edit-pdf/index.jsx`
- [File intake](https://github.com/mithun-srinivas/doxdock/blob/main/src/components/Dropzone.jsx): dropzone · Accepts user-selected local files. · `src/components/Dropzone.jsx`
- [File list](https://github.com/mithun-srinivas/doxdock/blob/main/src/components/FileList.jsx): input management · `src/components/FileList.jsx`
- [Job controller](https://github.com/mithun-srinivas/doxdock/blob/main/src/hooks/useJob.js): React hook · Coordinates execution state and progress. · `src/hooks/useJob.js`
- [PDF primitives](https://github.com/mithun-srinivas/doxdock/blob/main/src/lib/pdfjs.js): browser PDF runtime · Parsing, layout, extraction, and rendering run locally. · `src/lib/pdfjs.js`
- [Image primitives](https://github.com/mithun-srinivas/doxdock/blob/main/src/lib/imageCanvas.js): Canvas runtime · Canvas transforms and format handling run locally. · `src/lib/imageCanvas.js`
- [Content conversion](https://github.com/mithun-srinivas/doxdock/blob/main/src/lib/markdown.js): document generation · Structured local content is converted into documents. · `src/lib/markdown.js`
- [Result gallery](https://github.com/mithun-srinivas/doxdock/blob/main/src/components/ResultGallery.jsx): output UI · Displays generated files and previews. · `src/components/ResultGallery.jsx`
- [Download and ZIP](https://github.com/mithun-srinivas/doxdock/blob/main/src/lib/download.js): output delivery · Downloads outputs and packages multi-file results. · `src/lib/download.js`

### Offline delivery

Static build and browser-side deployment boundaries.

- [CSP document boundary](https://github.com/mithun-srinivas/doxdock/blob/main/index.html): static HTML · Same-origin CSP enforces no runtime network access. · `index.html`
- [Static image build](https://github.com/mithun-srinivas/doxdock/tree/main/Dockerfile): Docker build · Node is used only to build deployable static assets. · `Dockerfile`
- [nginx static host](https://github.com/mithun-srinivas/doxdock/blob/main/nginx.conf): production server · Serves the built application without an application backend. · `nginx.conf`
- [Offline PWA delivery](https://github.com/mithun-srinivas/doxdock/blob/main/docker-compose.yml): service-worker build · Enables offline use of the static application. · `docker-compose.yml`

## Connections

- CSP document boundary → React entry: loads
- React entry → Application shell: mounts
- Application shell → Sidebar: renders
- Application shell → Command palette: renders
- Sidebar → Operation registry: lists tools from
- Command palette → Operation registry: searches
- Application shell → Operation registry: selects operation
- Operation registry → PDF operation plugins: discovers
- Operation registry → Image operation plugins: discovers
- Operation registry → PDF editor plugin: discovers
- File intake → File list: adds local files
- File list → Job controller: supplies inputs
- PDF operation plugins → Job controller: executes through
- Image operation plugins → Job controller: executes through
- PDF editor plugin → Job controller: executes through
- PDF operation plugins → PDF primitives: uses
- PDF editor plugin → PDF primitives: uses
- Image operation plugins → Image primitives: uses
- Job controller → Result gallery: publishes outputs
- Result gallery → Download and ZIP: downloads via
- Application shell → Local preferences: persists UI state
- Static image build → nginx static host: produces static assets for
- nginx static host → CSP document boundary: serves
- Offline PWA delivery → CSP document boundary: supports offline use
