An AI-powered web application for viewing, editing, and generating PDF logbooks. The platform allows users to manually interact with PDF logbooks using a rich canvas interface or automatically generate detailed logbook entries over a date range using Google's Gemini AI.
- Framework: React 19 with Vite as the bundler.
- Canvas & PDF Rendering:
react-konva&konvafor an interactive canvas interface to manipulate PDF elements.pdfjs-distfor rendering PDF pages as images on the canvas.
- Rich Text Editing: Tiptap (headless rich text editor framework) using extensions like
@tiptap/starter-kit,@tiptap/extension-color, etc. - Routing:
react-router-domfor handling frontend page navigation. - HTTP Client:
axiosfor making API requests to the backend.
- Framework: FastAPI (Python) running on an
uvicornASGI server. - PDF Manipulation: PyMuPDF (
pymupdf) for server-side PDF reading, editing, text extraction, and generation. - AI & Orchestration:
google-genaiandlangchain-google-genaito interface with Google's Gemini LLM.langchain-groqto interface with Groq models.langgraphandlangchain-corefor building stateful, multi-actor AI agent workflows to formulate logbook entries.
- Data Validation:
pydanticfor strict typing and schema definitions of API requests/responses. - Database Integration:
motor(asynchronous Python driver for MongoDB) to persist states or application contexts.
Here is a mermaid diagram illustrating the overall architecture of the application:
graph TD
%% Users
User(("User"))
subgraph Frontend ["Frontend (React + Vite)"]
UI["User Interface"]
Canvas["Konva Canvas / PDF.js"]
Editor["Tiptap Rich Text"]
APIClient["Axios HTTP Client"]
UI --> Canvas
UI --> Editor
UI --> APIClient
end
subgraph Backend ["Backend (FastAPI)"]
Router["FastAPI Routers"]
PDFService["PyMuPDF Service"]
AIService["LangGraph & AI Agent"]
Router --> PDFService
Router --> AIService
end
subgraph External ["External Services & Database"]
DB[("MongoDB")]
Gemini["Google Gemini API"]
Groq["Groq API"]
Storage[("Local File Storage <br> /uploads & /outputs")]
end
User -->|"Interacts"| UI
APIClient -->|"REST API Calls"| Router
Router -->|"Read/Write Context"| DB
AIService -->|"LLM Prompts"| Gemini
AIService -->|"LLM Prompts"| Groq
PDFService -->|"Read/Write PDFs"| Storage
The logbook generation feature relies on a multi-agent LangGraph workflow (month_logbook_app) to formulate the entries month by month. Here is the node progression:
graph TD
Start((START))
Node1[breakdown_prompt]
Node2[generate_all_days]
Node3[generate_context]
End((END))
Start --> Node1
Node1 -->|Breaks monthly prompt into daily tasks| Node2
Node2 -->|Generates full JSON logbook entries| Node3
Node3 -->|Generates context summary for next month| End
- Node.js (v18+)
- Python (v3.9+)
- Google Gemini API Key (stored in
.envin the backend directory) - GROQ API Key (stored in
.envin the backend directory) - MongoDB Atlas connection URI (required for context persistence between months)
- Navigate to the
backenddirectory:cd backend - Create and activate a Python virtual environment:
python -m venv venv # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate
- Install the required dependencies:
pip install -r requirements.txt
- Start the server:
The FastAPI backend will run on
uvicorn main:app --reload
http://localhost:8000.
- Navigate to the
frontenddirectory:cd frontend - Install the Node dependencies:
npm install
- Start the Vite development server:
The frontend application will be served at
npm run dev
http://localhost:5173.
/backend: Houses the FastAPI application. Key components include Pydantic schemas, PDF routing/upload logic, PyMuPDF business logic (services/pdf_service.py), and LangGraph/Gemini AI agents (services/ai_service.py)./frontend: Contains the React UI. It features a canvas interface constructed with Konva for annotating PDFs, as well as forms for specifying date ranges to generate logbooks.
- Interactive PDF Viewer: Renders PDF pages as interactive images on a canvas using
pdfjs-distand Konva. - AI-Powered Generation: Formulate intelligent, automated logbook entries utilizing LangGraph workflows and Google's Gemini LLM, GROQ .
- Rich Text Annotations: Add, position, and format text directly onto PDF representations using Tiptap integration.