Chat with your documents using AI โข Get answers with source citations โข Multi-provider fallback
Features โข Quick Start โข Documentation โข Architecture โข Contributing
- Overview
- Quick Start
- Features
- Architecture
- Project Structure
- How It Works
- Configuration
- Usage
- Documentation
- Tech Stack
- Development
DocuMind is a production-ready Retrieval-Augmented Generation (RAG) system that transforms how you interact with your documents. Upload PDFs, Word documents, PowerPoint presentations, or text files, and ask questions in natural languageโthe AI will provide accurate answers with source citations from your documents.
|
๐ฏ Intelligent & Accurate
|
๐ Production-Ready
|
|
๐ Universal Document Support
|
๐ ๏ธ Developer-Friendly
|
Get up and running in 3 minutes:
- Python 3.9 or higher
- At least one API key (Groq recommendedโit's FREE!)
- 4GB RAM minimum
# 1. Clone the repository
git clone https://github.com/Baisampayan1324/DocuMind.git
cd DocuMind
# 2. Create virtual environment (recommended)
python -m venv .venv
# Activate venv:
# Windows PowerShell:
.venv\Scripts\Activate.ps1
# Windows CMD:
.venv\Scripts\activate.bat
# Linux/macOS:
source .venv/bin/activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Configure API keys
copy .env.template .env # Windows
# OR
cp .env.template .env # Linux/macOS
# Edit .env and add at least one API key๐ Groq (Recommended - FREE & FAST)
- Visit console.groq.com
- Sign up (no credit card required)
- Navigate to API Keys
- Create new key
- Add to
.env:GROQ_API_KEY=gsk_...
Why Groq? โก Lightning fast โข ๐ Completely free โข ๐ค Llama 3.1 models
๐ OpenRouter (Alternative - FREE tier)
- Visit openrouter.ai
- Sign up for account
- Go to Keys section
- Create API key
- Add to
.env:OPENROUTER_API_KEY=sk-or-...
Why OpenRouter? ๐ฏ 100+ models โข ๐ Free tier available โข ๐ฐ Pay-per-use
๐ค OpenAI (Fallback - PAID)
- Visit platform.openai.com
- Sign up and add payment method
- Navigate to API Keys
- Create secret key
- Add to
.env:OPENAI_API_KEY=sk-...
Why OpenAI? ๐ Highest quality โข ๐ง GPT-4 available โข ๐ณ Requires payment
python main.pyThat's it! The launcher will:
- โ Check dependencies
- โ Validate configuration
- โ Start backend API (port 8000)
- โ Start frontend UI (port 8501)
- โ Open your browser automatically
๐ Access the app: http://localhost:8501
- Upload Documents: Click "Browse files" โ Select PDF/DOCX/PPTX/TXT โ Click "Upload"
- Ask Questions: Type your question in the chat input โ Press Enter
- View Sources: Expand the "๐ Sources" section to see citations
- Check Analytics: Run
streamlit run frontend/admin.py --server.port 8502for dashboard
|
Groq
|
OpenRouter
|
OpenAI
|
Automatic Failover: If one provider fails, DocuMind seamlessly switches to the nextโensuring 99.9% uptime.
| Format | Support | Features |
|---|---|---|
| โ Full | Text extraction, multi-page, embedded fonts | |
| DOCX | โ Full | Styles, tables, headers/footers |
| PPTX | โ Full | Slide text, notes, shapes |
| TXT | โ Full | UTF-8, multiple encodings |
Smart Chunking: Documents are split into 1000-character chunks with 200-character overlap to preserve context while optimizing retrieval.
graph LR
A[Question] --> B[Embed Query]
B --> C[FAISS Search]
C --> D[Top 4 Chunks]
D --> E[LLM Processing]
E --> F[Answer + Citations]
- Semantic Search: FAISS vector database finds contextually relevant chunks
- HuggingFace Embeddings:
all-MiniLM-L6-v2model (384 dimensions) - Top-K Retrieval: Returns 4 most relevant passages by default
- Source Attribution: Every answer links back to source documents
Built-in admin dashboard provides:
- ๐ Conversation history with full search
- ๐ Provider usage statistics (pie charts)
- ๐ค Model distribution analysis
- ๐ Time-based filtering
- ๐ฅ CSV export for external analysis
- ๐ Question/answer search
Access: streamlit run frontend/admin.py --server.port 8502
- REST API: FastAPI with automatic OpenAPI docs (
/docs,/redoc) - Async Support: Non-blocking operations for high concurrency
- Type Safety: Pydantic models for request/response validation
- Hot Reload: Development mode with auto-restart on changes
- Error Handling: Comprehensive error messages and logging
- CORS Enabled: Ready for frontend integration
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ค User Interface Layer โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ
โ โ ๐ฌ Main Chat โ โ ๐ Analytics โ โ
โ โ (Port 8501) โ โ (Port 8502) โ โ
โ โโโโโโโโโโฌโโโโโโโโโโ โโโโโโโโโโฌโโโโโโโโโ โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโ
โ โ
โ REST API (HTTP) โ
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ๏ธ FastAPI Backend (Port 8000) โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ๐ API Routes โ โ
โ โ /upload โข /ask โข /history โข /stats โข /health โข /docs โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ๐ง RAG Engine (Core Logic) โ โ
โ โ โ โ
โ โ โโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ โ
โ โ โ Document โโโโถโ FAISS โโโโถโ LLM Multi- โ โ โ
โ โ โ Loader โ โ Vector โ โ Provider โ โ โ
โ โ โ โ โ Store โ โ Manager โ โ โ
โ โ โโโโโโโโโโโโ โโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ๐พ Data Persistence โ โ
โ โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ โ
โ โ โ conversation_ โ โ faiss_index/ โ โ โ
โ โ โ history.db โ โ (Embeddings) โ โ โ
โ โ โ (SQLite) โ โ โ โ โ
โ โ โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ค Document Upload Flow
sequenceDiagram
participant U as User
participant F as Frontend
participant A as API
participant D as DocLoader
participant V as FAISS
U->>F: Upload PDF/DOCX
F->>A: POST /upload (multipart)
A->>D: Load & Parse Document
D->>D: Extract Text
D->>D: Clean & Chunk (1000 chars)
D->>V: Generate Embeddings
V->>V: Store Vectors
V-->>A: Success
A-->>F: Files Processed
F-->>U: Upload Complete โ
๐ฌ Question-Answer Flow
sequenceDiagram
participant U as User
participant F as Frontend
participant A as API
participant R as RAG Engine
participant V as FAISS
participant L as LLM Provider
participant DB as SQLite
U->>F: Ask Question
F->>A: POST /ask
A->>R: Process Query
R->>V: Embed & Search
V-->>R: Top 4 Chunks
R->>L: Generate Answer (Groq)
alt Groq Success
L-->>R: Response
else Groq Fails
R->>L: Fallback (OpenRouter)
alt OpenRouter Success
L-->>R: Response
else OpenRouter Fails
R->>L: Fallback (OpenAI)
L-->>R: Response
end
end
R->>DB: Save Conversation
R-->>A: Answer + Sources
A-->>F: JSON Response
F-->>U: Display Answer โ
DocuMind/
โ
โโโ ๐ main.py # โญ START HERE - Unified launcher
โโโ ๐ฆ requirements.txt # Python dependencies
โโโ ๐ .env # API keys (create from template)
โโโ ๐ .env.template # Configuration template
โโโ ๐ .gitignore # Git ignore rules
โโโ ๐ LICENSE # MIT License
โ
โโโ โ๏ธ backend/ # FastAPI Backend (Port 8000)
โ โโโ ๐ README.md # ๐ Detailed backend documentation
โ โโโ ๐ api.py # REST API endpoints (8 routes)
โ โโโ ๐ง rag_engine.py # RAG pipeline orchestration
โ โโโ ๐ค llm_provider.py # Multi-LLM manager
โ โโโ ๐ doc_loader.py # Document processor
โ โโโ ๐พ history_db.py # SQLite operations
โ โโโ โ๏ธ config.py # Configuration loader
โ โโโ ๐๏ธ models.py # Database models
โ โ
โ โโโ ๏ฟฝ data/ # Runtime data (auto-generated)
โ โโโ conversation_history.db # SQLite database
โ โโโ faiss_index/ # Vector embeddings
โ โโโ index.faiss
โ โโโ index.pkl
โ
โโโ ๐ฅ๏ธ frontend/ # Streamlit UI
โ โโโ ๐ README.md # ๐ Detailed frontend documentation
โ โโโ ๐ฌ app_api.py # Main chat interface (Port 8501)
โ โโโ ๐ admin.py # Analytics dashboard (Port 8502)
โ
โโโ ๐ docs/ # Documentation
โ โโโ ๐ QUICK_START.md
โ โโโ ๐๏ธ ARCHITECTURE.md
โ โโโ ๐ FASTAPI_QUICK_REFERENCE.md
โ โโโ ๐ข DEPLOYMENT.md
โ โโโ โ๏ธ FASTAPI_SETUP_GUIDE.md
โ
โโโ ๐งช .github/ # GitHub Actions
โ โโโ workflows/
โ โโโ python-ci.yml # CI/CD pipeline
โ
โโโ ๐ฆ archive/ # Historical files
โโโ deprecated/
โโโ phase2_planning/
โโโ implementation/
โโโ fixes/
โโโ test/
| File | Purpose | Priority |
|---|---|---|
main.py |
Unified launcher - Start backend + frontend | โญโญโญ |
backend/README.md |
Complete backend architecture docs | โญโญโญ |
frontend/README.md |
Complete frontend architecture docs | โญโญโญ |
backend/api.py |
REST API endpoint definitions | โญโญ |
backend/rag_engine.py |
Core RAG pipeline logic | โญโญ |
backend/config.py |
Environment configuration | โญโญ |
.env |
API keys and secrets | โญโญโญ |
| File | Purpose | When to Use |
|---|---|---|
main.py |
Unified launcher - Starts both backend + frontend | Run this to start everything |
backend/README.md |
Detailed backend architecture - How RAG works, data flow, API details | Read this to understand backend |
frontend/README.md |
Detailed frontend architecture - UI components, API integration | Read this to understand frontend |
backend/config.py |
Configuration manager - Loads .env, validates settings | Modify to change defaults |
backend/data/conversation_history.db |
SQLite database - All conversation history | Query this for analytics |
backend/data/faiss_index/ |
Vector database - Document embeddings | Delete to reindex documents |
.env |
Sensitive config - API keys, secrets | Create from .env.template |
User Perspective:
- Upload PDF/DOCX/PPTX/TXT files via Streamlit UI
- Click "Upload Documents"
- See success message with file count
Behind the Scenes:
# 1. Frontend sends files to backend
POST http://localhost:8000/upload
Content-Type: multipart/form-data
files: [file1.pdf, file2.docx]
# 2. Backend processes each file
for file in uploaded_files:
# a. Save to temp folder
temp_path = save_temp_file(file)
# b. Load document (detect format, extract text)
text = UniversalDocLoader.load_document(temp_path)
# c. Clean text (remove extra spaces, fix line breaks)
clean_text = UniversalDocLoader.clean_text(text)
# d. Chunk text (1000 chars, 200 overlap)
chunks = UniversalDocLoader.chunk_text(clean_text, metadata={"source": file.name})
# e. Generate embeddings (HuggingFace model)
embeddings = HuggingFaceEmbeddings("all-MiniLM-L6-v2")
vectors = embeddings.embed_documents([chunk.page_content for chunk in chunks])
# f. Store in FAISS vector database
vectorstore.add_documents(chunks)
# g. Save FAISS index to disk (if PERSIST_FAISS=true)
vectorstore.save_local("backend/data/faiss_index")
# h. Delete temp file
os.remove(temp_path)
# 3. Return success response
{"status": "success", "files_processed": ["file1.pdf", "file2.docx"]}Why Chunking?
- LLMs have token limits (can't process entire documents)
- Smaller chunks = more precise retrieval
- Overlap ensures context isn't lost at chunk boundaries
User Perspective:
- Type question in chat input
- Press Enter
- See AI answer with source citations
Behind the Scenes:
# 1. Frontend sends question to backend
POST http://localhost:8000/ask
{
"question": "What is the main topic of the document?",
"provider": "groq" # optional
}
# 2. Backend RAG pipeline
def query_async(question):
# a. Embed the question
question_vector = embeddings.embed_query(question)
# b. Search FAISS for similar chunks (Top 4)
similar_chunks = vectorstore.similarity_search(question, k=4)
# c. Build prompt with context
context = "\n\n".join([chunk.page_content for chunk in similar_chunks])
prompt = f"""Based on the following context, answer the question.
Context:
{context}
Question: {question}
Answer:"""
# d. Call LLM (try Groq, fallback to OpenRouter, then OpenAI)
try:
llm = llm_provider.get_llm("groq")
response = llm.invoke(prompt)
except:
try:
llm = llm_provider.get_llm("openrouter")
response = llm.invoke(prompt)
except:
llm = llm_provider.get_llm("openai")
response = llm.invoke(prompt)
# e. Extract sources from chunks
sources = [
{
"source": chunk.metadata["source"],
"chunk_id": chunk.metadata["chunk_id"],
"content": chunk.page_content[:200] # First 200 chars
}
for chunk in similar_chunks
]
# f. Save to database
history_db.save_conversation(
question=question,
answer=response.content,
sources=sources,
provider_used="groq",
model_used="llama-3.1-8b-instant"
)
# g. Return response
return {
"answer": response.content,
"sources": sources,
"provider_used": "groq",
"model_used": "llama-3.1-8b-instant"
}
# 3. Frontend displays answer with sourcesWhy Multi-LLM?
- Reliability: If one provider is down, others work
- Cost Optimization: Use free Groq first, paid OpenAI as fallback
- Flexibility: Easy to switch providers without code changes
Why SQLite?
- โ No separate database server - Embedded in application
- โ ACID compliant - Transactional integrity
- โ Easy to query - Standard SQL
- โ Perfect for analytics - Admin dashboard queries this
- โ Portable - Single file, easy to backup
Schema:
CREATE TABLE conversations (
id INTEGER PRIMARY KEY AUTOINCREMENT,
timestamp TEXT NOT NULL,
question TEXT NOT NULL,
answer TEXT NOT NULL,
sources TEXT, -- JSON array
provider_used TEXT,
model_used TEXT
);Location: backend/data/conversation_history.db
Queried By: Admin dashboard for analytics
Create .env file from template:
cp .env.template .envRequired Settings:
# API Keys - At least ONE required
GROQ_API_KEY=gsk_xxxxxxxxxxxxx # Get from https://console.groq.com
OPENROUTER_API_KEY=sk-or-xxxxxxxxxxxxx # Get from https://openrouter.ai
OPENAI_API_KEY=sk-xxxxxxxxxxxxx # Get from https://platform.openai.comOptional Settings:
# Model Selection (defaults shown)
GROQ_MODEL=llama-3.1-8b-instant
OPENROUTER_MODEL=meta-llama/llama-3.3-8b-instruct:free
OPENAI_MODEL=gpt-4o-mini
# Chunking Parameters
CHUNK_SIZE=1000 # Characters per chunk
CHUNK_OVERLAP=200 # Overlap between chunks
# Retrieval
TOP_K_CHUNKS=4 # Number of chunks to retrieve
# Embedding Model
EMBEDDING_MODEL=sentence-transformers/all-MiniLM-L6-v2
# Storage Paths
FAISS_PERSIST_DIR=data/faiss_index
HISTORY_DB_PATH=data/conversation_history.db
# Persistence
PERSIST_FAISS=true # Save FAISS index to disk
# Provider Priority (fallback order)
PROVIDER_PRIORITY=groq,openrouter,openai- Visit https://console.groq.com
- Sign up for free account
- Go to API Keys section
- Create new API key
- Copy key to
.envasGROQ_API_KEY
Why Groq?
- โ FREE (no credit card required)
- โ FAST (optimized inference)
- โ Good quality (Llama 3.1)
- Visit https://openrouter.ai
- Sign up for account
- Go to Keys section
- Create new API key
- Copy key to
.envasOPENROUTER_API_KEY
Why OpenRouter?
- โ Access to 100+ models
- โ FREE tier available
- โ Pay only for what you use
- Visit https://platform.openai.com
- Sign up for account
- Add payment method
- Go to API Keys
- Create new secret key
- Copy key to
.envasOPENAI_API_KEY
When to use OpenAI?
- Need highest quality responses
- Have existing OpenAI credits
- Primary providers are down
python main.pyWhat happens automatically:
- โ Dependency validation
- โ Configuration check (.env)
- โ Backend startup (port 8000)
- โ Frontend startup (port 8501)
- โ Browser auto-launch
Access Points:
- ๐ฌ Main UI: http://localhost:8501
- ๐ Backend API: http://localhost:8000
- ๐ API Docs: http://localhost:8000/docs (Swagger UI)
- ๐ Admin Dashboard: Run separately (see below)
Start Services Individually
Terminal 1 - Backend:
uvicorn backend.api:app --reload --host 0.0.0.0 --port 8000Terminal 2 - Frontend:
streamlit run frontend/app_api.py --server.port 8501Terminal 3 - Admin Dashboard (Optional):
streamlit run frontend/admin.py --server.port 8502- Click "Browse files" in the sidebar
- Select PDF, DOCX, PPTX, or TXT files
- Upload multiple files at once โ
- Click "Upload Documents"
- Wait for success confirmation
- Type your question in the chat input
- Press Enter or click send
- View AI-generated answer
- See source citations automatically
- Click "๐ Sources" expander
- See document references
- View exact text excerpts
- Check chunk IDs for traceability
- Click "๐๏ธ Clear History" in sidebar
- Confirmation prompt appears
- Clears UI chat and backend history
streamlit run frontend/admin.py --server.port 8502Access: http://localhost:8502
Capabilities:
- ๐ Full conversation history table
- ๐ Provider usage pie charts
- ๐ Model distribution bar charts
- ๐ Search conversations by keyword
- ๐ Filter by date range
- ๐ฅ Export to CSV
Interactive Documentation:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
Example cURL Commands:
# Health check
curl http://localhost:8000/health
# Upload document
curl -X POST "http://localhost:8000/upload" \
-F "files=@document.pdf" \
-F "files=@report.docx"
# Ask question
curl -X POST "http://localhost:8000/ask" \
-H "Content-Type: application/json" \
-d '{
"question": "What is RAG?",
"provider": "groq"
}'
# Get conversation history
curl http://localhost:8000/history?limit=10
# Get provider statistics
curl http://localhost:8000/stats
# Clear history
curl -X POST http://localhost:8000/clear-historyPython Example:
import requests
# Upload document
with open("document.pdf", "rb") as f:
response = requests.post(
"http://localhost:8000/upload",
files={"files": f}
)
print(response.json())
# Ask question
response = requests.post(
"http://localhost:8000/ask",
json={"question": "Summarize the main points", "provider": "groq"}
)
print(response.json()["answer"])| Document | Description | When to Read |
|---|---|---|
| backend/README.md | Complete backend architecture - How RAG works, data flow, API details, troubleshooting | MUST READ to understand system |
| frontend/README.md | Complete frontend architecture - UI components, API integration, session management | MUST READ for frontend dev |
| docs/QUICK_START.md | Quick 3-step setup guide | First-time setup |
| docs/ARCHITECTURE.md | High-level system design | Understanding system |
| docs/FASTAPI_QUICK_REFERENCE.md | API endpoint reference | API integration |
| docs/DEPLOYMENT.md | Production deployment guide | Going to production |
โญ Most Important:
backend/README.md- Explains how the RAG system works internallyfrontend/README.md- Explains how the UI communicates with backend
| Technology | Version | Purpose |
|---|---|---|
| FastAPI | 0.100+ | REST API framework - async, fast, auto-docs |
| Uvicorn | Latest | ASGI server for FastAPI |
| LangChain | Latest | RAG framework - chunking, prompts, chains |
| FAISS | CPU | Vector database - fast similarity search |
| HuggingFace | Latest | Embeddings model (all-MiniLM-L6-v2) |
| SQLite | 3.x | Conversation history database |
| SQLAlchemy | 2.x | ORM for database operations |
| Pydantic | 2.x | Data validation and settings |
| Python-dotenv | Latest | Environment variable loading |
| Provider | Library | Purpose |
|---|---|---|
| Groq | langchain-groq | Primary LLM (fast, free) |
| OpenRouter | langchain-openai | Fallback LLM (100+ models) |
| OpenAI | langchain-openai | Secondary fallback (high quality) |
| Library | Purpose |
|---|---|
| PyPDF2 | PDF text extraction |
| python-docx | Word document processing |
| python-pptx | PowerPoint processing |
| Technology | Purpose |
|---|---|
| Streamlit | Web UI framework |
| Requests | HTTP client for API calls |
| Pandas | Data manipulation (admin dashboard) |
| Plotly | Charts and visualizations |
# Clone repository
git clone <repository-url>
cd RAG
# Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Setup pre-commit hooks (optional)
pip install pre-commit
pre-commit install# Run all tests
python -m pytest tests/
# Run with coverage
python -m pytest --cov=backend --cov=frontend tests/
# Run specific test file
python -m pytest tests/test_rag_engine.py# Format code
black backend/ frontend/
# Lint code
flake8 backend/ frontend/
# Type checking
mypy backend/ frontend/1. New API Endpoint:
# backend/api.py
@app.post("/new-endpoint")
async def new_feature(data: RequestModel):
# Your code here
return {"status": "success"}2. New Document Format:
# backend/doc_loader.py
@staticmethod
def _load_new_format(path: str) -> str:
# Load and return text
return extracted_text3. New LLM Provider:
# backend/llm_provider.py
if Config.NEW_PROVIDER_API_KEY:
try:
self.providers["new_provider"] = NewProviderChat(
model=Config.NEW_PROVIDER_MODEL
)
except Exception as e:
logger.warning(f"New provider init failed: {e}")Enable Debug Logging:
# backend/config.py
import logging
logging.basicConfig(level=logging.DEBUG)Check Backend Logs:
# Terminal running uvicorn will show logs
# Look for ERROR or WARNING messagesCheck Database:
# Open SQLite database
sqlite3 backend/data/conversation_history.db
# View conversations
SELECT * FROM conversations ORDER BY timestamp DESC LIMIT 10;
# Count conversations
SELECT COUNT(*) FROM conversations;Inspect FAISS Index:
# Python console
from langchain_community.vectorstores import FAISS
from langchain_community.embeddings import HuggingFaceEmbeddings
embeddings = HuggingFaceEmbeddings()
vectorstore = FAISS.load_local("backend/data/faiss_index", embeddings)
# Check number of vectors
print(vectorstore.index.ntotal)See docs/DEPLOYMENT.md for comprehensive production deployment guide.
Docker Setup
Create Dockerfile:
FROM python:3.9-slim
WORKDIR /app
# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application
COPY . .
# Expose ports
EXPOSE 8000 8501
# Run application
CMD ["python", "main.py"]Build and Run:
# Build image
docker build -t documind:latest .
# Run container
docker run -d \
--name documind \
-p 8000:8000 \
-p 8501:8501 \
--env-file .env \
-v $(pwd)/backend/data:/app/backend/data \
documind:latestDocker Compose:
version: '3.8'
services:
documind:
build: .
ports:
- "8000:8000"
- "8501:8501"
env_file:
- .env
volumes:
- ./backend/data:/app/backend/data
restart: unless-stoppeddocker-compose up -dRailway
- Connect GitHub repository
- Add environment variables in dashboard
- Deploy automatically on push
- Custom domain support available
Render
- Create new Web Service
- Connect repository
- Set build command:
pip install -r requirements.txt - Set start command:
python main.py - Add environment variables
Heroku
# Install Heroku CLI
heroku login
# Create app
heroku create documind-app
# Set environment variables
heroku config:set GROQ_API_KEY=your_key
# Deploy
git push heroku main- Set strong API keys
- Enable HTTPS/SSL
- Configure CORS properly
- Set up monitoring (health checks)
- Configure backups for SQLite DB
- Set rate limiting on API
- Add authentication/authorization
- Configure logging (production level)
- Set up error tracking (Sentry)
- Use environment-specific configs
| Feature | Status | Priority |
|---|---|---|
| Streaming responses | ๐ Planned | High |
| Multi-user authentication | ๐ Planned | High |
| React frontend | ๐ Planned | Medium |
| Docker Compose setup | โ Ready | High |
| Vector DB alternatives (Pinecone, Weaviate) | ๐ Planned | Medium |
| Advanced RAG (HyDE, Multi-Query) | ๐ Planned | Low |
| Document management (delete, update) | ๐ Planned | Medium |
| Conversation threading | ๐ Planned | Low |
| Export conversations to PDF | ๐ Planned | Low |
| Mobile-responsive UI | ๐ Planned | Medium |
Want to work on something? Check our issues or propose a new feature!
MIT License - see LICENSE file for details.
You are free to:
- โ Use commercially
- โ Modify
- โ Distribute
- โ Private use
Conditions:
- Include license and copyright notice
- No warranty provided
- Backend Architecture - Deep dive into RAG system
- Frontend Architecture - UI and API integration
- Quick Start Guide - Get running in 3 steps
- API Reference - All endpoints
- Deployment Guide - Production setup
- GitHub Issues - Bug reports
- GitHub Discussions - Q&A and ideas
- Check existing issues before creating new ones
- Provide detailed information for faster resolution
- โญ Star this repo if you find it useful!
- ๐ด Fork and create your own version
- ๐ Watch for updates and new releases
- ๐ข Share with your network
| Action | Command |
|---|---|
| Start application | python main.py |
| Run admin dashboard | streamlit run frontend/admin.py --server.port 8502 |
| View API docs | Navigate to http://localhost:8000/docs |
| Install dependencies | pip install -r requirements.txt |
| Clear vector database | Delete backend/data/faiss_index/ folder |
| Reset history | Delete backend/data/conversation_history.db |
Built with these amazing technologies:
- FastAPI - Modern web framework
- Streamlit - Beautiful data apps
- LangChain - LLM application framework
- FAISS - Vector similarity search
- HuggingFace - ML models and embeddings
- Groq - Fast LLM inference
- OpenRouter - Unified LLM API
- OpenAI - GPT models
Ready to transform how you interact with documents? ๐
git clone https://github.com/Baisampayan1324/DocuMind.git
cd DocuMind
pip install -r requirements.txt
python main.pyThen open http://localhost:8501 and start asking questions!
Made with โค๏ธ by Baisampayan
Found a bug? Open an issue with:
- Clear description
- Steps to reproduce
- Expected vs actual behavior
- Environment details (OS, Python version)
- Error logs/screenshots
Have an idea? Open a feature request with:
- Use case description
- Expected functionality
- Why it would benefit users
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/DocuMind.git cd DocuMind - Create branch for your feature:
git checkout -b feature/amazing-feature
- Make changes and test thoroughly
- Commit with clear messages:
git commit -m "Add: amazing feature description" - Push to your fork:
git push origin feature/amazing-feature
- Open Pull Request with:
- Clear title and description
- Link to related issues
- Screenshots/demos if applicable
- Code Style: Follow PEP 8 for Python
- Testing: Add tests for new features
- Documentation: Update README and docstrings
- Commits: Keep atomic and descriptive
- Dependencies: Justify new package additions
# Clone and setup
git clone https://github.com/Baisampayan1324/DocuMind.git
cd DocuMind
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run tests (if available)
pytest tests/
# Code formatting
black backend/ frontend/
# Linting
flake8 backend/ frontend/MIT License - See LICENSE file for details
- Backend: backend/README.md
- Frontend: frontend/README.md
- Docs folder: docs/
- Check existing issues first
- Provide detailed reproduction steps
- Include error logs and environment details
- GitHub Discussions for questions
- Issues for bug reports
- Pull Requests for contributions
- ๐ Backend Architecture - Deep dive into RAG system
- ๐ฅ๏ธ Frontend Architecture - UI and API integration
- ๐ Quick Start - Get running in 3 steps
- ๐ API Reference - All endpoints
- ๐๏ธ Architecture - System design
- ๐ข Deployment - Production guide
Ready to chat with your documents? ๐
python main.pyThen open http://localhost:8501 and start asking questions!
Made with โค๏ธ using FastAPI, Streamlit, and LangChain