A modern PDF document chat application powered by AI that allows you to upload PDF documents and have intelligent conversations about their content.
- PDF Upload & Processing: Upload PDF documents and extract text content
- AI-Powered Chat: Chat with your documents using Google's Gemini AI
- Smart Context Retrieval: Uses Pinecone vector database for relevant context
- Real-time Streaming: Get AI responses in real-time with streaming
- Responsive Design: Modern, responsive UI that works on all devices
- Document Preview: Preview uploaded documents in a side panel
- Chat History: Maintains conversation history for each document
- React 18 with TypeScript
- Vite for fast development and building
- Tailwind CSS for styling
- React Dropzone for file uploads
- React Markdown for rich text rendering
- Axios for API communication
- Node.js with TypeScript
- Express.js for API server
- Google Gemini AI for text embeddings and chat completions
- Pinecone for vector database and similarity search
- PDF-parse for PDF text extraction
- Multer for file upload handling
- Node.js 18+
- pnpm 9+
- Google Gemini API key
- Pinecone API key and index
git clone <repository-url>
cd papermind-ai-v2
pnpm installCopy the example environment file and configure your API keys:
cd backend
cp env.example .envEdit .env and add your API keys:
PORT=3001
FRONTEND_URL=http://localhost:5173
# API Keys (Replace with your actual keys)
GEMINI_API_KEY=your_gemini_api_key_here
PINECONE_API_KEY=your_pinecone_api_key_here
PINECONE_INDEX=your_pinecone_index_name_herecd frontend
cp env.example .envEdit .env:
VITE_API_BASE_URL=http://localhost:3001- Create a Pinecone account at pinecone.io
- Create a new index with:
- Dimensions: 768 (for text-embedding-004 model)
- Metric: cosine
- Cloud: Choose your preferred region
- Copy your API key and index name to the backend
.envfile
- Get your API key from Google AI Studio
- Add it to the backend
.envfile
pnpm devpnpm dev:frontendpnpm dev:backendpnpm buildUpload and process a PDF document.
Request: Multipart form data with file field
Response:
{
"message": "File uploaded and processed successfully.",
"document": {
"id": "doc-1234567890",
"name": "document.pdf"
}
}Chat with a document using streaming response.
Request:
{
"message": "What is this document about?",
"documentId": "doc-1234567890"
}Response: Server-sent events stream with AI response chunks.
papermind-ai-v2/
├── frontend/ # React frontend application
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── context/ # React context providers
│ │ ├── hooks/ # Custom React hooks
│ │ ├── services/ # API and utility services
│ │ └── types.ts # TypeScript type definitions
│ ├── package.json
│ └── vite.config.ts
├── backend/ # Node.js backend API
│ ├── src/
│ │ ├── controllers/ # Request handlers
│ │ ├── middleware/ # Express middleware
│ │ ├── routes/ # API routes
│ │ ├── services/ # Business logic services
│ │ └── app.ts # Express app setup
│ ├── package.json
│ └── tsconfig.json
└── package.json # Root monorepo configuration
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For support and questions, please open an issue on GitHub.
