SmartDoc AI is an AI-powered document chatbot that allows users to upload PDF documents and have intelligent conversations about their contents. Built with Next.js, TypeScript, Prisma, and OpenAI.
- PDF Upload & Processing - Drag and drop PDF files for instant processing
- AI-Powered Chat - Ask questions in natural language using GPT-4o-mini
- Semantic Search - Vector embeddings for accurate context retrieval
- Persistent Storage - Prisma + SQLite for document persistence
- Source Citations - Every answer includes document references
- Real-time Streaming - See AI responses as they're generated
- Beautiful Dark UI - Modern, professional interface with smooth animations
- Responsive Design - Works seamlessly on desktop and mobile
- Type Safety - Full TypeScript implementation
- Next.js 14 (App Router) with TypeScript
- React 18 with TypeScript
- Tailwind CSS - Utility-first styling
- shadcn/ui - Beautiful component library
- react-dropzone - File upload interface
- react-markdown - Markdown rendering
- Next.js API Routes - TypeScript serverless functions
- Prisma ORM - Type-safe database access
- SQLite - Embedded database (easily upgradable to PostgreSQL)
- OpenAI API - GPT-4o-mini for chat, text-embedding-3-small for embeddings
- pdf-parse - PDF text extraction
- OpenAI GPT-4o-mini - Conversational AI
- text-embedding-3-small - Document embeddings
- RAG (Retrieval-Augmented Generation) - Context-aware responses
- Cosine Similarity Search - Efficient vector search
- Node.js 18+ installed
- OpenAI API key (Get one here)
-
Clone the repository
git clone <your-repo-url> cd smartdoc-ai
-
Install dependencies
yarn install
-
Set up Prisma database
npx prisma generate npx prisma migrate dev --name init
-
Set up environment variables
Create a
.env.localfile in the root directory:OPENAI_API_KEY=sk-your-key-here DATABASE_URL="file:./prisma/dev.db"
-
Run the development server
yarn dev
-
Open your browser
Navigate to http://localhost:3000
Built with ❤️ using Next.js