AnythingLLM is a full-stack Retrieval-Augmented Generation (RAG) application that enables users to chat with their documents using any LLM or vector database provider. This document provides a high-level overview of the system architecture, core components, and how they interact.
For detailed information on specific subsystems:
Sources: README.md1-299 server/package.json1-113
AnythingLLM is designed as a provider-agnostic RAG platform with the following key characteristics:
| Characteristic | Description |
|---|---|
| Multi-Provider Support | 30+ LLM providers, 10+ vector databases, 10+ embedding engines |
| Multi-Tenant | Workspace-based isolation with per-tenant configuration |
| Modular Architecture | Three-service design: frontend, server, collector |
| Flexible Deployment | Docker, bare metal, cloud platforms (AWS, GCP, Azure) |
| Runtime Configuration | Settings updated via updateENV without restart |
| Agent Capabilities | AIbitat framework for multi-step tool-calling workflows |
Sources: README.md39-72 server/utils/helpers/updateENV.js1-1338
Sources: README.md152-162 package.json1-47 server/package.json1-113 collector/package.json1-61
AnythingLLM operates as a monorepo with three distinct services that communicate via HTTP:
frontend/src/main.jsxserver/index.jscollector/index.jsSources: package.json20-28 server/package.json12-16 collector/package.json12-15 docker/Dockerfile1-223
Sources: server/utils/chats/stream.js1-252 server/utils/helpers/index.js84-384 server/models/workspaceChats.js1-293
AnythingLLM implements a factory pattern for all external integrations, allowing runtime provider selection:
All providers implement a common interface defined in JSDoc comments:
Sources: server/utils/helpers/index.js34-384 server/utils/helpers/updateENV.js7-830
The configuration system is the highest importance cluster (286.89 in the provided analysis) and orchestrates all system behavior:
The updateENV function at server/utils/helpers/updateENV.js1164-1220 implements a sophisticated pipeline:
validOpenAIKey, supportedLLM)validatePGVectorConnectionString)process.env[key] = valuehandleVectorStoreReset, downloadEmbeddingModelIfRequired).env file via dumpENV() and system_settings tableevent_logs tableSources: server/utils/helpers/updateENV.js1-1338 server/models/systemSettings.js1-1164
AnythingLLM uses Prisma ORM with SQLite (default) or PostgreSQL:
Key tables:
workspaces: Tenant containers with LLM/vector configurationworkspace_chats: Chat history with optional thread/user scopingworkspace_documents: Document-to-workspace mapping with pinned/watched flagsdocuments: Document metadata and processing statusdocument_vectors: Document-to-vectorId mapping for deletionusers: Multi-user mode accounts with role-based accesssystem_settings: Persisted configuration key-value pairsembed_configs: Public chat widget configurationsSources: server/prisma/schema.prisma1-426 server/models/workspace.js1-1174 server/models/workspaceChats.js1-293
jsonwebtoken + bcryptjs hashing (server/package.json44-64)@mintplex-labs/express-ws for agent communication (server/package.json35)@mintplex-labs/bree for background tasks (server/package.json34)pdf-parse (collector/package.json38)mammoth (collector/package.json30)tesseract.js for image text extraction (collector/package.json43)@xenova/transformers for local Whisper models (collector/package.json19)openai, @anthropic-ai/sdk, @aws-sdk/client-bedrock-runtime, ollama, cohere-ai (server/package.json22-72)chromadb, @pinecone-database/pinecone, @qdrant/js-client-rest, weaviate-ts-client, @lancedb/lancedb (server/package.json26-86)@xenova/transformers for native embeddings (server/package.json40)Sources: server/package.json1-113 collector/package.json1-61 README.md152-162
AnythingLLM supports multiple deployment strategies:
| Deployment Type | Mechanism | Port Configuration |
|---|---|---|
| Docker | Multi-stage Dockerfile with ARM64/AMD64 support | 3001 exposed, 3000/8888 internal |
| Bare Metal | Direct Node.js execution | 3001 (server), 3000 (frontend), 8888 (collector) |
| AWS CloudFormation | IaC templates in cloud-deployments/aws/ | ECS Fargate with ALB |
| GCP Cloud Run | IaC templates in cloud-deployments/gcp/ | Container-based deployment |
| Kubernetes Helm | Charts in cloud-deployments/helm/ | ConfigMaps for environment |
| Desktop Apps | Electron-based (separate repository) | Bundled services |
Docker is the recommended production deployment:
anythingllm user with configurable UID/GID (docker/Dockerfile42-46)uvx for MCP (Model Context Protocol) compatibility (docker/Dockerfile32-36)Sources: docker/Dockerfile1-223 README.md163-175 .github/workflows/dev-build.yaml1-120
chatProvider/chatModel fieldsevent_logs.env file + database) ensures config survives restartsSources: server/utils/helpers/updateENV.js1062-1094 server/utils/helpers/index.js84-384 README.md152-162
Refresh this wiki