How tetsuuya/docs-service works
Docs-Service accepts document-generation requests through an Express API and returns generated files. The main workflow branches by format and mode: DOCX can be generated from scratch, filled against an uploaded or master template, or informed by a reference document; PPTX generation is a separate capability, with image-generation support; XLSX generation is exposed, while PDF conversion is present but explicitly unfinished. The sampled code supports the DOCX orchestration and Gemini calls; several PPTX/XLSX internals were not sampled, so their wiring is shown only where evidenced.
Main entry points: documentController.js Generation controller · fillModeService.js Template fill mode · documentRoutes.js Document routes · scratchModeService.js Scratch content
Components 27
Web API
- Web frontend
public/index.html - Express app
src/app.js - Document routes
src/routes/documentRoutes.js - Generation controller
src/controllers/documentController.js
DOCX Generation
- Scratch content
src/services/docx/scratch/scratchModeService.js - Scratch DOCX builder
src/services/docx/scratch/scratchDocxBuilder.js - Template analysis
src/services/docx/shared/templateService.js - Template fill mode
src/services/docx/fill/fillModeService.js - HTML DOCX planning
src/services/docx/fill/htmlDocxPlanGenerator.js - HTML DOCX builder
src/services/docx/fill/htmlDocxBuilder.js - Fill DOCX builder
src/services/docx/fill/fillDocxBuilder.js
Presentation Generation
- PPTX service
src/services/pptx/pptxService.js - PPTX content generation
src/services/pptx/scratch/scratchPptxService.js - Scratch PPTX builder
src/services/pptx/scratch/scratchPptxBuilder.js - PPTX fill builder
src/services/pptx/fill/fillPptxBuilder.js - PPTX fill planning
src/services/pptx/fill/pptxPlanGenerator.js - HTML PPTX planning
src/services/pptx/fill/htmlPptxPlanGenerator.js - HTML PPTX builder
src/services/pptx/fill/htmlPptxBuilder.js - Reference PPTX builder
src/services/pptx/reference/referencePptxBuilder.js - PPTX template parsing
src/services/pptx/template/templateParser.js - Image service
src/services/pptx/imageService.js
Other Formats
- XLSX generator
src/services/xlsx/xlsxService.js - PDF conversion
src/services/pdf/pdfService.js
History
- Document history
src/utils/historyStorage.js
Other components
- Requesting user
- Gemini API
- Image providers
Connections 21
- Requesting user → Web frontend: submits prompt
- Requesting user → Document routes: posts request
- Web frontend → Express app: uses service
- Express app → Document routes: mounts API
- Document routes → Generation controller: dispatches
- Generation controller → Scratch content: generates content
- Generation controller → Scratch DOCX builder: builds DOCX
- Generation controller → Template fill mode: fills template
- Generation controller → Template analysis: analyzes upload
- Generation controller → Fill DOCX builder: builds filled DOCX
- Template fill mode → HTML DOCX planning: creates plan
- HTML DOCX planning → Gemini API: requests content
- Template fill mode → HTML DOCX builder: builds HTML DOCX
- Template fill mode → Scratch content: requests AI content
- Scratch content → Gemini API: requests content
- Generation controller → Document history: saves document
- Generation controller → PPTX service: requests PPTX
- Generation controller → XLSX generator: requests XLSX
- Generation controller → PDF conversion: requests PDF
- PPTX content generation → Gemini API: requests slides
- Image service → Image providers: fetches images