RAG-powered PDF chat application with semantic query capabilities
π Live Demo: https://semanticpdf.vercel.app
A modern web application that enables semantic querying of PDF documents through natural language conversations. Built with RAG (Retrieval-Augmented Generation) architecture for contextually accurate responses.
- π§ Semantic Query Engine: Advanced RAG implementation for contextual document understanding
- π¬ Real-time PDF Chat: Live conversations with uploaded documents using OpenAI models
- π Vector Embeddings: Document chunking and embedding storage in Pinecone
- π³ Subscription Management: Tiered access with Razorpay payment integration
- π‘οΈ Type-safe APIs: Full-stack TypeScript with tRPC for end-to-end type safety
Frontend
- Next.js 15 (App Router)
- TypeScript
- Tailwind CSS + shadcn/ui
- React-PDF for document rendering
- Tanstack Query for data fetching
- Lucide React icons
- Sonner notifications
Backend & Infrastructure
- tRPC for type-safe API layer
- Supabase (PostgreSQL)
- Kinde Auth for authentication
- OpenAI API (GPT + Embeddings)
- Pinecone vector database
- Razorpay payment processing
- Node.js 18+
- OpenAI API key
- Pinecone API key
- Supabase project
- Kinde Auth application
- Razorpay account
Users upload PDFs through the dashboard interface. Documents are processed, chunked, and embedded using OpenAI's text-embedding model, then stored in Pinecone for semantic retrieval.
// Simplified query flow
1. User input β Embedding generation
2. Vector similarity search in Pinecone
3. Context retrieval + RAG prompt construction
4. OpenAI completion with streaming response
5. Real-time UI updatesUsers can now interact with their uploaded documents through natural language queries. The system provides contextually accurate responses by leveraging the processed embeddings and semantic understanding of the document content.
Two-tier subscription model with flexible limits and self-managed billing through the dashboard interface.
-
Razorpay integration (test mode)
-
Subscription lifecycle management
-
Usage tracking and limits enforcement
-
One-click cancellation with immediate effect
- click on upgrade now
- fill details (random details work, but you wouldnt get updates through mail or sms)
- Enter the credit card no. 5267 3181 8797 5449, add another details randomly, choose save card
- Enter otp, you can also skip it
- Click on success to confirm payment
PDF Upload β Text Extraction β Chunking β Embedding β Vector Storage
β
User Query β Query Embedding β Similarity Search β Context Retrieval β LLM Response
- User profiles and authentication state
- Document metadata and processing status
- Chat conversations and message history
- Subscription and billing records
- Usage analytics and rate limiting
Kinde Auth provides secure OAuth implementation with session management and protected route handling.
Razorpay handles subscription creation and management with self-service cancellation through the dashboard. Payment verification links are provided for transaction transparency, with all payments cryptographically verified for enhanced security.
src/
βββ app/ # Next.js 15 App Router
βββ components/ # Reusable UI components
β βββ chat/ # Chat interface components
β βββ ui/ # shadcn/ui base components
βββ client/ # Client-side utilities
βββ config/ # Configuration files
βββ db/ # Database utilities
βββ generated/ # Auto-generated files
βββ lib/ # Core utilities and helpers
βββ polyfill/ # Browser polyfills
βββ trpc/ # tRPC client configuration
βββ types/ # TypeScript definitions
βββ middleware.ts # Next.js middleware
prisma/ # Database schema and migrations
public/ # Static assets
- π Full-stack TypeScript: End-to-end type safety from database to UI
- β‘ Modern React Patterns: Server components, streaming, and optimistic updates
- π Performance Optimized: Edge functions and efficient vector searches
- π¨ Sleek UI: Modern interface built with shadcn/ui and React-PDF integration
- π Crypto-verified Payments: Razorpay transactions secured with cryptographic verification





