No description
- useQuery now returns data properly - useEffect sets synthesis state when loadedSynthesis changes - Synthesis will persist across page refreshes - No dependency on synthesis in useEffect (prevents loops) Synthesis persistence NOW WORKING! |
||
|---|---|---|
| backend | ||
| frontend | ||
| .DS_Store | ||
| ALL-COMPLETE.md | ||
| COMPLETE-FEATURE-LIST.md | ||
| CONTINUE-HERE.md | ||
| CRITICAL-ISSUES-AND-FIXES.md | ||
| CURRENT-STATUS-HONEST.md | ||
| docker-compose.yml | ||
| FINAL-COMPLETE-SUMMARY.md | ||
| FINAL-STATUS.md | ||
| FIX-PLAN.md | ||
| FIXES-COMPLETE.md | ||
| FIXES-IN-PROGRESS.md | ||
| KNOWN-ISSUES.md | ||
| MIGRATION-COMPLETE.md | ||
| MISSING-FEATURES.md | ||
| NEXT-SESSION.md | ||
| NEXT-STEPS.md | ||
| PORTS.md | ||
| README-MIGRATION.md | ||
| README.md | ||
| REMAINING-FIXES.md | ||
| SESSION-2-COMPLETE.md | ||
| SESSION-COMPLETE.md | ||
| STATUS.md | ||
| TRULY-FINAL.md | ||
| WORK-COMPLETE.md | ||
🦙 Sandbox-NotebookLM - Next.js Edition
Enterprise-ready alternative to Google NotebookLM, powered by LlamaIndex and multiple AI models.
Built with: Next.js 15, React 19, FastAPI, PostgreSQL, LlamaCloud
Repository: https://bitbucket.org/zlalani/sandbox-notebookllamalm-nextjs
🚀 Quick Start
Prerequisites
- Node.js 18+ and npm
- Python 3.10+
- Docker and Docker Compose
- PostgreSQL (via Docker)
Installation
1. Clone the repository:
git clone git@bitbucket.org:zlalani/sandbox-notebookllamalm-nextjs.git
cd sandbox-notebookllamalm-nextjs
2. Start Docker services:
docker-compose up -d
This starts:
- PostgreSQL (port 5433)
- Redis (port 6379)
- Jaeger (port 17000)
- Adminer (port 9001)
3. Set up Backend:
cd backend
# Create .env file with your API keys
cat > .env << 'EOF'
OPENAI_API_KEY=your_openai_key
LLAMACLOUD_API_KEY=your_llamacloud_key
ANTHROPIC_API_KEY=your_anthropic_key
GOOGLE_API_KEY=your_google_key
GROQ_API_KEY=your_groq_key
DEEPSEEK_API_KEY=your_deepseek_key
ELEVENLABS_API_KEY=your_elevenlabs_key
pgql_user=postgres
pgql_psw=admin
pgql_db=postgres
EOF
# Install dependencies with uv
pip install uv
uv sync
# Initialize database
uv run python -c "import sys; sys.path.insert(0, 'src/notebookllama'); from database import Base, engine; Base.metadata.create_all(bind=engine); print('✓ Database initialized')"
# Start backend
uv run uvicorn src.api.main:app --host 0.0.0.0 --port 9000 --reload
4. Set up Frontend:
cd ../frontend
# Install dependencies
npm install
# Start frontend
npm run dev
Access Points
- Frontend: http://localhost:4000
- Backend API: http://localhost:9000
- API Docs: http://localhost:9000/docs
- Database UI (Adminer): http://localhost:9001
- System: PostgreSQL
- Server: postgres
- Username: postgres
- Password: admin
- Database: postgres
- Jaeger Tracing: http://localhost:17000
📚 Features
Core Features
- ✅ User Authentication - Signup, login, protected routes
- ✅ Multi-Notebook Management - Create unlimited notebooks
- ✅ 6 AI Models - GPT-5, Claude 4.5, Gemini 2.5 Pro, GPT-4o, Gemini Flash, GPT-4
- ✅ Multi-Document Upload - Upload 1-20 PDFs per notebook
- ✅ Background Processing - Non-blocking document analysis
- ✅ Task Tracking - Real-time status updates
AI Analysis Features
- ✅ Document Summaries - AI-generated summaries per document
- ✅ Highlights Extraction - Key points from each document
- ✅ Q&A Generation - Auto-generated Q&A pairs per document
- ✅ Cross-Document Synthesis - Analyze all documents together
- Overall summary
- Common themes
- Key insights
- Comparative findings
- ✅ Podcast Generation - Create audio discussions from documents
- Customizable length (5-30 minutes)
- ElevenLabs voice selection
- Custom themes/prompts
- Background generation
- Audio player
Collaboration Features
- ✅ Notebook Sharing - Share with other users
- Permission levels (Read, Write, Share)
- Email-based sharing
- Manage access
- ✅ Chat Sessions - Multiple chat conversations
- Private chats
- Shared chats
- Rename/delete sessions
- Chat history
Chat Features
- ✅ Real-time WebSocket Chat - Instant responses
- ✅ Multi-Document Querying - Ask across all documents
- ✅ Source Citations - See which documents were used
- ✅ Session Management - Organize conversations
- ✅ Chat Sharing - Share conversations with collaborators
🏗️ Architecture
Tech Stack
Frontend:
- Next.js 15 (App Router)
- React 19
- TypeScript
- Tailwind CSS 4
- React Query (TanStack Query)
- Axios
- Zustand (state management)
Backend:
- FastAPI (Python)
- SQLAlchemy ORM
- PostgreSQL
- LlamaCloud/LlamaIndex
- WebSockets
- Background task queue
AI/ML:
- LlamaCloud for document indexing
- LlamaIndex for RAG
- OpenAI (GPT-4, GPT-5)
- Anthropic (Claude 3.5)
- Google (Gemini 2.0, 2.5)
- Groq, DeepSeek
- ElevenLabs (voice synthesis)
Infrastructure:
- Docker & Docker Compose
- Redis (caching)
- Jaeger (tracing)
- Adminer (database UI)
Database Schema (9 Tables)
- users - User accounts
- notebooks - Document collections
- documents - Uploaded files
- notebook_documents - Many-to-many relationship
- document_summaries - AI analysis results
- chat_sessions - Chat conversations
- chat_messages - Individual messages
- document_shares - Sharing permissions
- background_tasks - Async job queue
📖 Usage Guide
1. Create Account
- Navigate to http://localhost:4000
- Click "Sign up"
- Enter email, username, password (8+ characters)
2. Create Notebook
- Click "View Notebooks"
- Click "New Notebook"
- Enter name and description
- Select AI model (see pricing)
- Click "Create Notebook"
3. Upload Documents
- Open your notebook
- Click "Select PDF Files"
- Choose 1-20 PDFs
- Click "Upload X File(s)"
- Wait ~1 minute per document for processing
4. View Analysis
- Click on any document to expand
- View AI-generated summary
- See highlights
- Review Q&A pairs
5. Generate Cross-Document Analysis
- Click "Analyze" button
- Wait for AI to analyze all documents together
- View themes, insights, and findings
6. Generate Podcast
- Click "Podcast" button
- Select length (5-30 minutes)
- Add custom theme (optional)
- Click "Generate in Background"
- Wait 3-5 minutes
- Listen to audio discussion
7. Chat with Documents
- Click "Chat" button
- Create new chat session or select existing
- Ask questions about your documents
- Get AI responses with source citations
- Rename, share, or delete chat sessions
8. Share Notebook
- Click "Share" button
- Enter collaborator's email
- Select permission level:
- Read: View only
- Write: View + add documents
- Share: Write + can share with others
- Click "Share"
9. Access Shared Notebooks
- Click "Shared" in navigation
- View notebooks shared with you
- See owner, permission, document count
- Click "View" or "Chat"
🔑 API Keys Required
Add these to backend/.env:
# Required for all features
OPENAI_API_KEY=sk-...
LLAMACLOUD_API_KEY=llx-...
# Required for specific models
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=AI...
GROQ_API_KEY=gsk_...
DEEPSEEK_API_KEY=sk-...
# Required for podcast generation
ELEVENLABS_API_KEY=...
# Database (already configured)
pgql_user=postgres
pgql_psw=admin
pgql_db=postgres
Where to get keys:
- OpenAI: https://platform.openai.com/api-keys
- LlamaCloud: https://cloud.llamaindex.ai/
- Anthropic: https://console.anthropic.com/
- Google AI: https://makersuite.google.com/app/apikey
- Groq: https://console.groq.com/
- DeepSeek: https://platform.deepseek.com/
- ElevenLabs: https://elevenlabs.io/
🎯 AI Models & Pricing
| Model | Provider | Speed | Cost (per 1M tokens) | Best For |
|---|---|---|---|---|
| GPT-5 | OpenAI | Fast | $1.25/$10 | Latest, balanced |
| Claude 4.5 | Anthropic | Fast | $3/$15 | Complex reasoning |
| Gemini 2.5 Pro | Medium | $1.25/$5 | Cost-effective | |
| GPT-4o | OpenAI | Very Fast | $5/$15 | Speed + quality |
| Gemini Flash | Ultra Fast | $0.075/$0.30 | Budget-friendly | |
| GPT-4 | OpenAI | Medium | $30/$60 | Legacy support |
🔌 API Endpoints
Full API documentation available at http://localhost:9000/docs
Key endpoints:
/api/auth/*- Authentication/api/notebooks/*- Notebook management/api/documents/*- Document upload & summaries/api/chat/*- WebSocket chat & sessions/api/admin/*- Admin dashboard
🐛 Troubleshooting
Backend won't start
# Check if port 9000 is in use
lsof -i :9000
# Kill existing process
pkill -f "uvicorn.*9000"
# Restart backend
cd backend && uv run uvicorn src.api.main:app --host 0.0.0.0 --port 9000 --reload
Database connection errors
# Check PostgreSQL is running
docker ps | grep postgres
# Restart Docker services
docker-compose restart
# Reinitialize database
cd backend && uv run python -c "import sys; sys.path.insert(0, 'src/notebookllama'); from database import Base, engine; Base.metadata.create_all(bind=engine)"
Frontend won't build
cd frontend
rm -rf .next node_modules package-lock.json
npm install
npm run dev
📝 License
Open source - based on NotebookLlama project
Version: 2.0.0 Last Updated: October 2025