# ramakrishna2006/lumina-local-pdf--summarizer architecture

> Architecture diagram of the GitHub repository ramakrishna2006/lumina-local-pdf--summarizer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ramakrishna2006/lumina-local-pdf--summarizer
- Repository: https://github.com/ramakrishna2006/lumina-local-pdf--summarizer

## Overview

Lumina is a local-first document chat application. Users upload files, which the backend extracts and chunks for storage and search; they can then ask questions for streamed, source-cited answers, request whole-document study outputs, research the web, or generate images. The graph includes the documented capabilities even where implementation excerpts are incomplete. Some service-to-route details are not shown, so those links rely on README statements; unsampled internals are not inferred.

Main entry points: [`backend/app/main.py`](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/main.py) (API routes), [`backend/app/services/extraction/extractor.py`](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/extraction/extractor.py) (File extraction), [`backend/app/db/database.py`](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/db/database.py) (SQLite database), [`backend/app/services/rag_service.py`](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/rag_service.py) (Hybrid retrieval)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_app["Chat interface<br/>[App.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["Backend API"]
  node_backend_api["API routes<br/>[main.py]"]
  node_auth["Access control<br/>[security.py]"]
end

subgraph group_ingestion["Document ingestion"]
  node_extractor["File extraction<br/>[extractor.py]"]
  node_pdf["PDF and OCR<br/>[pdf.py]"]
  node_office["Office extraction<br/>[office.py]"]
  node_spreadsheets["Spreadsheet extraction<br/>[spreadsheet.py]"]
  node_text_files["Text extraction<br/>[text.py]"]
  node_image_ocr["Image OCR<br/>[image.py]"]
  node_chunking["Text chunking<br/>[chunking.py]"]
  node_indexer["Document indexing<br/>[indexer.py]"]
end

subgraph group_intelligence["AI capabilities"]
  node_rag["Hybrid retrieval<br/>[rag_service.py]"]
  node_llm["Language model client<br/>[llm.py]"]
  node_summaries["Summaries and study tools<br/>[summary.py]"]
  node_suggestions["Question suggestions<br/>[suggest.py]"]
  node_web_research["Web research<br/>[web_research.py]"]
  node_image_generation["Image generation<br/>[image_gen.py]"]
  node_answer_cache["Answer cache<br/>[answer_cache.py]"]
end

subgraph group_state["Local state and engines"]
  node_database[("SQLite database<br/>[database.py]")]
  node_document_model["Document records<br/>[document.py]"]
  node_chunk_model["Chunk records<br/>[chunk.py]"]
  node_chat_model["Chat records<br/>[chat.py]"]
end

node_browser(("User"))
node_local_llm{{"Local model server"}}
node_web_sources{{"Public web sources"}}
node_image_engine{{"Image engine"}}

node_browser -->|"uses"| node_app
node_app -->|"requests through"| node_api_client
node_api_client -->|"calls"| node_backend_api
node_backend_api -->|"checks access"| node_auth
node_backend_api -->|"processes uploads"| node_extractor
node_extractor -->|"dispatches"| node_pdf
node_extractor -->|"dispatches"| node_office
node_extractor -->|"dispatches"| node_spreadsheets
node_extractor -->|"dispatches"| node_text_files
node_extractor -->|"dispatches"| node_image_ocr
node_backend_api -.->|"chunks text"| node_chunking
node_indexer -->|"uses"| node_chunking
node_backend_api -->|"indexes documents"| node_indexer
node_backend_api -->|"answers questions"| node_rag
node_rag -->|"embeds and generates"| node_llm
node_backend_api -->|"requests summaries"| node_summaries
node_backend_api -.->|"requests suggestions"| node_suggestions
node_backend_api -->|"routes web mode"| node_web_research
node_web_research -->|"writes cited answers"| node_llm
node_web_research -->|"researches"| node_web_sources
node_backend_api -->|"generates images"| node_image_generation
node_image_generation -->|"runs diffusion or API"| node_image_engine
node_backend_api -.->|"uses cache"| node_answer_cache
node_backend_api -->|"reads and writes"| node_database
node_database -->|"registers table"| node_document_model
node_database -->|"registers table"| node_chunk_model
node_database -->|"registers table"| node_chat_model
node_rag -->|"loads document data"| node_database
node_rag -->|"searches chunks"| node_chunk_model
node_llm -->|"sends model requests"| node_local_llm
node_summaries -->|"generates study output"| node_llm

click node_app "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/frontend/src/App.jsx"
click node_api_client "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/frontend/src/api.js"
click node_backend_api "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/main.py"
click node_auth "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/core/security.py"
click node_extractor "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/extraction/extractor.py"
click node_pdf "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/extraction/pdf.py"
click node_office "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/extraction/office.py"
click node_spreadsheets "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/extraction/spreadsheet.py"
click node_text_files "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/extraction/text.py"
click node_image_ocr "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/extraction/image.py"
click node_chunking "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/chunking.py"
click node_indexer "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/indexer.py"
click node_rag "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/rag_service.py"
click node_llm "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/llm.py"
click node_summaries "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/summary.py"
click node_suggestions "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/suggest.py"
click node_web_research "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/web_research.py"
click node_image_generation "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/image_gen.py"
click node_answer_cache "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/answer_cache.py"
click node_database "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/db/database.py"
click node_document_model "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/models/document.py"
click node_chunk_model "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/models/chunk.py"
click node_chat_model "https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/models/chat.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_api_client,node_browser toneBlue
class node_backend_api,node_auth toneAmber
class node_extractor,node_pdf,node_office,node_spreadsheets,node_text_files,node_image_ocr,node_chunking,node_indexer,node_local_llm toneMint
class node_rag,node_llm,node_summaries,node_suggestions,node_web_research,node_image_generation,node_answer_cache toneRose
class node_database,node_document_model,node_chunk_model,node_chat_model,node_web_sources,node_image_engine toneIndigo
```

## Components

### User interface

- [Chat interface](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/frontend/src/api.js): `frontend/src/api.js`

### Backend API

- [API routes](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/main.py): `backend/app/main.py`
- [Access control](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/core/security.py): `backend/app/core/security.py`

### Document ingestion

- [File extraction](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/extraction/extractor.py): `backend/app/services/extraction/extractor.py`
- [PDF and OCR](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/extraction/pdf.py): `backend/app/services/extraction/pdf.py`
- [Office extraction](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/extraction/office.py): `backend/app/services/extraction/office.py`
- [Spreadsheet extraction](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/extraction/spreadsheet.py): `backend/app/services/extraction/spreadsheet.py`
- [Text extraction](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/extraction/text.py): `backend/app/services/extraction/text.py`
- [Image OCR](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/extraction/image.py): `backend/app/services/extraction/image.py`
- [Text chunking](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/chunking.py): `backend/app/services/chunking.py`
- [Document indexing](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/indexer.py): `backend/app/services/indexer.py`

### AI capabilities

- [Hybrid retrieval](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/rag_service.py): `backend/app/services/rag_service.py`
- [Language model client](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/llm.py): `backend/app/services/llm.py`
- [Summaries and study tools](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/summary.py): `backend/app/services/summary.py`
- [Question suggestions](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/suggest.py): `backend/app/services/suggest.py`
- [Web research](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/web_research.py): `backend/app/services/web_research.py`
- [Image generation](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/image_gen.py): `backend/app/services/image_gen.py`
- [Answer cache](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/services/answer_cache.py): `backend/app/services/answer_cache.py`

### Local state and engines

- [SQLite database](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/db/database.py): `backend/app/db/database.py`
- [Document records](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/models/document.py): `backend/app/models/document.py`
- [Chunk records](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/models/chunk.py): `backend/app/models/chunk.py`
- [Chat records](https://github.com/ramakrishna2006/lumina-local-pdf--summarizer/blob/main/backend/app/models/chat.py): `backend/app/models/chat.py`

### Other components

- **User**
- **Local model server**
- **Public web sources**
- **Image engine**

## Connections

- User → Chat interface: uses (evidence: `README.md`)
- Chat interface → API client: requests through (evidence: `frontend/src/App.jsx`)
- API client → API routes: calls (evidence: `README.md`)
- API routes → Access control: checks access (evidence: `backend/app/main.py`)
- API routes → File extraction: processes uploads (evidence: `backend/app/main.py`)
- File extraction → PDF and OCR: dispatches (evidence: `backend/app/services/extraction/extractor.py`)
- File extraction → Office extraction: dispatches (evidence: `backend/app/services/extraction/extractor.py`)
- File extraction → Spreadsheet extraction: dispatches (evidence: `backend/app/services/extraction/extractor.py`)
- File extraction → Text extraction: dispatches (evidence: `backend/app/services/extraction/extractor.py`)
- File extraction → Image OCR: dispatches (evidence: `backend/app/services/extraction/extractor.py`)
- API routes → Text chunking: chunks text
- Document indexing → Text chunking: uses (evidence: `backend/app/services/indexer.py`)
- API routes → Document indexing: indexes documents (evidence: `backend/app/main.py`)
- API routes → Hybrid retrieval: answers questions (evidence: `backend/app/main.py`)
- Hybrid retrieval → Language model client: embeds and generates (evidence: `backend/app/services/rag_service.py`)
- API routes → Summaries and study tools: requests summaries (evidence: `backend/app/main.py`)
- API routes → Question suggestions: requests suggestions (evidence: `backend/app/main.py`)
- API routes → Web research: routes web mode (evidence: `README.md`)
- Web research → Language model client: writes cited answers (evidence: `backend/app/services/web_research.py`)
- Web research → Public web sources: researches (evidence: `README.md`)
- API routes → Image generation: generates images (evidence: `backend/app/main.py`)
- Image generation → Image engine: runs diffusion or API (evidence: `README.md`)
- API routes → Answer cache: uses cache (evidence: `backend/app/main.py`)
- API routes → SQLite database: reads and writes (evidence: `backend/app/main.py`)
- SQLite database → Document records: registers table (evidence: `backend/app/db/database.py`)
- SQLite database → Chunk records: registers table (evidence: `backend/app/db/database.py`)
- SQLite database → Chat records: registers table (evidence: `backend/app/db/database.py`)
- Hybrid retrieval → SQLite database: loads document data (evidence: `backend/app/services/rag_service.py`)
- Hybrid retrieval → Chunk records: searches chunks (evidence: `backend/app/services/rag_service.py`)
- Language model client → Local model server: sends model requests (evidence: `README.md`)
- Summaries and study tools → Language model client: generates study output (evidence: `backend/app/services/summary.py`)
