An AI-powered document search application that allows users to upload files and ask natural language questions about their content.
The system uses Retrieval-Augmented Generation (RAG) with semantic search to find relevant information and generate accurate answers.
- Upload PDF, DOCX, and TXT files
- Automatic text extraction and chunking
- Semantic search using vector embeddings (pgvector)
- AI-generated answers based on document content
- Source referencing for retrieved information
- Document management (view, download, delete)
- PDF preview and full-text viewer
- Frontend: Next.js, React, Tailwind CSS
- Backend: Next.js API Routes
- Database: Supabase (PostgreSQL + pgvector)
- AI: OpenAI (embeddings + LLM)
- Storage: Supabase Storage
-
Upload
- Files are uploaded and stored in Supabase Storage
- Text is extracted and split into chunks
-
Embedding
- Each chunk is converted into a vector using OpenAI embeddings
-
Storage
- Chunks + embeddings are stored in PostgreSQL (pgvector)
-
Search
- User query is embedded
- Similar chunks are retrieved using vector similarity
-
Generation
- Retrieved context is passed to an LLM
- Final answer is generated
git clone <your-repo-url>
cd <your-project>npm install
Create a .env.local file in the root directory:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
OPENAI_API_KEY=your_openai_api_key
npm run dev