Skip to content
STACK IT FAST

LibreChat

Curated OSSHybridMulti-Model AI Agent & Chat Workspace6-20 People

Audited from github.com/danny-avila/LibreChat

LibreChat is a self-hostable, open-source chat interface that unifies many AI providers (OpenAI, Anthropic, Azure, Bedrock) behind one UI, adding agents, MCP tool support, code interpreters, and multi-user auth.

Language
TypeScript
Database
MongoDB
Hosting
Docker
License
MIT
Running for
2 years
Team
6-20 People

Why this architecture

A Node/Express API with a Mongoose-modeled MongoDB store handles chat state, while Vite builds the React client separately; optional Docker sidecars for pgvector, Meilisearch, and a Go OpenTelemetry relay keep RAG, search, and observability decoupled from the core API.

Tech stack by layer

12 technologies · audited Sep 17, 2026
Frontend & UI
  • ReactRenders the chat UI in client/src as a single-page app.
  • ViteBundles and dev-serves the React client.
  • Tailwind CSSStyles the client via the shared tailwind config.
Backend & APIs
  • ExpressServes the REST API and static client from the api/server entrypoint.
  • Model Context ProtocolAgents and the Assistants API connect to external MCP servers and tools.
Data & Persistence
  • MongoDBPrimary datastore for conversations, users, and agents.
  • RedisBacks caching, rate limiting, and resumable streams across scaled instances.
  • pgvectorStores document embeddings for the optional RAG API vector search.
Infrastructure & Deploy
  • Dockerdocker-compose.yml wires api, mongodb, meilisearch, vectordb, and rag_api together.
  • Gootel/langfuse-fanout is a small Go service relaying OpenTelemetry traces to Langfuse.
  • GitHub ActionsBuilds, tests, and publishes multi-arch Docker images across dozens of workflows.
Tooling, Testing & Ops
  • Model Context ProtocolThe Agents and Assistants endpoints call MCP servers for tool use via the SDK dependency.

LibreChat architecture diagram

Open SVG
LibreChat architecture diagramChat UI → API server (REST); API server → MongoDB (Mongoose); API server → Redis (cache); API server → Meilisearch (index); API server → RAG API (file search); RAG API → pgvector (vectors); API server → Model providers (provider SDKs); API server → MCP servers (tool calls); API server → Trace fanout (OTel traces); Trace fanout → Langfuse (relay)CLIENTSSERVICESWORKERS & JOBSDATA & STORAGEEXTERNALChat UIReact · ViteAPI serverExpress · PassportRAG APIoptionalTrace fanoutGo · OpenTelemetryMongoDBchats · users · agentsRediscache · streamsMeilisearchmessage searchpgvectorembeddingsModel providersOpenAI · Bedrock · VertexMCP serverstoolsLangfusetrace backendfile searchRESTOTel tracesMongoosecacheindexvectorsrelayprovider SDKstool calls
How the main components of LibreChat connect, drawn from the audited repository.
Diagram as text
  • Chat UI (React · Vite) → API server (Express · Passport): REST
  • API server (Express · Passport) → MongoDB (chats · users · agents): Mongoose
  • API server (Express · Passport) → Redis (cache · streams): cache
  • API server (Express · Passport) → Meilisearch (message search): index
  • API server (Express · Passport) → RAG API (optional): file search
  • RAG API (optional) → pgvector (embeddings): vectors
  • API server (Express · Passport) → Model providers (OpenAI · Bedrock · Vertex): provider SDKs
  • API server (Express · Passport) → MCP servers (tools): tool calls
  • API server (Express · Passport) → Trace fanout (Go · OpenTelemetry): OTel traces
  • Trace fanout (Go · OpenTelemetry) → Langfuse (trace backend): relay

Key architectural decisions

