A full-stack web application for uploading PDF documents and asking questions about their contents using natural language processing and RAG (Retrieval-Augmented Generation).
- 📄 PDF upload with drag & drop support
- 💬 Chat-style Q&A interface
- 🤖 Local LLM integration (Ollama with Llama 3.2 3B)
- 🔍 RAG pipeline with keyword-based retrieval
- ⚡ Real-time answers based on document content
- 🎨 Modern UI with Tailwind CSS
- Language: Go 1.21+
- Framework: Gin
- PDF Processing: pdfcpu
- LLM: Ollama (Llama 3.2 3B)
- Storage: Local filesystem
- Framework: React 19
- Language: TypeScript
- Build Tool: Vite
- Styling: Tailwind CSS 3.4
- HTTP Client: Fetch API
pdf-qa-app/
├── backend/ # Go backend
│ ├── cmd/server/ # Application entry point
│ ├── internal/
│ │ ├── api/ # HTTP handlers
│ │ ├── pdf/ # PDF text extraction
│ │ ├── rag/ # RAG pipeline
│ │ └── storage/ # File storage
│ ├── uploads/ # Uploaded PDFs and extracted text
│ └── go.mod
│
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── api/ # Backend API client
│ │ └── types/ # TypeScript interfaces
│ └── package.json
│
└── README.md
Already have everything installed? Start both servers with one command:
./start.shThen open http://localhost:5173 in your browser.
Press Ctrl+C to stop both servers.
- Go 1.21 or higher
- Node.js 18+ and npm
- Ollama with Llama 3.2 3B model
# Install Ollama (macOS)
brew install ollama
# Start Ollama service
ollama serve
# Pull the model (in another terminal)
ollama pull llama3.2:3b# Navigate to backend directory
cd backend
# Install dependencies
go mod download
# Run the server
go run cmd/server/main.goBackend will start on http://localhost:8080
# Navigate to frontend directory
cd frontend
# Install dependencies
npm install
# Start development server
npm run devFrontend will start on http://localhost:5173
- Start both servers: Run
./start.sh(or manually start backend on :8080, frontend on :5173) - Open browser to
http://localhost:5173 - Upload a PDF by dragging & dropping or clicking "Choose File"
- Ask questions about the document in the chat interface
- Get answers powered by local LLM based on document content
GET /health- Health checkPOST /upload- Upload PDF filePOST /query- Ask question about uploaded document
See /backend/README.md for detailed API documentation.
cd backend
go run cmd/server/main.gocd frontend
npm run dev # Development server
npm run build # Production build
npm run lint # Run ESLint- Upload: User uploads PDF → Backend extracts text using pdfcpu
- Storage: Text is stored with unique document ID
- Query: User asks question → RAG pipeline retrieves relevant chunks
- Generation: Ollama LLM generates answer based on retrieved context
- Display: Answer shown in chat interface
- Vector embeddings for semantic search
- Multiple document support
- Document history and management
- Export chat conversations
- Docker Compose setup
- User authentication
- Database persistence
- Unit and integration tests
MIT
Federico Mercurio