Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

docs: Add architecture diagrams to README (#1512)

LearningCircuit18d05b145be0
diff --git a/README.md b/README.md
index f203453da8..c3bad58a21 100644
--- a/README.md
+++ b/README.md
@@ -37,38 +37,52 @@
## 🚀 What is Local Deep Research?
-LDR is an AI research assistant that performs systematic research by:
+AI research assistant you control. Run locally for privacy, use any LLM, track every cost, build your own searchable knowledge base. Unlike ChatGPT or Perplexity—you own your data and see exactly how it works.
-- **Breaking down complex questions** into focused sub-queries
-- **Searching multiple sources** in parallel (web, academic papers, local documents)
-- **Verifying information** across sources for accuracy
-- **Creating comprehensive reports** with proper citations
+## ⚡ Quick Start
-It aims to help researchers, students, and professionals find accurate information quickly while maintaining transparency about sources.
+**Docker (one command):**
+```bash
+curl -O https://raw.githubusercontent.com/LearningCircuit/local-deep-research/main/docker-compose.yml && docker compose up -d
+```
-## 🎯 Why Choose LDR?
+Open http://localhost:5000 after ~30 seconds. [More install options →](#-installation-options)
-- **Privacy-Focused**: Run entirely locally with Ollama + SearXNG
-- **Flexible**: Use any LLM, any search engine, any vector store
-- **Comprehensive**: Multiple research modes from quick summaries to detailed reports
-- **Transparent**: Track costs and performance with built-in analytics
-- **Open Source**: MIT licensed with an active community
+## 🏗️ How It Works
-## 🔒 Security & Privacy
+### Research
-<div align="center">
+You ask a complex question. LDR:
+- Does the research for you automatically
+- Searches across web, academic papers, and your own documents
+- Synthesizes everything into a report with proper citations
-[![AES-256](https://img.shields.io/badge/Encryption-AES--256-green?style=for-the-badge&logo=lock&logoColor=white)](docs/SQLCIPHER_INSTALL.md)
-[![Per-User DB](https://img.shields.io/badge/Security-Per--User_Isolated_DB-purple?style=for-the-badge&logo=shield&logoColor=white)](docs/MIGRATION_GUIDE_v1.md)
-[![Zero Knowledge](https://img.shields.io/badge/Privacy-Zero_Knowledge-blue?style=for-the-badge&logo=eye-slash&logoColor=white)](docs/SQLCIPHER_INSTALL.md)
+Choose from 20+ research strategies for quick facts, deep analysis, or academic research.
-</div>
+### Build Your Knowledge Base
+
+```mermaid
+flowchart LR
+ R[Research] --> D[Download Sources]
+ D --> L[(Library)]
+ L --> I[Index & Embed]
+ I --> S[Search Your Docs]
+ S -.-> R
+```
+
+Every research session finds valuable sources. Download them directly into your encrypted library—academic papers from ArXiv, PubMed articles, web pages. LDR extracts text, indexes everything, and makes it searchable. Next time you research, ask questions across your own documents and the live web together. Your knowledge compounds over time.
-- **Signal-level encryption**: SQLCipher with AES-256 (same technology used by Signal messenger) protects all user data at rest
-- **Per-user isolated databases**: Each user has their own encrypted database - complete data isolation
-- **Zero-knowledge architecture**: No password recovery mechanism ensures true privacy
-- **Advanced key derivation**: PBKDF2-SHA512 with 256,000 iterations prevents brute-force attacks
-- **Data integrity**: HMAC-SHA512 verification prevents tampering
+### Security
+
+```mermaid
+flowchart LR
+ U1[User A] --> D1[(Encrypted DB)]
+ U2[User B] --> D2[(Encrypted DB)]
+```
+
+Your data stays yours. Each user gets their own isolated SQLCipher database encrypted with AES-256 (Signal-level security). No password recovery means true zero-knowledge—even server admins can't read your data. Run fully local with Ollama + SearXNG and nothing ever leaves your machine.
+
+[Detailed Architecture →](docs/architecture.md)
## 📊 Performance
@@ -126,7 +140,7 @@ It aims to help researchers, students, and professionals find accurate informati
[Full Search Engines Guide →](docs/search-engines.md)
-## ⚡ Quick Start
+## 📦 Installation Options
### Option 1: Docker
diff --git a/docs/architecture.md b/docs/architecture.md
new file mode 100644
index 0000000000..0fa7c40736
--- /dev/null
+++ b/docs/architecture.md
@@ -0,0 +1,331 @@
+# Architecture Overview
+
+This document provides detailed technical diagrams of Local Deep Research's architecture.
+
+## System Architecture
+
+```mermaid
+flowchart TB
+ subgraph USER["👤 User Interface"]
+ WEB[Web Browser<br/>localhost:5000]
+ end
+
+ subgraph FLASK["🌐 Flask Backend"]
+ API[REST API + WebSocket]
+ AUTH[Authentication<br/>CSRF Protection]
+ ROUTES[Research Routes]
+ end
+
+ subgraph RESEARCH["🔬 Research Engine"]
+ STRAT[Strategy Selector<br/>20+ strategies]
+ QGEN[Question Generator]
+ EXEC[Search Executor]
+ SYNTH[Report Synthesizer]
+ end
+
+ subgraph LLM["🤖 LLM Providers"]
+ direction TB
+ LOCAL_LLM[/"🏠 Local LLMs"\]
+ OLLAMA[Ollama]
+ LMSTUDIO[LM Studio]
+ CLOUD_LLM[/"☁️ Cloud LLMs"\]
+ OPENAI[OpenAI]
+ ANTHROPIC[Anthropic]
+ GEMINI[Google Gemini]
+ OPENROUTER[OpenRouter<br/>100+ models]
+ end
+
+ subgraph SEARCH["🔍 Search Engines"]
+ direction TB
+ LOCAL_SEARCH[/"🏠 Local Search"\]
+ SEARXNG[SearXNG]
+ ELASTIC[Elasticsearch]
+ LIBRARY[Document Library]
+ WEB_SEARCH[/"🌐 Web Search"\]
+ TAVILY[Tavily]
+ BRAVE[Brave]
+ DDG[DuckDuckGo]
+ ACADEMIC[/"📚 Academic"\]
+ ARXIV[ArXiv]
+ PUBMED[PubMed]
+ SEMANTIC[Semantic Scholar]
+ end
+
+ subgraph STORAGE["💾 Storage Layer"]
+ SQLCIPHER[(SQLCipher DB<br/>AES-256 Encrypted)]
+ VECTORS[(Vector Store<br/>Embeddings)]
+ FILES[(File Storage<br/>PDFs & Docs)]
+ end
+
+ subgraph OUTPUT["📄 Output"]
+ MD[Markdown]
+ PDF[PDF Export]
+ LATEX[LaTeX]
+ QUARTO[Quarto]
+ RIS[RIS/BibTeX]
+ end
+
+ WEB <--> API
+ API --> AUTH
+ AUTH --> ROUTES
+ ROUTES --> STRAT
+
+ STRAT --> QGEN
+ QGEN --> EXEC
+ EXEC --> SYNTH
+
+ EXEC <--> OLLAMA & LMSTUDIO
+ EXEC <--> OPENAI & ANTHROPIC & GEMINI & OPENROUTER
+
+ EXEC <--> SEARXNG & ELASTIC & LIBRARY
+ EXEC <--> TAVILY & BRAVE & DDG
+ EXEC <--> ARXIV & PUBMED & SEMANTIC
+
+ SYNTH --> SQLCIPHER
+ LIBRARY <--> VECTORS
+ LIBRARY <--> FILES
+
+ SYNTH --> MD & PDF & LATEX & QUARTO & RIS
+
+ LOCAL_LLM ~~~ OLLAMA
+ CLOUD_LLM ~~~ OPENAI
+ LOCAL_SEARCH ~~~ SEARXNG
+ WEB_SEARCH ~~~ TAVILY
+ ACADEMIC ~~~ ARXIV
+
+ style USER fill:#e1f5fe
+ style FLASK fill:#fff3e0
+ style RESEARCH fill:#f3e5f5
+ style LLM fill:#e8f5e9
+ style SEARCH fill:#fce4ec
+ style STORAGE fill:#fff8e1
+ style OUTPUT fill:#e0f2f1
+```
+
+## Research Flow
+
+```mermaid
+flowchart LR
+ subgraph INPUT["1️⃣ Input"]
+ Q[Research Query]
+ end
+
+ subgraph ITERATE["2️⃣ Iterative Research"]
+ direction TB
+ GEN[Generate<br/>Questions]
+ SEARCH[Parallel<br/>Search]
+ ANALYZE[Analyze<br/>Results]
+ GEN --> SEARCH --> ANALYZE
+ ANALYZE -.->|"Need more info?"| GEN
+ end
+
+ subgraph SYNTHESIZE["3️⃣ Synthesis"]
+ REPORT[Generate<br/>Report]
+ CITE[Add<br/>Citations]
+ REPORT --> CITE
+ end
+
+ subgraph OUTPUT["4️⃣ Output"]
+ RESULT[Final Report<br/>with Sources]
+ end
+
+ Q --> GEN
+ ANALYZE --> REPORT
+ CITE --> RESULT
+
+ style INPUT fill:#e3f2fd
+ style ITERATE fill:#f3e5f5
+ style SYNTHESIZE fill:#e8f5e9
+ style OUTPUT fill:#fff3e0
+```
+
+## Deployment Options
+
+```mermaid
+flowchart TB
+ subgraph FULL_LOCAL["🏠 Fully Local (Maximum Privacy)"]
+ direction LR
+ L_LDR[LDR] <--> L_OLLAMA[Ollama]
+ L_LDR <--> L_SEARX[SearXNG]
+ L_LDR <--> L_DB[(Encrypted DB)]
+ end
+
+ subgraph HYBRID["⚡ Hybrid (Balanced)"]
+ direction LR
+ H_LDR[LDR] <--> H_OLLAMA[Ollama]
+ H_LDR <-->|"Web Search"| H_CLOUD[Cloud APIs]
+ H_LDR <--> H_DB[(Encrypted DB)]
+ end
+
+ subgraph CLOUD["☁️ Cloud-Powered (Maximum Speed)"]
+ direction LR
+ C_LDR[LDR] <--> C_OPENAI[OpenAI/Claude]
+ C_LDR <--> C_TAVILY[Tavily/Brave]
+ C_LDR <--> C_DB[(Encrypted DB)]
+ end
+
+ style FULL_LOCAL fill:#e8f5e9
+ style HYBRID fill:#fff3e0
+ style CLOUD fill:#e3f2fd
+```
+
+## Feature Map
+
+```mermaid
+mindmap
+ root((Local Deep<br/>Research))
+ Research
+ Quick Summary
+ Detailed Reports
+ Follow-up Questions
+ 20+ Strategies
+ Search Sources
+ Web Search
+ SearXNG
+ Tavily
+ Brave
+ DuckDuckGo
+ Academic
+ ArXiv
+ PubMed
+ Semantic Scholar
+ Local
+ Document Library
+ Collections
+ Elasticsearch
+ LLM Support
+ Local
+ Ollama
+ LM Studio
+ Cloud
+ OpenAI
+ Anthropic
+ Google
+ OpenRouter
+ Output
+ Markdown
+ PDF
+ LaTeX
+ Quarto
+ RIS/BibTeX
+ Features
+ News Subscriptions
+ Cost Analytics
+ Benchmarking
+ RAG Search
+ Per-User Encryption
+```
+
+## Component Details
+
+### LLM Providers
+
+| Provider | Type | Description |
+|----------|------|-------------|
+| Ollama | Local | Self-hosted open-source models |
+| LM Studio | Local | Desktop app for local models |
+| OpenAI | Cloud | GPT-4, GPT-3.5 |
+| Anthropic | Cloud | Claude 3 family |
+| Google | Cloud | Gemini models |
+| OpenRouter | Cloud | 100+ models via single API |
+
+### Search Engines
+
+| Engine | Type | Best For |
+|--------|------|----------|
+| SearXNG | Local/Self-hosted | Privacy, aggregated results |
+| Tavily | Cloud | AI-optimized search |
+| ArXiv | Academic | Physics, CS, Math papers |
+| PubMed | Academic | Biomedical research |
+| Semantic Scholar | Academic | Cross-discipline papers |
+| Wikipedia | Knowledge | General knowledge |
+| Your Documents | Local | Private document search |
+
+### Output Formats
+
+| Format | Use Case |
+|--------|----------|
+| Markdown | Default, web display |
+| PDF | Sharing, printing |
+| LaTeX | Academic papers |
+| Quarto | Reproducible documents |
+| RIS/BibTeX | Reference managers |
+
+## Knowledge Loop: Research → Library → Future Research
+
+One of LDR's powerful features is the ability to build a personal knowledge base that improves future research.
+
+```mermaid
+flowchart TB
+ subgraph RESEARCH["1️⃣ Research"]
+ Q[Your Question] --> Engine[Research Engine]
+ Engine --> Results[Results + Sources]
+ end
+
+ subgraph DOWNLOAD["2️⃣ Download"]
+ Results --> Track[Track Sources]
+ Track --> Queue[Download Queue]
+ Queue --> Extract[Download & Extract Text]
+ end
+
+ subgraph LIBRARY["3️⃣ Library"]
+ Extract --> Store[(Document Storage)]
+ Store --> Organize[Organize into Collections]
+ end
+
+ subgraph INDEX["4️⃣ Index"]
+ Organize --> Chunk[Chunk Documents]
+ Chunk --> Embed[Generate Embeddings]
+ Embed --> FAISS[(Vector Index)]
+ end
+
+ subgraph REUSE["5️⃣ Reuse"]
+ FAISS --> SearchEngine[Collection as Search Engine]
+ SearchEngine --> Q
+ end
+
+ style RESEARCH fill:#e3f2fd
+ style DOWNLOAD fill:#fff3e0
+ style LIBRARY fill:#e8f5e9
+ style INDEX fill:#f3e5f5
+ style REUSE fill:#fce4ec
+```
+
+### How It Works
+
+1. **Research Completes** → Sources are tracked in `ResearchResource` table
+2. **Download Sources** → Click "Get All Research PDFs" to queue downloads
+ - Smart downloaders for ArXiv, PubMed, Semantic Scholar, etc.
+ - Automatic text extraction from PDFs
+3. **Build Library** → Documents stored in encrypted database
+ - Deduplication via content hash
+ - Multiple storage modes: database (encrypted), filesystem, text-only
+4. **Create Collections** → Organize documents by topic/project
+ - Each collection can have different embedding settings
+ - Documents can belong to multiple collections
+5. **Index for Search** → Generate vector embeddings
+ - Configurable chunk size and overlap
+ - FAISS index for fast similarity search
+6. **Use in Future Research** → Select collection as search engine
+ - RAG search finds relevant passages
+ - Results cite back to your documents
+
+### Key Components
+
+| Component | Purpose |
+|-----------|---------|
+| `DownloadService` | Manages PDF downloads with source-specific strategies |
+| `LibraryService` | Queries and manages document library |
+| `LibraryRAGService` | Creates vector indices for semantic search |
+| `CollectionSearchEngine` | Searches collections using RAG |
+| `Document` | Stores text content, metadata, file references |
+| `DocumentChunk` | Stores indexed text chunks with embeddings |
+| `Collection` | Groups documents with shared embedding settings |
+
+### Storage Options
+
+| Mode | Security | Use Case |
+|------|----------|----------|
+| Database | AES-256 encrypted | Default, maximum security |
+| Filesystem | Unencrypted | Need external tool access |
+| Text Only | Encrypted text, no PDFs | Minimal storage |