How mithun-srinivas/doxdock works
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: registry.js Operation registry · App.jsx Application shell · useJob.js Job controller · index.jsx PDF operation plugins
Components 21
Browser application
React shell and operation discovery.
- React entry
src/main.jsx - Application shell · Owns active tool selection, navigation, and theme state.
src/App.jsx - Sidebar
src/components/Sidebar.jsx - Command palette
src/components/CommandPalette.jsx - Operation registry · Auto-discovers categorized, searchable operation modules.
src/registry/registry.js - Local preferences · 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 · Merge, edit, and other PDF tools are self-contained plugins.
src/operations/merge-pdfs/index.jsx - Image operation plugins · Image tools combine UI with local transform helpers.
src/operations/compress-image/index.jsx - PDF editor plugin
src/operations/edit-pdf/index.jsx - File intake · Accepts user-selected local files.
src/components/Dropzone.jsx - File list
src/components/FileList.jsx - Job controller · Coordinates execution state and progress.
src/hooks/useJob.js - PDF primitives · Parsing, layout, extraction, and rendering run locally.
src/lib/pdfjs.js - Image primitives · Canvas transforms and format handling run locally.
src/lib/imageCanvas.js - Content conversion · Structured local content is converted into documents.
src/lib/markdown.js - Result gallery · Displays generated files and previews.
src/components/ResultGallery.jsx - Download and ZIP · Downloads outputs and packages multi-file results.
src/lib/download.js
Offline delivery
Static build and browser-side deployment boundaries.
- CSP document boundary · Same-origin CSP enforces no runtime network access.
index.html - Static image build · Node is used only to build deployable static assets.
Dockerfile - nginx static host · Serves the built application without an application backend.
nginx.conf - Offline PWA delivery · Enables offline use of the static application.
docker-compose.yml
Connections 24
- 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