A 100% Local, Privacy-First AI Learning Companion β Built by Team ZenForge for the Google Solution Challenge
GuruCortex is a full-stack, local-first Retrieval-Augmented Generation (RAG) application that transforms how you learn from documents. It combines a modern Next.js frontend with a powerful FastAPI backend to deliver an intelligent, privacy-conscious learning experienceβall running securely on your local device.
- π Complete Privacy: 100% local processing, zero cloud APIs, no data telemetry
- β‘ Instant Setup: Single-command deployment with Docker or native scripts
- π Smart Learning: AI-powered document analysis, quiz generation, and spaced repetition
- π¨ Modern Interface: Beautiful, responsive UI built with Next.js and Tailwind CSS
- π Offline-Ready: Works completely offline after initial model download
- Multi-Format Support: PDF, DOCX, PPTX, TXT
- Automatic Chunking: Intelligent text segmentation for optimal retrieval
- Semantic Search: Find relevant content using AI-powered similarity matching
- Citation Source Tracking: Know exactly where answers come from
- Local LLM Integration: Run Mistral-7B, Llama-3.2, or other models via Ollama
- Context-Aware Responses: RAG engine retrieves relevant document excerpts for accurate answers
- Generative Diagrams: Auto-generates Mermaid diagrams from document content
- Multi-Turn Conversations: Maintain context across multiple queries
- Intelligent Quiz Generation: Auto-generate MCQ, True/False, and short-answer questions
- Spaced Repetition (SM-2): Scientifically-proven algorithm for long-term retention
- Mastery Tracking: Monitor progress from Novice to Advanced levels
- Learning Analytics: Detailed insights on study patterns and performance
- Attention Tracking: Real-time focus monitoring via webcam (OpenCV, MediaPipe)
- Voice Input: Browser-based speech recognition (no external APIs)
- Text-to-Speech: Local audio output with natural voice synthesis
- Image Processing: Upload and analyze images with local models
- Conversation History: SQLite-backed persistent conversations
- Vector Embeddings: ChromaDB local vector database
- Learning Progress: Tracked study sessions and quiz results
- Customizable Storage: All data in
./datadirectory for easy backup
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | Next.js 14, React 18, TypeScript | Modern web UI with SSR |
| Tailwind CSS, Framer Motion | Styling and animations | |
| Mermaid.js, react-markdown | Diagrams and content rendering | |
| Axios | HTTP API client | |
| Backend | FastAPI, Uvicorn | High-performance REST API |
| Python 3.11+ | Core runtime | |
| Pydantic | Data validation | |
| RAG/ML | ChromaDB | Vector database |
| sentence-transformers | Embeddings generation | |
| LangChain | RAG orchestration | |
| PyPDF2, python-docx, python-pptx | Document parsing | |
| LLM | Ollama | Local inference engine |
| Google Gemma(2B/9B), Llama-3.2 | Large language models | |
| Storage | SQLite | Metadata & conversations |
| Local filesystem | Document & vector storage | |
| DevOps | Docker, Docker Compose | Containerization & orchestration |
- Windows, macOS, or Linux
- Docker & Docker Compose (recommended) OR Python 3.11+ & Node.js 18+
- Ollama installed with a model pulled (e.g.,
ollama pull llama3.2)
# Clone and navigate to project
git clone https://github.com/Paritosh2681/ZenForge.git
cd ZenForge
# Run complete system startup
.\start_complete_system.batAccess the application at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/docs
# Start full stack with Docker
docker-compose -f docker-compose.full.yml up -d
# View logs
docker-compose logs -f
# Access the same URLs as aboveStop services:
docker-compose downThen open http://localhost:3000 in your browser.
# Navigate to backend
cd backend
# Create virtual environment
python -m venv venv
# Activate environment (Windows)
venv\Scripts\activate
# Or on macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Start server
python -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload# Navigate to frontend
cd frontend
# Install dependencies
npm install
# Start development server
npm run devThen open http://localhost:3000 in your browser.
gurucortex/
βββ π README.md # This file
βββ π PROJECT_SUMMARY.md # Detailed project overview
βββ π QUICKSTART.md # Quick reference guide
βββ π OFFLINE_MODE.md # Offline functionality guide
β
βββ backend/ # Python FastAPI Application
β βββ app/
β β βββ main.py # FastAPI app & RAG engine
β β βββ config.py # Configuration management
β β βββ models/
β β β βββ schemas.py # Pydantic data models
β β βββ services/
β β β βββ document_processor.py # PDF/DOCX/PPTX parsing
β β β βββ vector_store.py # ChromaDB integration
β β β βββ llm_client.py # Ollama communication
β β β βββ rag_engine.py # RAG orchestration
β β βββ routers/
β β βββ documents.py # Upload endpoints
β β βββ chat.py # Query endpoints
β βββ requirements.txt # Python dependencies
β βββ requirements-minimal.txt # Minimal dependencies
β βββ Dockerfile # Container image
β βββ test_phase*.py # Test scripts
β
βββ frontend/ # Next.js React Application
β βββ app/
β β βββ page.tsx # Dashboard
β β βββ layout.tsx # Root layout
β β βββ globals.css # Global styles
β β βββ dashboard/ # Dashboard pages
β βββ components/ # React components
β β βββ ChatInterface.tsx # Chat UI
β β βββ DocumentUploader.tsx # File upload
β β βββ MermaidRenderer.tsx # Diagram rendering
β β βββ AssessmentHub.tsx # Quiz interface
β β βββ AnalyticsDashboard.tsx # Analytics display
β βββ lib/
β β βββ api-client.ts # API integration
β βββ public/ # Static assets
β βββ package.json # NPM dependencies
β βββ tsconfig.json # TypeScript config
β βββ tailwind.config.js # Tailwind CSS config
β βββ next.config.js # Next.js config
β βββ Dockerfile # Container image
β
βββ data/ # Local Data Storage
β βββ uploads/ # Uploaded documents
β βββ vectordb/ # ChromaDB storage
β βββ cache/ # Cached models
β βββ conversations.db # SQLite database
β βββ analytics/ # Learning data
β
βββ docs/ # Comprehensive Documentation
β βββ PHASE_1_SPEC.md # Phase 1 specification
β βββ PHASE_2_SPEC.md # Phase 2 specification
β βββ PHASE_3_SPEC.md # Phase 3 specification
β βββ PHASE_4_SPEC.md # Phase 4 specification
β βββ PHASE_4_SUMMARY.md # Implementation summary
β βββ DOCKER_SETUP.md # Docker guide
β βββ ARCHITECTURE.md # System architecture
β
βββ scripts/ # Utility Scripts
β βββ docker-start.bat # Windows Docker launcher
β βββ docker-start.sh # Linux/Mac Docker launcher
β βββ setup.bat # Windows setup
β βββ setup.sh # Linux/Mac setup
β
βββ docker-compose.yml # Main Docker configuration
βββ docker-compose.full.yml # Full stack with Ollama
βββ .gitignore # Git ignore rules
Users upload documents (PDF, DOCX, PPTX, or TXT) through the web interface.
Document Upload
β
[Text Extraction] (PyPDF2, python-docx, python-pptx)
β
[Chunking] (Semantic segmentation)
β
[Embedding] (sentence-transformers)
β
[Storage] (ChromaDB Vector Database)
User Question
β
[Embedding] (Convert query to vector)
β
[Retrieval] (Find similar chunks from ChromaDB)
β
[Context Building] (Combine chunks for LLM)
β
[LLM Processing] (Ollama generates response)
β
[Response Delivery] (Streamed to frontend)
User Document
β
[Topic Extraction] (Identify key concepts)
β
[Quiz Generation] (Create questions)
β
[Answer Evaluation] (Check against rubric)
β
[Spaced Repetition] (SM-2 algorithm scheduling)
β
[Analytics Update] (Track progress)
| Format | Extension | Status |
|---|---|---|
| Portable Document Format | .pdf |
β Fully Supported |
| Microsoft Word | .docx |
β Fully Supported |
| Microsoft PowerPoint | .pptx |
β Fully Supported |
| Plain Text | .txt, .md |
β Fully Supported |
| Python Code | .py |
β Fully Supported |
| Images (Analysis) | .jpg, .png, .gif |
β Supported via ML |
- Document upload and processing
- Vector embedding and search
- Chat interface with context
- Local LLM integration
- API documentation
- Image upload and analysis
- Attention tracking (webcam)
- Voice input (Speech Recognition)
- Text-to-Speech output
- Multi-language support
- Persistent conversation history
- Context window management
- Query rewriting
- Conversation search
- Export functionality
- Quiz generation (MCQ, T/F, Short Answer)
- Automatic grading
- Spaced repetition scheduling
- Mastery level tracking
- Learning analytics dashboard
- Study recommendations
- No external APIs are called for processing documents
- No telemetry or usage tracking
- No API keys required for core features
- All data stays local in the
./datadirectory GuruCortex
ZenForge works completely offline after initial setup:
- Documents are processed locally
- Embeddings are generated and stored locally
- LLM inference via Ollama (running on your machine)
- No internet connection needed for core features
- SQLite Database: Conversations and quiz results
- ChromaDB: Vector embeddings for semantic search
- File Storage: Uploaded documents in
./data/uploads - You own your data: Full control and accessibility
- CORS enabled only for localhost
- No sensitive data in logs
- Secure file upload validation
- Rate limiting on API endpoints
GuruCortexfline Mode Setup
ZenForge includes dedicated offline setup scripts. All components can run without internet:
# Automated offline setup (Windows)
.\Setup-Offline-AI.bat
# Or use Python setup (cross-platform)
python setup_offline.py
# Start in offline mode
.\Start-GuruCortex.batOffline Verification:
- Disconnect from internet
- Launch ZenForge
- Verify document processing, chat, quizzes, and analytics work
See OFFLINE_MODE.md for detailed instructions.
Once the backend is running, visit:
http://localhost:8000/docs
POST /api/documents/upload- Upload a documentGET /api/documents- List uploaded documentsDELETE /api/documents/{doc_id}- Delete a document
POST /api/chat/query- Query documents with streaming responseGET /api/chat/history- Get conversation historyDELETE /api/chat/clear- Clear conversation
POST /api/assessment/generate-quiz- Generate a quizPOST /api/assessment/submit-answer- Submit quiz answerGET /api/assessment/results- Get quiz resultsGET /api/assessment/analytics- Get learning analytics
GET /api/health- System health statusGET /api/config- Current configuration
# Start services
docker-compose -f docker-compose.full.yml up -d
# Check service status
docker ps
# View logs
docker-compose logs -f backend
docker-compose logs -f frontend
# Stop services
docker-compose down# Build just backend
docker build -t zenforge-backend ./backend
# Build just frontend
docker build -t zenforge-frontend ./frontend
# Run containers manually
docker run -p 8000:8000 zenforge-backend
docker run -p 3000:3000 zenforge-frontendEdit backend/app/config.py:
# Model settings
EMBEDDING_MODEL = "all-MiniLM-L6-v2" # or any sentence-transformers model
LLM_MODEL = "mistral:7b"
# Vector DB settings
CHUNK_SIZE = 500
CHUNK_OVERLAP = 50
# API settings
MAX_UPLOAD_SIZE_MB = 100
OLLAMA_BASE_URL = "http://localhost:11434"Edit frontend/lib/api-client.ts:
// API endpoint configuration
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000';
// Request timeout (ms)
const REQUEST_TIMEOUT = 30000;Use smaller models for faster processing:
EMBEDDING_MODEL = "all-MiniLM-L6-v2" # Smaller, faster
# Instead of: "all-mpnet-base-v2" # Larger, more accurateWhen uploading multiple documents, use the batch API:
# Process multiple files efficiently
POST /api/documents/batch-upload- Regularly clean old vectors:
POST /api/admin/cleanup - Monitor DB size: Check
data/vectordb/
- QUICKSTART.md - Fast setup guide
- PROJECT_SUMMARY.md - Detailed project overview
- OFFLINE_MODE.md - Offline operation guide
- docs/PHASE_4_SUMMARY.md - Complete feature summary
- docs/DOCKER_SETUP.md - Docker deployment guide
# Check Python version (needs 3.11+)
python --version
# Reinstall dependencies
pip install -r requirements.txt --force-reinstall
# Check if port 8000 is in use
netstat -ano | findstr :8000# Clear Next.js cache
rm -rf frontend/.next
# Reinstall dependencies
cd frontend && npm install
# Verify backend is running: http://localhost:8000/docs# Check if Ollama is running
curl http://localhost:11434/api/tags
# Pull a model if needed
ollama pull llama3.2
# Restart Ollama service- Use smaller embedding model:
all-MiniLM-L6-v2 - Reduce chunk size:
CHUNK_SIZE = 256 - Clear cache:
DELETE /api/admin/cache
We welcome contributions! Here's how you can help:
- Fork the repository
- Clone your fork:
git clone https://github.com/yourusername/zenforge.git - Create a branch:
git checkout -b feature/amazing-feature - Make your changes and commit:
git commit -m 'Add amazing feature' - Push to your fork:
git push origin feature/amazing-feature - Open a Pull Request
- Follow existing code style
- Add tests for new features
- Update documentation
- Test in both native and Docker environments
- π Bug fixes and improvements
- π Documentation enhancement
- π¨ UI/UX improvements
- π Performance optimization
- π Localization support
- π§ͺ Test coverage
- π Plugin/extension development
- Phase 1: Core RAG Foundation
- Phase 2: Multimodal Capabilities
- Phase 3: Conversation Management
- Phase 4: Assessment & Learning Analytics
- Plugin system for custom features
- Mobile app (iOS/Android)
- Advanced visualization tools
- Collaborative learning features
- API for third-party integrations
- Advanced NLP features (entity extraction, sentiment)
- Support for more file formats
- Backend: ~2000+ lines of Python/FastAPI code
- Frontend: ~3000+ lines of React/TypeScript code
- Documentation: 10+ comprehensive guides
- Supported Models: 50+ via Ollama
- File Types: 6+ formats supported
- API Endpoints: 20+ RESTful endpoints
This project is licensed under the MIT License - see LICENSE file for details.
- β Free for personal and commercial use
- β You can modify and distribute
- β No liability or warranty provided
- β Must include license in distributions
- AMD Slingshot Hackathon - The organizing event
- Open Source Community - For amazing libraries and tools
- FastAPI - Modern API framework
- Next.js - React framework
- ChromaDB - Vector database
- Ollama - Local LLM platform
- LangChain - LLM orchestration
- sentence-transformers - Embeddings
- Team ZenForge - Project team
- Hackathon Organizers - AMD & event sponsors
- Check Documentation: See docs/ folder first
- Search Issues: Look for similar problems on GitHub Issues
- Create New Issue: Describe the problem with steps to reproduce
- Join Community: Discussions and Q&A in GitHub Discussions
Open an issue with:
- OS and version
- Python/Node.js version
- Steps to reproduce
- Expected vs actual behavior
- Error logs
Describe the feature and why it would be useful
GuruCortex represents a new paradigm in AI-assisted learningβcombining the power of large language models with the privacy-first approach that users deserve. Whether you're a student, educator, researcher, or lifelong learner, GuruCortex provides the tools to learn smarter, faster, and more safely.
Join us in building the future of privacy-conscious AI learning.
GuruCortex | Built with β€οΈ by Team ZenForge
β If you find this project useful, please consider giving it a star! β