How fthabhishek-pandey/pdfeditor works
Project Type and Purpose
• This is a single‐page application (SPA) built with React and Vite.
• It provides an in‐browser PDF editor and previewer.
• State is managed via a React context and data is persisted locally.
File Structure
• Top‐level:
• frontend/ – contains everything for the SPA
• .gitignore, readme.md – repo config
• frontend/vite.config.js – bundler & dev‐server setup
• frontend/src/ – source code:
• components/ – UI pieces: Editor, PageCanvas, PDFPreview, Toolbar
• contexts/ – EditorContext (global state)
• services/ – pdfService (PDF rendering/generation), storageService (localStorage)
• assets/ – static images/fonts, etc.
• main.jsx & index.html – application bootstrap
(Empty) README
• No explicit architecture section; rely on directory naming and conventions.
Main Components & Relationships
a. Browser / Client
– Loads index.html → main.jsx → React root
b. Bundler/Dev‐Server
– Vite serves files in dev mode; produces optimized bundles for production
c. React Application
– EditorContext (holds document state, selected tool, current page)
– Components:
• Toolbar – user tool selection, triggers context actions
• Editor → PageCanvas – displays and edits PDF pages
• PDFPreview – shows full‐document read‐only view
– Services:
• pdfService – wraps PDF.js or similar for parsing/rendering/generation
• storageService – reads/writes JSON state to localStorage for persistence
d. Static Assets
Architectural Patterns & Principles
• Single Source of Truth: EditorContext
• Component‐based UI (React)
• Service Layer abstraction for cross‐cutting concerns (PDF handling, storage)
• SPA routing can be omitted if no page‐level routes exist
• Clear component names matching directory names.