How rohitdayal-jktech/pdf-management works
Project type and purpose
• A React/Vite/Tailwind frontend
• A Python (FastAPI) backend
• A PostgreSQL database
• AI/LLM integrations (Gemini, Ollama)
• Docker and Kubernetes (via Terraform) for containerization and deployment
File structure
Top‐level:
• frontend/ – React app with components, hooks, pages, store, Vite config, Tailwind
• backend/ – Python app (FastAPI style) with api/, core/, crud/, db/, services/, llm/, utils/
• terraform/ – Kubernetes deployment manifests for frontend, backend, Postgres
• docker‐compose.yml – local multi‐container setup
Patterns & layers in backend:
• API layer (app/api/v1/*.py)
• Business logic/services (app/services/*)
• Data access (app/crud/*, app/db/models, schemas, session)
• Utilities (PDF parsing in app/utils/pdf_utils.py)
• LLM adapters (app/llm/*)
Key points from the README
• “AI‐powered book management” – must show AI summarization/categorization flows
• Emphasis on generative AI – show external LLM services as separate components
Main components & interactions
a. Frontend (React/Vite)
• Hosts UI pages (Login, Signup, Dashboard, Book Table, Modals)
• Calls Backend REST API over HTTPS
b. Backend (FastAPI)
• Exposes /api/v1/{auth, users, books} endpoints
• Business layer invokes CRUD for DB, PDF utils, LLM adapters
• Maintains session to Postgres
c. Database (PostgreSQL)
• Stores users and book metadata
d. PDF storage & processing
• Local or cloud file store for uploaded PDFs
• PDF utility module processes file, extracts text
e. AI/LLM services
• Gemini chatbot, Ollama chatbot (selected via chatbot_selector)
• Called by backend to generate summaries, categories
f. Infrastructure layer
• Docker containers for frontend, backend, Postgres
• Kubernetes cluster (Terraform) orchestrates deployments, services
Architectural patterns & design principles
• Layered (“Clean”) architecture in backend: API → Services → CRUD/Data layer → DB
• Separation of concerns: UI vs API vs Data vs AI Integrations
• Micro‐deployment: each major service (frontend, backend, DB) runs in its own container/pod
• Stateless backend pods behind a load balancer, persistent Postgres storage
How to represent this
Components:
• UI Layer: Browser/Client → Frontend container
• API Layer: Backend container (FastAPI)
• Data Layer: PostgreSQL container
• Storage: PDF file store (volume or S3)
• AI Layer: External LLM services (Gemini, Ollama – treat as external APIs)
• Infrastructure: Docker & Kubernetes (control plane, deployments, services)
Relationships & data flow:
1. User interacts with Frontend (HTTP)
2. Frontend calls Backend REST API (HTTPS)
3. Backend ↔ PostgreSQL (SQL over TCP)
4. Backend → PDF storage (upload/download)
5. Backend → LLM services (chatbot_selector routes to Gemini/Ollama API endpoints)
6. Terraform/K8s manages container deployments, load balancing
Must‐include elements
• Annotations for critical interactions (e.g., “Generate Summary → LLM API”)