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