6 decisions
  1. 01

    MongoDB, not PostgreSQL, is the single source of truth

    Despite bundling a pgvector-backed vectordb container for RAG embeddings, core conversation, user, and agent data lives in MongoDB via Mongoose models in packages/data-schemas, per the mongodb service defined in docker-compose.yml.

  2. 02

    Client, backend, and shared logic are npm workspaces, not separate repos

    Root package.json declares workspaces for api, client, and packages/*, letting packages/data-provider, packages/data-schemas, and packages/api ship as versioned internal packages consumed by both api and client.

  3. 03

    RAG and search run as optional sidecar services

    docker-compose.yml adds vectordb (pgvector) and rag_api as separate containers, and search/compose.yml configures Meilisearch independently, so a minimal deployment can skip both without touching api/server code.

  4. 04

    A dedicated Go service fans out OpenTelemetry traces to Langfuse

    otel/langfuse-fanout/go.mod defines a small Go binary, wired up in docker-compose.langfuse-fanout.yml, that receives OTLP traces from the Node API and forwards them to a Langfuse instance, isolating that integration from the main backend process.

  5. 05

    Authentication supports many strategies through one Passport-based layer

    api/package.json lists passport-google-oauth20, passport-ldapauth, passport-jwt, passport-apple, passport-discord, passport-facebook, passport-github2, and @node-saml/passport-saml, all wired through api/strategies so OAuth, LDAP, SAML, and email/password login share one session model.

  6. 06

    MCP support lets agents call external tools instead of hardcoded plugins

    api/package.json depends on @modelcontextprotocol/sdk, and docs/skills-management-api.md plus the skill/ directory show LibreChat exposing SKILL.md-based agent capabilities layered on top of the MCP protocol.

How LibreChat is built

How LibreChat is structured

LibreChat is an npm workspace monorepo: root package.json declares api, client, and packages/* as workspaces. The api/ directory is the Express backend; client/ is the Vite-built React frontend; and packages/ holds internally versioned libraries — data-provider (shared API client/types), data-schemas (Mongoose models), api (the @librechat/api package with MCP, telemetry, and credential helpers), and client (@librechat/client, a shared React component library). A helm/ directory provides Kubernetes charts, and otel/langfuse-fanout is a standalone Go microservice for observability, kept outside the Node codebase entirely.

Frontend

The client is a Vite + React single-page app (client/vite.config.ts, client/package.json), styled with Tailwind CSS (client/tailwind.config.cjs) and PostCSS. It renders chat, agent management, and code-artifact previews, using Radix UI-based primitives (@radix-ui/react-dialog, @radix-ui/react-dropdown-menu, etc.) and Jotai/Recoil for state. client/package.json scripts show both an npm (vite build) and a Bun-accelerated (bun --bun vite build) build path. packages/client ships shared components (buttons, inputs) consumed by client/, versioned and built independently with tsdown.

Backend & APIs

api/server is the Express entrypoint, started via the root backend script (node api/server/index.js). Authentication goes through Passport, with api/package.json listing passport-jwt, passport-ldapauth, passport-google-oauth20, passport-github2, passport-facebook, passport-discord, and passport-apple, plus @node-saml/passport-saml for SAML SSO — all wired through api/strategies. Model access goes through provider SDKs and Bedrock/Vertex/Azure clients (@aws-sdk/client-bedrock-runtime, @anthropic-ai/vertex-sdk, @google/genai, openai) rather than a single unified LLM SDK. Agent tool use is built on the Model Context Protocol: api/package.json depends on @modelcontextprotocol/sdk, and docs/skills-management-api.md plus the skill/ directory describe a SKILL.md-based capability system layered on top of it. packages/api's @librechat/api package centralizes MCP, credentials, and telemetry logic shared by the main API.

Data & persistence

MongoDB is the system of record: docker-compose.yml runs a mongo:8.0.20 service (chat-mongodb), and packages/data-schemas defines Mongoose models and schemas consumed by the API. Redis supports caching, rate limiting, and resumable streaming — api/package.json depends on ioredis, @keyv/redis, connect-redis, and rate-limit-redis — enabling the README's claim that responses "automatically reconnect and resume" across horizontally scaled instances. The top-level redis-config/ directory goes further, shipping TLS certificates and per-node config files (redis-7001.conf through redis-7003.conf) plus start-cluster.sh/stop-cluster.sh scripts for running a real Redis cluster rather than a single instance, which matters for the "Multi-Tab & Multi-Device Sync" and horizontally scaled deployment claims in the README. Two optional services extend storage: vectordb, a pgvector/pgvector:0.8.0-pg15 Postgres image used only by the rag_api sidecar for document embeddings, and meilisearch (getmeili/meilisearch:v1.35.1) for full-text conversation search, both defined in docker-compose.yml and independently toggleable. A separate search/compose.yml and search/healthcheck.sh exist alongside the Meilisearch setup for validating that the search sidecar is reachable before the API depends on it.

Build, test & deploy

Builds run through turbo.json, which defines a shared build task depending on ^build across the workspace packages, with librechat-data-provider#build feeding data-schemas, api, and client builds. Testing is split by package: Jest for api/, client/, and the internal packages (jest.config.js in several locations), and Playwright for end-to-end suites under e2e/, which include dedicated configs for accessibility (playwright.config.a11y.ts), performance benchmarks (playwright.config.mobile-chat-perf.ts, playwright.config.navigation-perf.ts), and Redis-mode testing (playwright.config.redis.ts). CI is GitHub Actions-heavy: docker-publish.yml, docker-smoke.yml, tag-images.yml, and helmcharts.yml handle image builds and chart publishing, while frontend-review.yml/backend-review.yml and a11y.yml gate pull requests.

Self-hosting notes

The root Dockerfile builds a single Node 24 Alpine image containing both the built React client and the Express API, installing uv/uvx for extended MCP tool support and exposing port 3080. docker-compose.yml is the primary self-hosting path, bundling api, mongodb, an admin-panel (a separate clickhouse/librechat-admin-panel image), meilisearch, vectordb, and rag_api. deploy-compose.yml and config/deployed-update.js support updating an already-running deployment in place, and config/update.js plus config/smart-reinstall.js give operators scripted paths for local, Docker, and sudo-based upgrades without hand-editing compose files. For Kubernetes, helm/librechat and helm/librechat-rag-api provide charts, and the README links one-click deploy buttons for Railway, Zeabur, and Sealos as managed alternatives to self-hosting the full Docker Compose stack. Administrators manage users directly through CLI scripts under config/ (create-user.js, ban-user.js, add-balance.js, list-balances.js) rather than requiring a separate admin service for basic account operations, complementing the browser-based Admin Panel bundled in the Docker Compose stacks.

Sources & repo audit

Audited
Sep 17, 2026
Commit
12d7890
License
MIT

Independent analysis of repository at github.com/danny-avila/LibreChat. Spotted an inaccuracy? Use the claim form to request a correction.

Show this stack on your README or website
Tech stack of LibreChat
[![Tech stack of LibreChat on STACK IT FAST](https://stackitfast.com/badge/librechat.svg)](https://stackitfast.com/project/librechat)

Paste it into your README. It shows your current stack and links to this page.

Use this stack

Scaffold it with your agent

Paste this prompt into Claude Code, Cursor, Windsurf or AGY to start a project with LibreChat's architecture.

  1. 1Copy the promptThe full markdown spec, with every layer and decision.
  2. 2Open your AI toolClaude Code, Cursor, Windsurf or Copilot, in a new repo.
  3. 3Paste and scaffoldUse it as the first instruction; review before you ship.
use-this-stack.md · 61 lines · 7.1 KB
# MISSION: Scaffold "LibreChat" Production Architecture
You are an expert Senior Staff Software Architect and Full-Stack Engineer. Your mission is to scaffold and implement a production-grade, highly reliable, and modular codebase following the proven architecture of **LibreChat**.
---
## 1. PROJECT SPECIFICATIONS & BENCHMARK
- **Reference Architecture**: LibreChat
- **What It Does**: LibreChat is a self-hostable, open-source chat interface that unifies many AI providers (OpenAI, Anthropic, Azure, Bedrock) behind one UI, adding agents, MCP tool support, code interpreters, and multi-user auth.
- **Domain & Category**: Multi-Model AI Agent & Chat Workspace
- **Production Scale**: 6-20 People
- **Development Mode**: HYBRID
- **Architectural Rationale**: A Node/Express API with a Mongoose-modeled MongoDB store handles chat state, while Vite builds the React client separately; optional Docker sidecars for pgvector, Meilisearch, and a Go OpenTelemetry relay keep RAG, search, and observability decoupled from the core API.
- **Live Website Reference**: https://librechat.ai
- **Source Repository**: https://github.com/danny-avila/LibreChat
---
## 2. PRODUCTION TECH STACK
- **Full Stack Array**: TypeScript, JavaScript, React, Vite, Express, MongoDB, Redis, pgvector, Model Context Protocol, Go, Docker, Tailwind CSS
- **Primary Language(s)**: TypeScript, JavaScript
- **License of the reference repo**: MIT
- **Frontend**: React — Renders the chat UI in client/src as a single-page app.; Vite — Bundles and dev-serves the React client.; Tailwind CSS — Styles the client via the shared tailwind config.
- **Backend & APIs**: Express — Serves the REST API and static client from the api/server entrypoint.; Model Context Protocol — Agents and the Assistants API connect to external MCP servers and tools.
- **Data & persistence**: MongoDB — Primary datastore for conversations, users, and agents.; Redis — Backs caching, rate limiting, and resumable streams across scaled instances.; pgvector — Stores document embeddings for the optional RAG API vector search.
- **Infrastructure & deploy**: Docker — docker-compose.yml wires api, mongodb, meilisearch, vectordb, and rag_api together.; Go — otel/langfuse-fanout is a small Go service relaying OpenTelemetry traces to Langfuse.; GitHub Actions — Builds, tests, and publishes multi-arch Docker images across dozens of workflows.
- **Tooling, testing & ops**: Model Context Protocol — The Agents and Assistants endpoints call MCP servers for tool use via the SDK dependency.
---
## 3. KEY ARCHITECTURAL DECISIONS (audited from https://github.com/danny-avila/LibreChat @ 12d7890)
1. **MongoDB, not PostgreSQL, is the single source of truth**: Despite bundling a pgvector-backed vectordb container for RAG embeddings, core conversation, user, and agent data lives in MongoDB via Mongoose models in packages/data-schemas, per the mongodb service defined in docker-compose.yml.
2. **Client, backend, and shared logic are npm workspaces, not separate repos**: Root package.json declares workspaces for api, client, and packages/*, letting packages/data-provider, packages/data-schemas, and packages/api ship as versioned internal packages consumed by both api and client.
3. **RAG and search run as optional sidecar services**: docker-compose.yml adds vectordb (pgvector) and rag_api as separate containers, and search/compose.yml configures Meilisearch independently, so a minimal deployment can skip both without touching api/server code.
4. **A dedicated Go service fans out OpenTelemetry traces to Langfuse**: otel/langfuse-fanout/go.mod defines a small Go binary, wired up in docker-compose.langfuse-fanout.yml, that receives OTLP traces from the Node API and forwards them to a Langfuse instance, isolating that integration from the main backend process.
5. **Authentication supports many strategies through one Passport-based layer**: api/package.json lists passport-google-oauth20, passport-ldapauth, passport-jwt, passport-apple, passport-discord, passport-facebook, passport-github2, and @node-saml/passport-saml, all wired through api/strategies so OAuth, LDAP, SAML, and email/password login share one session model.
6. **MCP support lets agents call external tools instead of hardcoded plugins**: api/package.json depends on @modelcontextprotocol/sdk, and docs/skills-management-api.md plus the skill/ directory show LibreChat exposing SKILL.md-based agent capabilities layered on top of the MCP protocol.
---
## 4. NON-NEGOTIABLE ARCHITECTURAL GUARDRAILS
1. **Monorepo & Modular Separation**:
   - Structure as a Turborepo monorepo with strict package boundaries:
     - `apps/web`: Application UI, routing, layouts, and server endpoints.
     - `packages/ui`: Shared design tokens, CSS variables, and Radix UI primitive components.
     - `packages/db`: Database schemas, client singleton, declarative migrations, and seed scripts.
     - `packages/config`: Shared TypeScript, ESLint, and build configurations.
2. **Strict Type Safety & Zero `any` Policy**:
   - Enable `strict: true`, `noImplicitAny: true`, and `strictNullChecks: true`.
   - Validate ALL external inputs, API request bodies, and query parameters with **Zod** schemas before execution.
3. **Frontend & Rendering Guidelines**:
   - Utilize Vite 6 with TanStack Router for fully type-safe routing. Manage server state and caching via TanStack Query v5 with optimistic UI updates.
4. **Design System & Aesthetics**:
   - Keep every color, radius, shadow and font in a single token file (CSS variables) and consume tokens everywhere; never hardcode hex values in components.
   - Prefer crisp 1px borders and one subtle shadow scale over blurry default shadows. Pair one sans-serif for body/headings with one monospace for tags, badges, metrics, and code.
5. **Data Layer & Reliability**:
   - Write declarative schema definitions with foreign keys, composite indexes on queried filters, and automated timestamp triggers.
   - Use connection pooling and prepared statements for serverless database execution.
---
## 5. STEP-BY-STEP SCAFFOLDING ROADMAP
- **Phase 1: Workspace & Root Config**: Initialize package manager, monorepo configuration (`turbo.json`, `tsconfig.base.json`, `package.json`).
- **Phase 2: Database Schema & Client**: Set up the data layer (MongoDB, Redis, pgvector): client, connection pool, models, and migration scripts.
- **Phase 3: Design Tokens & UI Primitives**: Build accessible `Button`, `Input`, `Card`, `Badge`, and layout wrappers inside `packages/ui`.
- **Phase 4: Core Application Routes & Handlers**: Implement primary authentication, user session handling, and application routes.
- **Phase 5: Quality Assurance & Build Verification**: Run `tsc --noEmit`, ESLint, Prettier, and smoke test suites to ensure zero compilation or runtime errors.
---
## 6. EXECUTION INSTRUCTIONS
1. Review all specifications, architectural guardrails, and stack choices above.
2. Present the full monorepo directory tree structure.
3. Systematically generate the complete, production-ready codebase according to the 5-phase roadmap above — starting with the root workspace setup, followed by the database schema, UI design system package, and full-stack application routes until the repository is fully scaffolded and ready to run.
Scaffolded something with this prompt?
Would you pick this stack for a multi-model ai agent & chat workspace project?

Frequently asked about LibreChat

What is LibreChat built with?

LibreChat has a Node.js/Express API in api/ storing data in MongoDB, and a Vite-built React client in client/, organized as an npm workspace monorepo with shared packages under packages/.

Does LibreChat use PostgreSQL or MongoDB?

MongoDB is the primary database for conversations and users. PostgreSQL only appears via a pgvector-enabled vectordb container used by the optional RAG API for embeddings, per docker-compose.yml.

Can I self-host LibreChat?

Yes. The repository ships a root Dockerfile, docker-compose.yml, and Helm charts under helm/librechat for self-hosting, alongside deploy templates for Railway, Zeabur, and Sealos referenced in the README.

Does LibreChat support MCP (Model Context Protocol)?

Yes, the API depends on @modelcontextprotocol/sdk (see api/package.json) so Agents and the Assistants API can call external MCP servers and tools.

Does LibreChat support AI agents?

Yes. LibreChat has Agents and Assistants endpoints that call external tools through MCP servers, and agent definitions are stored in MongoDB alongside conversations and users.

One email a month: new deep dives and stack trends

New source-audited architectures, head-to-head comparisons and the monthly stack report. No spam, unsubscribe anytime.

use-this-stack.md