An AI-powered document intelligence application that combines RAG, semantic retrieval, Gemini, and page-aware citations to turn static PDFs into interactive, conversational knowledge.
AskPDF turns a PDF from a file you read into a document you can talk to.
Upload a document, ask a question in natural language, and AskPDF retrieves the most relevant context before asking Gemini to generate a grounded answer. When the answer comes from a specific part of the document, the application can surface the page reference directly in the conversation and let you jump to that page in the PDF viewer.
The project combines:
- π PDF text extraction
- π§© document chunking
- π embedding-based semantic retrieval
- π§ Retrieval-Augmented Generation (RAG)
- π page-aware retrieval
- π― source/page citations
- π clickable citation navigation
- π¬ conversational follow-up questions
The current implementation uses a React + TypeScript frontend and a Node.js + Express + TypeScript backend, with MongoDB for persistence and Gemini for AI capabilities. ξfileciteξturn13file0ξL42-L64ξ
π Open AskPDF
Upload a PDF β ask a question β inspect the source.
Most document chat applications stop at:
βHere is an answer generated from your PDF.β
AskPDF is designed around a more useful workflow:
βHere is the answer β and here is where it came from.β
That means the system is not only focused on answering questions, but also on making those answers easier to verify, navigate, and trust.
π Document Intelligence
- PDF upload and text extraction
- Page offset calculation
- Automatic document chunking
- Temporary file cleanup after processing
- Support for document-grounded conversational queries
π Semantic Retrieval
- Embedding-based retrieval
- Cosine-similarity ranking
- Meaning-aware search instead of simple keyword matching
- Relevant context selection before generation
π Page-Aware Retrieval
Ask questions such as:
What is mentioned on page 20?
AskPDF can use the requested page context instead of treating the entire document as an undifferentiated text corpus.
π― Grounded Answers & Citations
- Answers are generated from retrieved document context
- Source pages are surfaced with responses
- Citations can be clicked to navigate to the relevant PDF page
- Designed to make answers easier to fact-check
π¬ Conversational UX
Ask follow-up questions naturally:
What is the main argument?
Can you explain that in simpler terms?
What evidence supports that?
The application is designed to preserve the conversational context needed for follow-up interactions.
π‘οΈ Reliability & Production Considerations
- Gemini API error/rate-limit handling
- Required environment-variable validation
- CORS configuration
- Temporary upload cleanup
- Production frontend/backend deployment
AskPDF follows a Retrieval-Augmented Generation (RAG) pipeline with additional page-aware logic.
βββββββββββββββββββββββ
β Upload PDF β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Extract Text β
β + Page Information β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Chunk Document β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Generate Embeddings β
β via Gemini β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β User Question β
ββββββββββββ¬βββββββββββ
β
ββββββββββββ΄βββββββββββ
βΌ βΌ
Semantic Retrieval Page Retrieval
β β
ββββββββββββ¬βββββββββββ
βΌ
βββββββββββββββββββββββ
β Relevant Context β
β Selected/Ranked β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Gemini Generation β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Grounded Answer + β
β Page Citations β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Click Citation β β
β Jump to PDF Page β
βββββββββββββββββββββββ
The repository describes this flow as text extraction with page offsets, chunking, embedding generation, semantic or page-aware retrieval, context injection, grounded Gemini generation, and clickable PDF navigation. ξfileciteξturn13file0ξL107-L131ξ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ASKPDF PLATFORM β
ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ€
β FRONTEND β BACKEND β
β β β
β React + TypeScript β Node.js + Express + TypeScript β
β Vite β β
β Tailwind CSS β ββββββββββββββββββββββββββββββ β
β TanStack Query β β Controllers / Routes β β
β Axios β βββββββββββββββ¬βββββββββββββββ β
β β β β
β PDF Viewer β βΌ β
β Chat Interface β ββββββββββββββββββββββββββββββ β
β Citation Navigation β β RAG / PDF / Chat Services β β
β β βββββββββββββββ¬βββββββββββββββ β
ββββββββββββββββ¬ββββββββββββββββ β β
β β β
βββββββββββββββ HTTP βββββββββββββ β
β β
ββββββββββββββββββββββββΌββββββββββββββββ β
β β β β
βΌ βΌ βΌ β
MongoDB Gemini pdf-parse
β β β β
ββββββββββββββββββββββββ΄ββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
The repository is organized around a React/Vite client and a Node/Express server with configuration, controllers, middleware, models, routes, services, utilities, and workers. ξfileciteξturn13file0ξL139-L164ξ
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | React | Interactive document/chat UI |
| Language | TypeScript | Type-safe application code |
| Build Tool | Vite | Fast frontend development/builds |
| Styling | Tailwind CSS | UI styling |
| Data Fetching | TanStack Query | Server-state management |
| HTTP | Axios | API communication |
| Backend | Node.js + Express | API and application server |
| Database | MongoDB + Mongoose | Persistence |
| AI | Gemini API | Embeddings and generation |
| pdf-parse | PDF text extraction | |
| Deployment | Vercel + Render | Frontend/backend hosting |
| Database Hosting | MongoDB Atlas | Managed MongoDB |
This stack reflects the repository's documented frontend, backend, AI/RAG, and deployment technologies. ξfileciteξturn13file0ξL69-L103ξ
AskPDF/
β
βββ client/ # React + Vite frontend
β βββ public/ # Static assets
β βββ src/
β βββ assets/ # Images and global styles
β βββ components/ # Reusable UI components
β βββ lib/ # Utilities and API clients
β βββ pages/ # Main views/routes
β
βββ server/ # Node + Express backend
β βββ src/
β β βββ config/ # Configuration/database setup
β β βββ constants/ # Shared constants
β β βββ controllers/ # Request handlers
β β βββ middleware/ # Express middleware
β β βββ models/ # Mongoose models
β β βββ routes/ # API routes
β β βββ services/ # RAG, chat, PDF logic
β β βββ utils/ # Helper utilities
β β βββ workers/ # Background processing
β βββ uploads/ # Temporary PDF storage
β
βββ AskPDF.postman_collection.json # API testing collection
βββ DEVELOPMENT.md # Development notes/log
βββ README.md # Project documentation
The repository also includes a Postman collection for manual API testing. ξfileciteξturn13file0ξL24-L26ξ
- Node.js: v18+
- MongoDB: local MongoDB or MongoDB Atlas
- Gemini API Key
- npm
These prerequisites match the project's documented setup. ξfileciteξturn13file0ξL173-L183ξ
git clone https://github.com/Jyatin/AskPDF.git
cd AskPDFcd server
npm installCreate server/.env, then start the backend:
npm run devBackend development server:
http://localhost:5000
Open another terminal:
cd client
npm install
npm run devFrontend development server:
http://localhost:5173
The repository documents these backend/frontend development flows and ports. ξfileciteξturn13file0ξL173-L233ξ
Create server/.env:
# Required
MONGO_URI=mongodb+srv://<user>:<password>@cluster.mongodb.net/askpdf
GEMINI_API_KEY=your_gemini_api_key
PORT=5000
# Required in production
CORS_ORIGIN=https://ask-pdf-vert.vercel.appπ Never commit real credentials or API keys to Git.
The repository currently documents these environment variables, including the production CORS origin. ξfileciteξturn13file0ξL261-L275ξ
cd server
npm run buildcd client
npm run buildThese production build commands are part of the documented workflow. ξfileciteξturn13file0ξL235-L257ξ
AskPDF is currently documented as deployed using:
Frontend β Vercel
Backend β Render
Database β MongoDB Atlas
AI β Gemini API
Frontend
https://ask-pdf-vert.vercel.app/
Backend API
https://askpdf-backend-xt83.onrender.com
Health Check
https://askpdf-backend-xt83.onrender.com/health
The repository documents the Vercel frontend, Render backend, MongoDB Atlas database, and Gemini-based AI deployment. ξfileciteξturn13file0ξL281-L296ξ
AskPDF currently does not have a formal automated test suite.
For API testing and manual verification, the repository includes:
AskPDF.postman_collection.json
This matches the current project documentation. ξfileciteξturn13file0ξL300-L304ξ
AskPDF is actively evolving. Current documented limitations include:
- Conversation history is currently stored in frontend React state and is lost after a page reload.
- Semantic retrieval currently calculates cosine similarity in application memory rather than using a dedicated vector database.
- Retrieval is not optimized for very large document collections.
- Uploaded PDFs use temporary backend local storage during processing.
These are explicitly documented in the current project README. ξfileciteξturn13file0ξL308-L315ξ
[x] PDF upload + extraction
[x] Document chunking
[x] Semantic retrieval
[x] RAG-based QA
[x] Page-aware retrieval
[x] Clickable page citations
[ ] Persistent conversations
[ ] Multi-document conversations
[ ] Improved retrieval/ranking
[ ] Dedicated vector database
[ ] Streaming responses
[ ] User authentication
[ ] Persistent cloud document storage
[ ] Large-document background processing
[ ] Advanced table/image understanding
The planned V2 direction currently includes persistent conversations, multi-document support, improved ranking, scalable vector search, streaming responses, authentication, cloud storage, background processing, security improvements, and richer document understanding. ξfileciteξturn13file0ξL319-L334ξ
Contributions, ideas, bug reports, issues, and pull requests are welcome.
git checkout -b feature/your-feature
# make your changes
git add .
git commit -m "feat: describe your change"
git push origin feature/your-featureThen open a Pull Request with:
- what changed
- why it changed
- how it was tested
- screenshots or recordings for UI changes
AskPDF is an evolving project focused on making document interaction more grounded, navigable, and useful through retrieval-augmented AI.
If AskPDF is useful or interesting, consider giving the repository a β.
It helps the project get discovered and encourages continued development.
No license is currently specified in the repository.
Add a LICENSE file when you are ready to define how the project may be used, modified, and distributed.