Skip to content

AI-powered document Q&A system with RAG. Upload PDFs, extract text, store embeddings in Postgres (pgvector), and query with GPT. Built with Node.js, BullMQ, Redis, Next.js + Material UI frontend.

Notifications You must be signed in to change notification settings

abhicode/document-workflow-assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📄 AI Document Q&A (RAG System)

An AI-powered document question-answering system built with Node.js, Next.js, and OpenAI. Upload PDFs → system extracts + embeds content → stores vectors in Postgres (pgvector) → answers queries with GPT grounded in document context.

Screenshot from 2025-09-18 22-26-43

✨ Features

  • 📂 Upload PDFs via frontend
  • 🔄 Background indexing with BullMQ + Redis
  • 🧩 Text chunking & OpenAI embeddings
  • 🗄 Vector search using Postgres + pgvector
  • 🤖 Context-aware answers with GPT-4o-mini
  • 🌐 Next.js + Material UI frontend for a polished UI
  • 🐳 Dockerized for easy deployment

🚀 Getting Started

1. Clone repo

git clone https://github.com/abhicode/document-workflow-assistant.git
cd document-workflow-assistant

2. Environment setup

Create .env files at the root:

# Redis
REDIS_URL=redis://redis:6379

# OpenAI
OPENAI_API_KEY=sk-proj-***
EMBEDDING_MODEL=text-embedding-3-small
EMBEDDING_DIM=1536
TOP_K=5

# Server
PORT=8080
FRONTEND_URL=http://localhost:3000

POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=vector_db

DATABASE_URL=postgres://postgres:postgres@db:5432/vector_db

3. Run with Docker Compose

docker-compose up --build

Frontend → http://localhost:3000

Backend API → http://localhost:8080

🖥️ Usage

  • Upload a PDF from the frontend.
  • Wait for it to be indexed (processed by a worker).
  • Enter a question → system retrieves relevant chunks → GPT answers with context + sources.

🛠️ Tech Stack

  • Backend: Node.js, Express, BullMQ, Redis
  • Database: PostgreSQL + pgvector
  • Workers: PDF parsing, OpenAI embeddings
  • Frontend: Next.js (TypeScript) + Material UI
  • AI Models: OpenAI embeddings + GPT-4o-mini

📦 Deployment

  • Local: Docker Compose (frontend + backend + redis + postgres)
  • Cloud: Easily deployable to AWS, GCP, Azure, Railway, or Render

About

AI-powered document Q&A system with RAG. Upload PDFs, extract text, store embeddings in Postgres (pgvector), and query with GPT. Built with Node.js, BullMQ, Redis, Next.js + Material UI frontend.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published