Transform your documents into intelligent conversations
Features β’ Demo β’ Installation β’ Usage β’ Architecture β’ Deployment
- Overview
- Features
- Tech Stack
- Architecture
- Installation
- Configuration
- Usage
- API Documentation
- Deployment
- Contributing
- License
Documind is an intelligent AI-powered document assistant that enables you to have natural conversations with your documents. Upload PDFs, ask questions, and get accurate answers backed by source citations using advanced Retrieval-Augmented Generation (RAG) technology.
- π― Accurate Answers: Get precise information from your documents with source citations
- π¬ Natural Conversations: Chat with your documents as if talking to an expert
- π Secure & Private: User-specific document storage with JWT authentication
- π Multiple Documents: Manage and chat with multiple documents independently
- π Fast & Efficient: Built with modern async frameworks for optimal performance
- πΎ Persistent History: All conversations are saved and retrievable
- User Registration & Login with JWT token-based authentication
- Password Hashing using bcrypt for secure credential storage
- Protected Routes ensuring only authenticated users access resources
- User Isolation - each user can only access their own documents
- PDF Upload with drag-and-drop interface
- Automatic Processing - documents are chunked and embedded automatically
- Document-Specific Chats - each document has its own conversation thread
- Delete Documents - easy document management
- Multi-Document Support - upload and manage multiple documents
- RAG-Powered Responses using vector similarity search
- Context-Aware Answers based on document content
- Source Citations with exact page references
- Chat History persisted per document per user
- Real-Time Streaming for responsive user experience
- ChatGPT-Inspired Interface for familiar user experience
- Responsive Design works on desktop and mobile
- Dark Mode Ready (optional feature)
- Interactive Sidebar for document navigation
- Markdown Support for formatted responses
- FastAPI - Modern, fast web framework for building APIs
- LangChain - Framework for developing LLM applications
- ChromaDB - Vector database for embeddings
- OpenAI API - (via OpenRouter) for LLM completions
- Sentence Transformers - Free local embeddings
- SQLite - Lightweight database for user data and chat history
- JWT - JSON Web Tokens for secure authentication
- React 19 - Modern UI library
- Axios - HTTP client for API requests
- React Markdown - Markdown rendering
- Lucide React - Beautiful icon library
- React Dropzone - File upload component
- LangChain - Orchestration framework
- ChromaDB - Vector store for semantic search
- Sentence Transformers -
all-MiniLM-L6-v2for embeddings - OpenRouter - Access to multiple LLMs (GPT-4, Claude, etc.)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Frontend (React) β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Auth UI β β Document β β Chat UI β β
β β β β Management β β β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β HTTP/REST
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Backend (FastAPI) β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Auth Routes β β API Routes β β RAG Service β β
β β (JWT) β β β β β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β SQLite β β ChromaDB β β LLM Client β β
β β (Users, β β (Vectors) β β (OpenRouter) β β
β β History) β β β β β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- User uploads PDF β Processed into chunks β Embedded with Sentence Transformers β Stored in ChromaDB
- User asks question β Embedded with same model β Similar chunks retrieved from ChromaDB
- Retrieved context + Question β Sent to LLM via OpenRouter β Response streamed back
- Chat history β Saved to SQLite β Loaded when document is selected
- Python 3.11+
- Node.js 16+ and npm
- Git
git clone https://github.com/saadkhan2003/Documind---AI-Document-Assistant.git
cd Documind---AI-Document-Assistant# Install Python dependencies
pip install -r requirements.txt
# Create .env file
# Copy the example below and add your API keysCreate a .env file in the root directory:
# OpenRouter API Key (get from https://openrouter.ai/)
OPENROUTER_API_KEY=your_openrouter_api_key_here
# JWT Secret (generate a random string)
JWT_SECRET_KEY=your_secret_key_here_use_openssl_rand_hex_32
# Optional: Change default model
LLM_MODEL=openai/gpt-3.5-turbocd frontend
npm installThe SQLite database will be created automatically on first run. The schema includes:
users- User accountsuser_documents- Document metadata and ownershipchat_history- Conversation history per document
Edit src/utils/config.py to customize:
# Embedding Model (free, runs locally)
EMBEDDING_MODEL = "all-MiniLM-L6-v2"
# LLM Model (via OpenRouter)
LLM_MODEL = os.getenv("LLM_MODEL", "openai/gpt-3.5-turbo")
# Chunk Settings
CHUNK_SIZE = 1000
CHUNK_OVERLAP = 200
# Vector Store
CHROMA_PERSIST_DIR = "./vectorstore"Edit src/index.js or create .env in frontend folder:
REACT_APP_API_URL=http://localhost:8000Terminal 1 - Backend:
# From project root
python -m uvicorn src.api.main:app --reload --host 0.0.0.0 --port 8000Terminal 2 - Frontend:
# From frontend folder
cd frontend
npm startThe application will open at http://localhost:3000
-
Register/Login
- Open the application
- Create a new account or login
- You'll be redirected to the main interface
-
Upload Documents
- Drag and drop a PDF file or click to browse
- Wait for processing (automatic chunking and embedding)
- Document appears in the sidebar
-
Start Chatting
- Click on a document to select it
- Type your question in the chat input
- Get AI-powered answers with source citations
- Chat history is automatically saved
-
Manage Documents
- Switch between documents by clicking them
- Delete documents you no longer need
- Each document maintains its own chat history
POST /auth/register
POST /auth/login
POST /auth/tokenPOST /upload # Upload PDF document
GET /documents # Get user's documents
DELETE /documents/{doc_id} # Delete documentPOST /query # Ask question about document
GET /chat_history/{doc_id} # Get chat historyVisit http://localhost:8000/docs for interactive Swagger documentation.
-
Backend Deployment
- Connect your GitHub repository
- Use
render.yamlconfiguration - Add environment variables (OPENROUTER_API_KEY, JWT_SECRET_KEY)
- Deploy!
-
Frontend Deployment
- Deploy to Netlify or Vercel
- Use
netlify.tomlconfiguration - Set
REACT_APP_API_URLto your backend URL - Build and deploy!
# Install Railway CLI
npm install -g @railway/cli
# Login and deploy
railway login
railway init
railway up# Backend
OPENROUTER_API_KEY=your_production_key
JWT_SECRET_KEY=strong_random_secret
DATABASE_URL=your_production_db_url (optional)
CORS_ORIGINS=https://your-frontend-url.com
# Frontend
REACT_APP_API_URL=https://your-backend-url.com.
βββ src/
β βββ api/ # API routes and endpoints
β β βββ main.py # Main FastAPI application
β β βββ auth_routes.py # Authentication endpoints
β βββ core/ # Core functionality
β β βββ embeddings.py # Embedding generation
β β βββ llm_client.py # LLM interaction
β β βββ vectorstore.py # Vector database operations
β βββ models/ # Data models
β β βββ database.py # SQLite models and operations
β βββ processors/ # Document processors
β β βββ pdf_processor.py # PDF parsing and chunking
β βββ services/ # Business logic
β β βββ rag_service.py # RAG implementation
β βββ utils/ # Utilities
β βββ auth.py # JWT and authentication
β βββ chunking.py # Text chunking strategies
β βββ config.py # Configuration management
βββ frontend/
β βββ public/ # Static assets
β βββ src/
β βββ App.js # Main React component
β βββ Auth.js # Authentication components
β βββ AuthContext.js # Auth state management
β βββ index.js # Entry point
βββ data/ # Uploaded documents
βββ vectorstore/ # ChromaDB persistence
βββ requirements.txt # Python dependencies
βββ netlify.toml # Netlify configuration
βββ render.yaml # Render configuration
βββ README.md # This file
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow PEP 8 for Python code
- Use ESLint/Prettier for JavaScript code
- Write meaningful commit messages
- Add tests for new features
- Update documentation as needed
Backend won't start:
# Check if port 8000 is already in use
netstat -ano | findstr :8000
# Kill the process or use a different portFrontend can't connect to backend:
- Verify backend is running on
http://localhost:8000 - Check CORS settings in
main.py - Ensure
.envhas correctREACT_APP_API_URL
Embedding generation is slow:
- First run downloads the model (~80MB)
- Subsequent runs are much faster
- Consider using GPU acceleration if available
OpenRouter API errors:
- Verify your API key is correct
- Check your OpenRouter account has credits
- Try a different model if one is unavailable
This project is licensed under the MIT License - see the LICENSE file for details.
- LangChain for the amazing RAG framework
- ChromaDB for efficient vector storage
- FastAPI for the blazing-fast backend framework
- React for the powerful UI library
- OpenRouter for unified LLM access
- Sentence Transformers for free embeddings
Saad Khan - @saadkhan2003
Project Link: https://github.com/saadkhan2003/Documind---AI-Document-Assistant
β Star this repo if you find it helpful!
Made with β€οΈ using React, FastAPI, and LangChain