Open-source AI Agent Orchestration Platform
Multi-model LLM Gateway Β Β·Β ReAct Agent Engine Β Β·Β RAG Pipeline Β Β·Β Desktop Client
Features Β β’Β Tech Stack Β β’Β Getting Started Β β’Β Architecture Β β’Β Roadmap Β β’Β δΈζζζ‘£
OpenCat is a self-hosted AI agent platform that gives you full control over your LLM workflows. Instead of relying on closed-source tools, you get a production-grade system with multi-model routing, autonomous agents, knowledge retrieval, and a clean desktop experience β all running on your own infrastructure.
No LangChain. No magic wrappers. Every agent loop, tool call, and retrieval pipeline is implemented from scratch for full transparency and zero vendor lock-in.
- SSE Streaming Chat β Real-time token streaming via Server-Sent Events
- Authentication β NextAuth v5 with GitHub OAuth + email/password credentials
- Conversation Persistence β Full message history stored in PostgreSQL
- Encrypted API Key Storage β AES-256-GCM encryption for all stored secrets
- Theme System β Warm gray + amber design with light/dark mode
- Zustand State β Client-side conversation management with optimistic updates
- Multi-Model Gateway β Route between OpenAI, Anthropic, and custom providers
- ReAct Agent Engine β Autonomous reasoning + action loops with tool calling
- Multi-Agent Orchestration β Orchestrator pattern for complex workflows
- Memory System β Auto-summarization with pgvector similarity search
- RAG Pipeline β Document upload β chunking β embedding β retrieval
- Token Dashboard β Usage analytics and cost tracking
- Tauri 2.0 Desktop β Native cross-platform client
| Layer | Technology |
|---|---|
| Framework | Next.js 16 (App Router) + React 19 |
| Language | TypeScript 5 (strict mode) |
| Styling | TailwindCSS 4 + Geist Font |
| Database | PostgreSQL 17 + pgvector |
| ORM | Prisma 7 with @prisma/adapter-pg |
| Cache | Redis 7 |
| Auth | NextAuth v5 (JWT sessions) |
| AI | Vercel AI SDK 6.x |
| State | Zustand 5 |
| Validation | Zod 4 |
| Desktop | Tauri 2.0 (planned) |
| Package Manager | pnpm 10 |
- Node.js 22 LTS
- pnpm 10+
- Docker (for PostgreSQL + Redis)
git clone https://github.com/li3500764/opencat.git
cd opencat
pnpm installdocker compose up -dThis spins up:
- PostgreSQL 17 (pgvector) on port
5433 - Redis 7 on port
6379
cp .env.example .envEdit .env with your values:
DATABASE_URL="postgresql://opencat:opencat@localhost:5433/opencat?schema=public"
AUTH_SECRET="your-auth-secret" # openssl rand -base64 32
ENCRYPTION_KEY="your-encryption-key" # openssl rand -hex 32
OPENAI_API_KEY="sk-..."npx prisma db pushpnpm devOpen http://localhost:3001 and create an account to start chatting.
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client (React 19) β
β ββββββββββββ ββββββββββββ ββββββββββββββββββ β
β β Chat UI β β Sidebar β β Theme Provider β β
β β useChat()β β Zustand β β Light / Dark β β
β ββββββ¬ββββββ ββββββββββββ ββββββββββββββββββ β
β β SSE Stream β
βββββββββΌβββββββββββββββββββββββββββββββββββββββββββ€
β βΌ Server (Next.js App Router) β
β βββββββββββ ββββββββββββ βββββββββββββββββββ β
β β Chat APIβ β Auth API β β Conversations β β
β β stream β β NextAuth β β API β β
β β Text() β β v5 + JWT β β CRUD β β
β ββββββ¬βββββ ββββββββββββ ββββββββββ¬βββββββββ β
β β β β
β ββββββΌβββββββββββββββββββββββββββββββΌββββββββββ β
β β Prisma 7 + pg Pool Adapter β β
β ββββββββββββββββββββ¬βββββββββββββββββββββββββββ β
βββββββββββββββββββββββΌβββββββββββββββββββββββββββββ€
β βΌ Infrastructure β
β ββββββββββββββββββββββββ βββββββββββββββββββββ β
β β PostgreSQL 17 β β Redis 7 β β
β β + pgvector β β Cache / Queue β β
β β 15 tables β β β β
β ββββββββββββββββββββββββ βββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
User βββ¬ββ Account (OAuth)
βββ Session
βββ ApiKey (AES-256-GCM encrypted)
βββ Project βββ¬ββ Agent (systemPrompt, tools[], model)
β βββ Conversation ββ Message (role, parts, tokenCount)
β βββ KnowledgeBase ββ Document ββ DocumentChunk (embedding)
βββ Memory (pgvector 1536d)
βββ UsageLog (token tracking)
src/
βββ app/
β βββ (auth)/ # Login / Register pages
β βββ (dashboard)/ # Protected chat interface
β βββ api/
β βββ auth/ # NextAuth + registration
β βββ chat/ # SSE streaming endpoint
β βββ conversations/ # CRUD operations
βββ components/
β βββ chat/ # ChatPanel, MessageList, ChatInput, Markdown
β βββ layout/ # Sidebar, ThemeProvider, ThemeToggle
βββ lib/ # auth.ts, crypto.ts, utils.ts
βββ server/db/ # Prisma client singleton
βββ stores/ # Zustand (chat, theme)
βββ types/ # NextAuth type augmentation
| Phase | Milestone | Status |
|---|---|---|
| 1 | Scaffolding + Auth + Database Schema | β |
| 2 | Single Model Chat + SSE Streaming | β |
| 3 | Multi-Model Gateway + API Key Management | β³ |
| 4 | Tool Calling + ReAct Agent Engine | β³ |
| 5 | Multi-Agent Orchestration + Project Isolation | β³ |
| 6 | Memory System + RAG with pgvector | β³ |
| 7 | Usage Dashboard + Tauri 2.0 Desktop Client | β³ |
- No LangChain β Self-implemented agent runtime for full control and zero abstraction overhead
- No AI-gradient UI β Clean warm-gray + amber palette inspired by Linear and Raycast
- Security first β AES-256-GCM encrypted key storage, JWT sessions, bcrypt password hashing
- Production patterns β Connection pooling, singleton clients, streaming responses, usage tracking
Built with obsession by @li3500764