Transform your documents into intelligent conversations with AI-powered analysis, persistent chat history, and seamless Google Drive integration.
- Google OAuth integration with NextAuth.js
- Protected routes and middleware
- Persistent user sessions
- Multi-format Support: PDF, DOCX, TXT files
- Google Drive Integration: Automatic cloud storage and sync
- Gemini 2.5 Flash: Advanced AI-powered document analysis
- Intelligent Insights: Summary generation, sentiment analysis, entity extraction
- Context-Aware Chat: Ask questions about your documents
- Persistent History: All conversations saved to MySQL database
- Vector Search: Powered by Pinecone and Cohere embeddings
- Source Citations: Answers with references to original document sections
- Dark-First Design: Sleek violet and purple gradient themes
- Responsive Layout: Mobile-first design with Tailwind CSS
- Smooth Animations: Framer Motion powered interactions
- Glass Morphism: Modern frosted glass effects
- Upload History: Track all processed documents
- Usage Analytics: Monitor API usage and costs
- Real-time Status: Live processing and connection indicators
graph TB
A[Next.js Frontend] --> B[NextAuth.js]
A --> C[FastAPI Backend]
C --> D[MySQL Database]
C --> E[Google Drive API]
C --> F[Gemini LLM]
C --> G[Pinecone Vector DB]
C --> H[Cohere Embeddings]
subgraph "Authentication"
B --> I[Google OAuth]
end
subgraph "Document Processing"
F --> J[Analysis & Insights]
H --> K[Text Embeddings]
G --> L[Vector Storage]
end
subgraph "Data Persistence"
D --> M[User Data]
D --> N[Chat History]
D --> O[Document Metadata]
E --> P[File Storage]
end
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- Animations: Framer Motion
- Authentication: NextAuth.js
- Database ORM: Prisma
- Icons: React Icons
- Framework: FastAPI
- Language: Python 3.9+
- Database: MySQL 8.0
- Authentication: JWT with NextAuth integration
- LLM: Google Gemini 2.5 Flash
- Embeddings: Cohere embed-multilingual-v3.0
- Vector Database: Pinecone
- Cloud Storage: Google Drive API
- Frontend Hosting: Vercel
- Backend Hosting: Railway/Heroku
- Database: PlanetScale/AWS RDS
- Monitoring: Built-in analytics
- Node.js 18+
- Python 3.9+
- MySQL 8.0+
- Google Cloud Platform account
- Pinecone account
- Cohere account
# Clone the repository
git clone https://github.com/yourusername/document-analyzer.git
cd document-analyzer
# Setup frontend
cd frontend
npm install
cp .env.example .env.local
# Setup backend
cd ../backend
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env
# Database setup
mysql -u root -p -e "CREATE DATABASE document_analyzer_db;"
mysql -u root -p document_analyzer_db < database_schema.sql
# Run the application
# Terminal 1: Backend
cd backend && uvicorn main:app --reload
# Terminal 2: Frontend
cd frontend && npm run dev
๐ For detailed setup instructions, see Installation Guide
docanalyzer-ai/
โโโ frontend/ # Next.js application
โ โโโ src/
โ โ โโโ app/ # App router pages
โ โ โ โโโ page.tsx # Homepage
โ โ โ โโโ dashboard/ # User dashboard
โ โ โ โโโ upload/ # Document upload
โ โ โ โโโ chat/ # Chat interface
โ โ โ โโโ api/ # API routes
โ โ โโโ components/ # React components
โ โ โ โโโ Navbar.tsx
โ โ โ โโโ Hero.tsx
โ โ โ โโโ Features.tsx
โ โ โ โโโ Footer.tsx
โ โ โโโ middleware.ts # Route protection
โ โ โโโ auth.ts # NextAuth config
โ โโโ prisma/ # Database schema
โ โโโ tailwind.config.js # Styling config
โโโ backend/ # FastAPI application
โ โโโ main.py # FastAPI main app
โ โโโ requirements.txt # Python dependencies
โ โโโ database_schema.sql # MySQL schema
โ โโโ google-credentials.json # Google API credentials
โโโ docs/ # Documentation
โ โโโ installation-guide.md
โ โโโ api-documentation.md
โ โโโ interview-qa.md
โโโ README.md # This file
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key"
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
DATABASE_URL="mysql://user:password@localhost:3306/document_analyzer_db"
GEMINI_API_KEY="your-gemini-api-key"
PINECONE_API_KEY="your-pinecone-api-key"
COHERE_API_KEY="your-cohere-api-key"
PINECONE_INDEX_NAME="document-analyzer"
GOOGLE_DRIVE_FOLDER_ID="your-folder-id"
GOOGLE_APPLICATION_CREDENTIALS="./google-credentials.json"
MYSQL_HOST="127.0.0.1"
MYSQL_USER="root"
MYSQL_PASSWORD="your-password"
MYSQL_DATABASE="document_analyzer_db"
GET /api/auth/signin
- Google OAuth sign-inGET /api/auth/signout
- Sign out userGET /api/auth/session
- Get current session
POST /api/upload
- Upload document to Google DriveGET /api/documents
- Get user's document historyGET /api/documents/{id}
- Get specific document details
POST /api/chat
- Send message about documentGET /api/chat-history/{document_id}
- Get chat history for document
GET /api/analytics/usage
- Get user usage statisticsGET /api/analytics/costs
- Get API usage costs
- Upload research papers and ask specific questions
- Extract key findings and methodologies
- Generate comprehensive summaries
- Process financial reports and business documents
- Extract KPIs and important metrics
- Generate executive summaries
- Analyze contracts and legal documents
- Extract key terms and obligations
- Identify potential risks or issues
- Process medical reports and research
- Extract patient information and recommendations
- Summarize complex medical terminology
- End-to-End Encryption: All data encrypted in transit and at rest
- Private Storage: Documents stored in user's private Google Drive
- Secure Authentication: OAuth 2.0 with Google
- Data Isolation: Each user's data completely isolated
- No Data Sharing: Your documents and conversations remain private
- Fast Processing: Average document analysis in 2-3 seconds
- Scalable Architecture: Handles concurrent users efficiently
- Optimized Queries: Database indexes for quick retrieval
- CDN Integration: Fast global content delivery
- Caching Strategy: Redis caching for improved response times
- Multi-language document support
- Batch document processing
- Advanced analytics dashboard
- API rate limiting and quotas
- Team collaboration features
- Document comparison tools
- Integration with Microsoft Office
- Mobile app development
- Custom AI model training
- Enterprise SSO integration
- Advanced security features
- White-label solutions
We welcome contributions!
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Commit changes:
git commit -m 'Add amazing feature'
- Push to branch:
git push origin feature/amazing-feature
- Open a Pull Request
- Frontend: ESLint + Prettier
- Backend: Black + isort
- Commit messages: Conventional Commits
- Email Support: [email protected]
- GitHub Issues: Create an issue
This project is licensed under the MIT License - see the LICENSE file for details.
- Google Cloud for Gemini API and Drive integration
- Pinecone for vector database services
- Cohere for multilingual embeddings
- Vercel for seamless deployment
- Next.js team for the amazing framework
๐ Get Started | ๐ Star on GitHub
Made with โค๏ธ by Harsh Srivastava