How pankajkandpall/doxdock works
Purpose and entry points
DoxDock is an offline-first, browser-only PDF, document, and image utility suite. It is a static React/Vite application: no backend, accounts, uploads, or runtime external services. Browser-local file processing is a core security boundary.
• Application bootstrap: src/main.jsx, src/App.jsx
• Static security/offline entry: index.html
• Production serving: Dockerfile, nginx.conf
Application shell and navigation
App composes the tool workspace, persistent navigation, and global interaction surfaces. The user selects an operation through categorized sidebar navigation or Cmd/Ctrl+K search; the chosen operation is retained as non-sensitive UI state.
• Shell: src/App.jsx
• Navigation/search: src/components/Sidebar.jsx, src/components/CommandPalette.jsx
• Persistence/theme hooks: src/hooks/useLocalStorage.js, src/hooks/useTheme.js
Registry-driven operation plugins
The central registry discovers and exposes self-contained operation folders. Each tool conventionally supplies metadata for discovery/navigation, a JSX UI, and processing helpers. This makes operation folders the extension boundary: adding a tool should not require changing the application shell.
• Discovery/registry: src/registry/registry.js
• Representative plugins: src/operations/merge-pdfs/index.jsx, src/operations/merge-pdfs/meta.js, src/operations/merge-pdfs/helpers.js
• Other domains: src/operations/compress-image/, src/operations/edit-pdf/, src/operations/word-to-pdf/
Job, file-input, and result flow
Operations accept local File inputs through shared dropzone/list UI, maintain operation progress and status through a job hook, then present generated artifacts for preview and download. File bytes remain in browser memory; only theme and last-used tool are persisted.
• Input UI: src/components/Dropzone.jsx, src/components/FileList.jsx
• Job lifecycle: src/hooks/useJob.js, src/components/Progress.jsx
• Result/download UI: src/components/ResultGallery.jsx, src/components/DownloadButton.jsx
Local document and image processing
Operation helpers orchestrate bundled client-side libraries and browser APIs. PDF workflows include manipulation, rendering, extraction, form filling, and conversion; image workflows use Canvas/re-encoding for transforms and metadata stripping. Long-running PDF rendering and image compression use workers where supported to preserve UI responsiveness.
• PDF worker integration: src/lib/pdfjs.js
• Shared PDF/text/layout capabilities: src/lib/extractText.js, src/lib/pdfLayout.js, src/lib/markdown.js
• Shared image capabilities: src/lib/imageCanvas.js, src/lib/imageFormat.js
• Packaging/export: src/lib/download.js, src/lib/zip.js
Privacy and network boundary
The application’s privacy model is enforced by static delivery and CSP: index.html restricts connections to same origin, while all dependencies, icons, WebAssembly, and the PDF worker are locally bundled. There are no application APIs or remote processing services. The browser is the material runtime, using Canvas and Web Crypto alongside bundled PDF/document/image libraries.
• CSP/static document: index.html
• Local-worker boundary: src/lib/pdfjs.js
• Privacy status UI: src/components/PrivacyBadge.jsx
Build, PWA, and deployment
Vite builds the React application into static assets; PWA support enables offline installation and caching after initial load. Development requires Node 18+, but production is a multi-stage static image served by nginx, with Docker Compose exposing host port 8791.
• Build/runtime configuration: vite.config.js, package.json
• Container delivery: Dockerfile, docker-compose.yml
• Static-server policy: nginx.conf
Main entry points: index.jsx Operation folders · App.jsx App workspace · vite.config.js Vite build · index.html Static document & CSP
Components 20
Build & Delivery
- Vite build · Builds the React app into static assets.
vite.config.js - Static container · Multi-stage production image served by nginx.
Dockerfile - nginx policy
nginx.conf - PWA support · Enables installation and offline use after initial load.
package.json
Application Shell
- React bootstrap
src/main.jsx - App workspace · Composes navigation, the selected tool, and global surfaces.
src/App.jsx - Sidebar navigation
src/components/Sidebar.jsx - Command palette
src/components/CommandPalette.jsx - Theme & tool state · Only theme and last-used tool are persisted.
src/hooks/useLocalStorage.js - Local file input · Accepts browser-local File objects.
src/components/Dropzone.jsx - Job lifecycle · Tracks operation status and progress.
src/hooks/useJob.js - Results & download · Previews and downloads generated local artifacts.
src/components/ResultGallery.jsx
Operation Plugins
- Operation registry · Discovers tool metadata and exposes operation modules.
src/registry/registry.js - Operation folders · Self-contained UI, metadata, and helpers implement each operation.
src/operations/merge-pdfs/index.jsx
Local Processing
- Local PDF worker · Uses the bundled PDF worker for responsive rendering.
src/lib/pdfjs.js - PDF text & layout · Shared extraction, layout, and markdown capabilities.
src/lib/extractText.js - Canvas image processing · Transforms, re-encodes, and strips metadata locally.
src/lib/imageCanvas.js - Download & ZIP export
src/lib/download.js
Browser Boundary
- Static document & CSP · Restricts connections to same origin and loads local assets.
index.html - Privacy badge · Communicates local-only processing.
src/components/PrivacyBadge.jsx
Connections 23
- Vite build → React bootstrap: builds
- Vite build → PWA support: configures
- Vite build → Static container: static assets
- Static container → nginx policy: serves with
- nginx policy → Static document & CSP: delivers
- Static document & CSP → React bootstrap: loads locally
- Static document & CSP → Local PDF worker: CSP permits local worker
- React bootstrap → App workspace: mounts
- App workspace → Sidebar navigation: includes
- App workspace → Command palette: includes
- App workspace → Theme & tool state: uses
- Sidebar navigation → Operation registry: lists tools
- Command palette → Operation registry: searches tools
- Operation registry → Operation folders: discovers
- App workspace → Operation folders: renders selected tool
- Operation folders → Local file input: accepts files through
- Operation folders → Job lifecycle: runs via
- Job lifecycle → Results & download: produces artifacts
- Operation folders → Local PDF worker: PDF rendering
- Operation folders → PDF text & layout: PDF processing
- Operation folders → Canvas image processing: image processing
- Operation folders → Download & ZIP export: packages output
- App workspace → Privacy badge: shows