How satishvudata98/filemetadata-modifier works
Project Type and Purpose
• This is a full-stack web application whose purpose is to let users view, add, and edit metadata (title, author, comments, timestamps) on PDF and image files (JPEG, PNG, GIF).
File Structure
• Top-Level
• package.json / package-lock.json: root scripts to install and run both frontend and backend.
• filemetadata-modifier/
• Frontend (filemetadata-modifier/frontend/)
• Vue.js 3 application using Vite (vite.config.js)
• Components in src/components (FileUploader.vue, metadata display, edit UI)
• Entry point: src/main.js → App.vue
• Backend (filemetadata-modifier/backend/)
• Express server (server.js)
• Uses pdf-lib, sharp, exifr for metadata extraction and writing
• Build, start scripts in root and sub-projects (npm run dev, etc.)
Extract Additional Insights from README
• API Endpoints (implied by “Get Metadata”, “Add Comment”, “Edit Comment”)
• Metadata Storage Patterns
• PDF metadata embedded via pdf-lib
• JPEG EXIF updated via exifr
• PNG metadata in sidecar .metadata.json
• Frontend runs on http://localhost:5173, backend on http://localhost:3001.
Main Components & Their Roles
a. User Browser / Client
• Renders Vue UI
• Interacts via HTTP to backend
b. Vue Frontend
• File upload component → sends file paths (or contents) to backend
• Metadata viewer/editor UI
• HTTP client (fetch/Axios) to Express API
c. Express Backend
• HTTP API layer (e.g., GET /metadata, POST /metadata/add, PUT /metadata/edit)
• Business logic: determine file type, route to appropriate metadata service
d. Metadata Services
• PDF Service (pdf-lib): extract/modify PDF document properties
• EXIF Service (exifr): read/write JPEG EXIF fields
• PNG Service: read sidecar .metadata.json, write updates
e. File System / Storage
• Holds original files, .metadata.json for PNG
• Updated files (in-place or overwritten)
f. Optional Utilities & Config
• Vite dev server, nodemon (or similar) for hot-reload
• Root scripts to orchestrate concurrent startup
Relationships and Interactions
• Client → Frontend: User clicks UI, triggers Vue methods
• Frontend → Backend API: HTTP requests (JSON payload)
• Backend → Metadata Service: function calls to pdf-lib, exifr, or file I/O
• Metadata Service → File System: read/write metadata
• Backend → Frontend: JSON response containing metadata or success status
Architectural Patterns & Principles
• Layered Architecture:
• Presentation (Vue)
• Business/API (Express)
• Domain/Service (Metadata handlers)
• Persistence (File system)
• Separation of Concerns: each metadata type handled by a dedicated module
• Stateless API: each request contains file path & operation, no session state