Complete technical reference for installation, configuration, and deployment.
- Streaming AI Chat - Real-time streaming interaction with local LLM inference via WebSocket
- PDF Summarization - Document processing and memory externalization mechanism
- RAG Memory System - Retrieval-augmented generation with persistent knowledge base indexing
- Study Planner - Temporal planning feedback loop with session scheduling
- Exam Mode - Question generation and automated evaluation loop
- Flashcard Generator - Structured recall primitives with spaced repetition
- Voice Chat - Audio input interaction surface with speech-to-text conversion
- Workspace Management - Document organization and namespace isolation
- Persistent Local Knowledge Base - Persistent knowledge base that survives session boundaries
Frontend:
- Next.js 14 (App Router)
- React 18 + TypeScript
- TailwindCSS + shadcn/ui
- Framer Motion
- React Query
Backend:
- FastAPI (Python)
- PostgreSQL + SQLAlchemy
- Redis (caching & queues)
- WebSockets (real-time streaming)
- Celery (background tasks)
AI:
- Ollama (Free, Local, Unlimited)
- Google AI Studio (Gemini API) - Optional primary provider
- LlamaIndex (RAG)
- TF-IDF (Knowledge Base)
forgeai/
├── backend/ # FastAPI backend
│ ├── app/
│ │ ├── api/v1/ # API routes
│ │ ├── core/ # Config, brain, kb, security
│ │ ├── models/ # Database models
│ │ └── services/ # Business logic
│ ├── alembic/ # Database migrations
│ └── requirements.txt
├── frontend/ # Next.js frontend
│ ├── app/ # App router pages
│ ├── components/ # React components
│ └── lib/ # Utilities
├── docs/ # Documentation
└── README.md
- Python 3.9+ (Python 3.13 recommended)
- Node.js 18+
- PostgreSQL 12+
- Redis (optional, for caching and background tasks)
- Ollama - Download from https://ollama.ai/download
# Download from https://ollama.ai/download
# Then pull a model:
ollama pull llama3.1:8bcd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\Activate.ps1
# Upgrade pip and install dependencies
pip install --upgrade pip setuptools wheel
pip install pydantic-core --only-binary :all: # Fix for Python 3.13
pip install -r requirements.txt
# Set up environment
cp .env.example .env
# Edit .env with your PostgreSQL credentials:
# DATABASE_URL=postgresql+psycopg://username:password@localhost/forgeai
# DATABASE_URL_ASYNC=postgresql+asyncpg://username:password@localhost/forgeai
# Create PostgreSQL database
# Option 1: Using createdb command
createdb forgeai
# Option 2: Using psql
psql -U postgres
CREATE DATABASE forgeai;
\q
# Option 3: Using pgAdmin GUI
# Right-click "Databases" → Create → Database → Name: forgeai
# Run database migrations
alembic upgrade head
# Start server
uvicorn app.main:app --reloadBackend runs on http://localhost:8000
cd frontend
# Install dependencies
npm install
# Set up environment
cp .env.example .env.local
# Edit .env.local if needed (defaults work for local development)
# Start dev server
npm run dev- Backend: Visit http://localhost:8000/api/docs (Swagger UI)
- Frontend: Visit http://localhost:3000
- Ollama: Run
ollama listto verify model is installed - Database: Backend should start without connection errors
Problem: pydantic-core requires Rust/Cargo
Solution:
pip install pydantic-core --only-binary :all:
pip install -r requirements.txtProblem: asyncpg or hiredis build errors
Solution: These are optional. Comment them out in requirements.txt if you don't need async PostgreSQL or Redis performance optimizations.
Problem: numpy build errors on Python 3.13
Solution: Python 3.13 requires numpy 2.x. Update langchain to >=0.1.0 for compatibility.
- Verify PostgreSQL is running:
pg_isreadyor check Windows Services - Check credentials in
backend/.env - Ensure database
forgeaiexists - Test connection:
psql -U username -d forgeai
- Verify Ollama is running:
curl http://localhost:11434/api/tags - Pull model:
ollama pull llama3.1:8b - Check model:
ollama list
The system supports dual-model architecture with automatic fallback:
Primary: Google AI Studio (Gemini)
- Model:
gemini-2.5-flash(default) - Requires:
GOOGLE_AI_API_KEYin.env - Fast, cloud-based, rate-limited
Fallback: Ollama (Local)
- Model:
llama3.1:8b(default) - Requires: Ollama running on
http://localhost:11434 - Slower, unlimited, local-only
The system automatically falls back to Ollama when:
- Google AI rate limit is hit
- Daily quota is exceeded
- Network error occurs
- Google AI API key is not configured
Backend (backend/.env):
# Database
DATABASE_URL=postgresql+psycopg://username:password@localhost:5432/forgeai
DATABASE_URL_ASYNC=postgresql+asyncpg://username:password@localhost:5432/forgeai
# Security
SECRET_KEY=your-secret-key-change-in-production
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=10080
# Ollama
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=llama3.1:8b
# Google AI (Optional)
GOOGLE_AI_API_KEY=your-api-key-here
GOOGLE_AI_MODEL=gemini-2.5-flash
# Redis (Optional)
REDIS_URL=redis://localhost:6379/0Frontend (frontend/.env.local):
NEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_WS_URL=ws://localhost:8000cd backend
pytestcd frontend
npm testSee CONTRIBUTING.md for more testing guidelines.
- Architecture Guide - System architecture and design decisions
- Deployment Guide - Production deployment guide
- Contributing Guide - How to contribute to ForgeAI
- Code of Conduct - Community guidelines
- Local inference - Models execute on local hardware, eliminating cloud API dependencies
- Zero external dependencies - System operates without network calls to third-party services
- Inspectability - Model weights and inference process are accessible for analysis
- Cost determinism - Compute costs are bounded by hardware capacity, not usage volume
- Offline operation - System functions without network connectivity requirements
- Modular Design - Clean separation of concerns
- Type-Safe - TypeScript + Pydantic
- Scalable - Async/await, background workers
- Production-Ready - Error handling, logging, migrations
See ARCHITECTURE.md for detailed architecture documentation.
Contributions are welcome! Please read our Contributing Guide and Code of Conduct before submitting PRs.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests and ensure they pass
- Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Enhanced RAG with vector embeddings
- Mobile app support
- Collaborative workspaces
- Advanced analytics and insights
- Plugin system for extensibility
- Multi-language support
ForgeAI is provided as-is for educational and personal use. The AI models used (Ollama) are run locally and I'm not responsible for the content generated by these models.